📄 admin.php
字号:
<?
/*
admin.php - base function for system control panel
Version : 1.0.0
Author : Tracemouse (tracemouse@msn.com)
Copyright:
Writed : 2003/08/07
Modified : 2002/08/07
*/
function template($file) {
global $site_root, $tplrefresh;
$tpldir = './html';
$tplfile = $tpldir.'/'.$file.'.htm';
$objfile = '../tempdata/templates/'.$file.'_admin.tpl.php';
if (!file_exists($objfile)){
require_once '../include/template.php';
parse_template($tplfile,$objfile);
return $objfile;
}
if(@filemtime($tplfile) > @filemtime($objfile)) {
require_once $site_root.'../include/template.php';
parse_template($tplfile,$objfile);
}
return $objfile;
}
function sizecount($filesize) {
if($filesize >= 1073741824) {
$filesize = round($filesize / 1073741824 * 100) / 100 . ' G';
} elseif($filesize >= 1048576) {
$filesize = round($filesize / 1048576 * 100) / 100 . ' M';
} elseif($filesize >= 1024) {
$filesize = round($filesize / 1024 * 100) / 100 . ' K';
} else {
$filesize = $filesize . ' bytes';
}
return $filesize;
}
function gotourl($message='',$url='')
{
global $language;
$html ="<html><head>";
if(!empty($url))
$html .="<meta http-equiv='refresh' content=\"1;url='".$url."'\">";
$html .="<link href='./html/style.css' type=text/css rel=stylesheet>";
$html .="</head><body><br><br><br><br>";
$html .="<table cellspacing='0' cellpadding='0' border='0' width='450' align='center'>";
$html .="<tr><td bgcolor='#000000'>";
$html .="<table border='0' cellspacing='1' cellpadding='4' width='100%'>";
$html .="<tr class='m_title'>";
$html .="<td>".$language['messagebox_title']."</td></tr>";
$html .="<tr class='line_1'><td align='center' height='60'>";
$html .="<br>".$message."<br><br>";
if (!empty($url))
$html .="[<a href=".$url." target=_self>".$language['messagebox_exp_1']."</a>]";
else
$html .="[<a href='#' onclick='history.go(-1)'>".$language['messagebox_exp_2']."</a>]";
$html .="</td></tr></table></td></tr></table>";
$html .="</body></html>";
echo $html;
exit;
}
/*
function productnum_sort($sortid)
{
global $db,$table_sorts,$table_products;
if (empty($sortid)) return 0;
$num = 0;
$query=$db->query("SELECT COUNT(*) FROM $table_products WHERE sortid=$sortid");
if(!($n=$db->result($query,0)) $num=0;
else $num += $n;
$query = $db->query("select * from $table_sorts where supsortid=$sortid ORDER BY sortid");
while($dbq_rec = $db->fetch_array($query))
{
$sortid=$dbq_rec['sortid'];
$queryn=$db->query("SELECT COUNT(*) FROM $table_products WHERE sortid=$sortid");
if(($n=$db->result($queryn,0)) $num += $n;
$query1 = $db->query("SELECT * FROM $table_sorts WHERE supsortid = $sortid");
while($dbq_rec1 = $db->fetch_array($query1))
{
$sortid=$dbq_rec1['sortid'];
$queryn=$db->query("SELECT COUNT(*) FROM $table_products WHERE sortid=$sortid");
if(($n=$db->result($queryn,0)) $num += $n;
$query2 = $db->query("SELECT * FROM $table_sorts WHERE supsortid = $sortid");
while($dbq_rec2 = $db->fetch_array($query2))
{
$sortid=$dbq_rec2['sortid'];
$queryn=$db->query("SELECT COUNT(*) FROM $table_products WHERE sortid=$sortid");
if(($n=$db->result($queryn,0)) $num += $n;
}
}
}
unset($query);unset($query1);unset($query2);unset($queryn);
unset($dbq_rec);unset($dbq_rec1);unset($dbq_rec2);
return $num;
}
*/
function sqldumptable($table, $startfrom = 0, $currsize = 0) {
global $db, $multivol, $sizelimit, $startrow;
$offset = 64;
if(!$startfrom)
{
$tabledump = "DROP TABLE IF EXISTS $table;\n";
$createtable = $db->query("SHOW CREATE TABLE $table");
$create = $db->fetch_row($createtable);
$tabledump .= $create[1].";\n\n";
}
$tabledumped = 0;
$numrows = $offset;
while(($multivol && $currsize + strlen($tabledump) < $sizelimit * 1000 && $numrows == $offset) || (!$multivol && !$tabledumped))
{
$tabledumped = 1;
if($multivol)
{
$limitadd = "LIMIT $startfrom, $offset";
$startfrom += $offset;
}
$rows = $db->query("SELECT * FROM $table $limitadd");
$numfields = $db->num_fields($rows);
$numrows = $db->num_rows($rows);
while ($row = $db->fetch_row($rows))
{
$comma = "";
$tabledump .= "INSERT INTO $table VALUES(";
for($i = 0; $i < $numfields; $i++)
{
$tabledump .= $comma."'".mysql_escape_string($row[$i])."'";
$comma = ",";
}
$tabledump .= ");\n";
}
}
$startrow = $startfrom;
$tabledump .= "\n";
return $tabledump;
}
function splitsql($sql){
$sql = str_replace("\r", "\n", $sql);
$ret = array();
$num = 0;
$queriesarray = explode(";\n", trim($sql));
unset($sql);
foreach($queriesarray as $query) {
$queries = explode("\n", trim($query));
foreach($queries as $query) {
$ret[$num] .= $query[0] == "#" ? NULL : $query;
}
$num++;
}
return($ret);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -