"; echo "注销成功......

三秒后自动退出或单击这里退出程序界面>>>"; exit; } if ($login) { $adminpass=trim($_POST['adminpass']); if ($adminpass==$admin['pass']) { $_SESSION['adminpass'] = $admin['pass']; echo ""; echo "登陆成功......

三秒后自动跳转或单击这里进入程序界面>>>"; exit; } } if (session_is_registered('adminpass')) { if ($_SESSION['adminpass']!=$admin['pass']) { loginpage(); } } else { loginpage(); } } else { /*------- cookie 验证 -------*/ if ($_GET['action'] == "logout") { setcookie ("adminpass", ""); echo ""; echo "注销成功......

三秒后自动退出或单击这里退出程序界面>>>"; exit; } if ($login) { $adminpass=trim($_POST['adminpass']); if ($adminpass==$admin['pass']) { setcookie ("adminpass",$admin['pass'],time()+(1*24*3600)); echo ""; echo "登陆成功......

三秒后自动跳转或单击这里进入程序界面>>>"; exit; } } if (isset($_COOKIE['adminpass'])) { if ($_COOKIE['adminpass']!=$admin['pass']) { loginpage(); } } else { loginpage(); } } }//end check /*===================== 验证结束 =====================*/ //////////////////////end////////////////////////////// $linkdb=0; $linkdb=@mysql_connect($dbhost,$dbuser,$dbpw); ?>
注销会话
数据库名称:
要进行操作的数据库: 执行SQL语句:

"; exit; } // 备份数据库 if($cmd =='bakdb' and $db!='' and $path !=''){ $dbname=$db; @mysql_select_db($dbname) or die("选择数据库失败"); $filehandle = @fopen($path,"w"); if ($filehandle) { $result = mysql_query("SHOW tables"); echo ($result) ? NULL : "出错: ".mysql_error(); while ($currow = mysql_fetch_array($result)) { if (isset($currow[0])) { sqldumptable($currow[0], $filehandle); fwrite($filehandle,"\n\n\n"); } } fclose($filehandle); echo "数据库".$dbname."已成功备份到 ".$path.""; mysql_close(); } else { echo "备份失败,请确认目标文件夹是否具有可写权限."; } } // 删除数据库 if ($cmd=='dropdb' and $db!=''){ $dbname=$db; $result = mysql_drop_db($dbname)? "删除数据库:\t".$dbname."\t成功!":"删除数据库\t".$dbname."\t失败:".mysql_error(); echo $result; $url =$_SERVER['PHP_SELF']; echo ""; exit; } //删除表 if($cmd=='droptb' and $db!='' and $tbname !=''){ $dbname=$db; mysql_select_db($dbname) or die("选择数据库失败"); $vtb="drop table $tbname"; $result = @mysql_query($vtb)? "删除数据库:\t".$dbname."\t中表:\t".$tbname."\t成功!":"删除数据库\t".$dbname."\t中表:\t".$tbname."\t失败:".mysql_error(); echo $result; $url ="?db=".urlencode($dbname)."&cmd=showtb"; echo ""; exit; } //备份表 if($cmd=='baktb' and $db!='' and $tbname !='' and $path !=''){ $dbname=$db; mysql_select_db($dbname) or die("选择数据库失败"); $filehandle = @fopen($path,"w"); if ($filehandle) {sqldumptable($tbname, $filehandle); fwrite($filehandle,"\n\n\n"); fclose($filehandle); echo "表".$tbname."已成功备份到 ".$path.""; mysql_close(); } else { echo "备份失败,请确认目标文件夹是否具有可写权限."; } } ?>
'; echo "数据库:"; while ($row = mysql_fetch_object($db_list)) { $dblsit= $row->Database; echo " ".$dblsit."显示表备份删除\n"; } echo ""; //mysql_close(); } else { echo "连接数据库失败!"; exit; } //显示所有表 if ($cmd=='showtb' and $db!=''){ $dbname=$db; @mysql_select_db($dbname) or die ("Could not db!"); $tableid=mysql_list_tables($dbname); //列出指定数据库的表返回一个ID echo ''; echo " "; for ($i = 0; $i < mysql_num_rows($tableid); $i++){ $tablename=mysql_tablename($tableid, $i); echo "\n"; } echo "
数据库".$dbname."所有表:
".$tablename."表详细信息浏览前10行数据备份删除
"; } //显示表的字段信息 if($cmd=='showtbinfo' and $tbname!='' and $db !=''){ $dbname=$db; $tablefield=mysql_list_fields($dbname,$tbname,$linkdb);//列出表的字段 $fileds=mysql_num_fields($tablefield); //返回表字段的数目 $rows=mysql_num_rows($tablefield);//返回表行的数目 $i=0; echo ''; echo " "; echo ""; while($i<$fileds) { $type=mysql_field_type($tablefield,$i); $name=mysql_field_name($tablefield,$i); $len=mysql_field_len($tablefield,$i); $flags=mysql_field_flags($tablefield,$i); $i++; echo " \n"; } echo '
数据库:".$dbname."\t表:". $tbname."\t有".$fileds."列".$rows."行
列数字段名称数据类型字段长度字段标志
".$i."".$name."".$type."".$len."".$flags."
'; } // 显示表的内容 if($cmd=='viewtb' and $db!='' and $tbname !=''){ $dbname=$db; mysql_select_db($dbname) or die("选择数据库失败"); $tablefield=mysql_list_fields($dbname,$tbname,$linkdb);//列出表的字段 $fileds=mysql_num_fields($tablefield); //返回表字段的数目 echo "
数据库:".$dbname."\t表:". $tbname."内容如下:
"; echo "";//#66CCFF $i=0; while($i<$fileds) { $name=mysql_field_name($tablefield,$i); $i++; echo "\n"; } echo ""; $vtb="select * from $tbname limit 0,10"; $result = @mysql_query($vtb); while($row=mysql_fetch_array($result,MYSQL_BOTH)){ echo "";//#99CCFF for($j=0;$j80) { $row[$j]=substr($row[$j],0,80)."...."; } echo ""; } echo ""; } echo ""; } //去掉转义字符 function stripslashes_array(&$array) { while(list($key,$var) = each($array)) { if ($key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || ''.intval($key) == "$key")) { if (is_string($var)) { $array[$key] = stripslashes($var); } if (is_array($var)) { $array[$key] = stripslashes_array($var); } } } return $array; } // 简单查询函数 function querystr($qstr){ global $dbname; @mysql_select_db($dbname) or die("选择数据库失败"); $result = @mysql_query($qstr); if($result){ $row=@mysql_fetch_array($result,MYSQL_BOTH); return $row[0]."\t"; } else{ return "未知"; } } // 备份数据库 from angel's phpspy function sqldumptable($table, $fp=0) { $tabledump = "DROP TABLE IF EXISTS $table;\n"; $tabledump .= "CREATE TABLE $table (\n"; $firstfield=1; $fields = mysql_query("SHOW FIELDS FROM $table"); while ($field = mysql_fetch_array($fields)) { if (!$firstfield) { $tabledump .= ",\n"; } else { $firstfield=0; } $tabledump .= " $field[Field] $field[Type]"; if (!empty($field["Default"])) { $tabledump .= " DEFAULT '$field[Default]'"; } if ($field['Null'] != "YES") { $tabledump .= " NOT NULL"; } if ($field['Extra'] != "") { $tabledump .= " $field[Extra]"; } } mysql_free_result($fields); $keys = mysql_query("SHOW KEYS FROM $table"); while ($key = mysql_fetch_array($keys)) { $kname=$key['Key_name']; if ($kname != "PRIMARY" and $key['Non_unique'] == 0) { $kname="UNIQUE|$kname"; } if(!is_array($index[$kname])) { $index[$kname] = array(); } $index[$kname][] = $key['Column_name']; } mysql_free_result($keys); while(list($kname, $columns) = @each($index)) { $tabledump .= ",\n"; $colnames=implode($columns,","); if ($kname == "PRIMARY") { $tabledump .= " PRIMARY KEY ($colnames)"; } else { if (substr($kname,0,6) == "UNIQUE") { $kname=substr($kname,7); } $tabledump .= " KEY $kname ($colnames)"; } } $tabledump .= "\n);\n\n"; if ($fp) { fwrite($fp,$tabledump); } else { echo $tabledump; } $rows = mysql_query("SELECT * FROM $table"); $numfields = mysql_num_fields($rows); while ($row = mysql_fetch_array($rows)) { $tabledump = "INSERT INTO $table VALUES("; $fieldcounter=-1; $firstfield=1; while (++$fieldcounter<$numfields) { if (!$firstfield) { $tabledump.=", "; } else { $firstfield=0; } if (!isset($row[$fieldcounter])) { $tabledump .= "NULL"; } else { $tabledump .= "'".mysql_escape_string($row[$fieldcounter])."'"; } } $tabledump .= ");\n"; if ($fp) { fwrite($fp,$tabledump); } else { echo $tabledump; } } mysql_free_result($rows); } // 登陆入口 function loginpage() { ?> Password:
".$name."
".$row[$j/2]."

Copyright (C) 2005 Lanker All Rights Reserved.