".$lang["UPLOAD_SQL"]."

".$lang["tables"].">".$lang["Upload"]."
- - -
"; if (!$vmi) { echo "- ".$lang["Max"].": $mb MB
- ".$lang["only_sql_files"]; echo '

'; echo '
'; echo '
'.$lang["Separator"].':

'; echo '
'; include('foot.php'); } if($vmi=="add"){ $upload_dir='data/'; $filename = $_FILES['filetoupload']['name']; $size = $_FILES['filetoupload']['size']; $extlimit = "yes"; //yes/no $ext = strrchr($_FILES['filetoupload']['name'],'.'); if (!is_uploaded_file($_FILES['filetoupload']['tmp_name'])) { echo $lang["ERROR_NO_FILE_SELECTED"]."!
"; echo ""; include("foot.php"); exit(); } //IF EXT IS ALLOWED if (($extlimit == "yes") && ($ext !=".sql")) { echo($lang["EXT_NOT_ALLOWED"]."
"); echo ""; include('foot.php'); exit(); } // check file size if ($size > $size_bytes) { $kb = $size_bytes / 1024; echo $lang["FILE_IS_TO_BIG_Maxim"]." $kb KB.
"; echo ""; include("foot.php"); exit(); } //IF FILE EXIST if (file_exists("$upload_dir/$filename")) { echo($lang["File_name_already_exists"]); echo ""; include("foot.php"); exit(); } if (move_uploaded_file($_FILES['filetoupload']['tmp_name'],$upload_dir.$filename)) { // IF FILE IS UPLOAD $handle = fopen("data/$filename", "r"); $contents = fread($handle, filesize("data/$filename")); fclose($handle); echo "- $filename uploaded !
"; $sep=trim($_POST['sep']); $shw=$_POST['shw']; $sql=str_replace("\r\n","\n",$contents); $sql=str_replace("\n","\r",$sql); $sql=preg_replace("~(--|##)[^\r]*\r~","\r",$sql); $sql=preg_replace("~\r\s*\r~","\r",$sql); $contents=explode($sep,$sql); $q=0; foreach($contents as $coo) { if(!empty($coo)) { $do=mysqli_query($conn,$coo); $cop=htmlspecialchars(substr($coo, 0, 40)); if ($do) { $q++; if($shw=="yes") { echo ">$cop... ".$lang["executed"]." !
"; } } else { if($shw=="yes") { echo ">$cop... ".$lang["not_executed"]." ! ".$lang["Error"].": "; echo mysqli_error($conn)."
"; } } } } echo "
$q ".strtolower($lang["Query"]." ".$lang["executed"])." !"; if ($_POST['del'] == "yes") { unlink("data/$filename"); echo "
- ".$lang["deleted"]." !"; } else { echo "
- ".$lang["saved"]." !"; } echo ""; include("foot.php"); exit(); } else { //IF IS ERROR echo $lang["ERROR_Try_again"]."
"; echo ""; include("foot.php"); exit(); } } ?>