<?php
!function_exists('readover') && exit('Forbidden');
function SQLDrop($sqlarray) {
	global $db;
	foreach ($sqlarray as $query) {
		$lowquery = strtolower(substr($query,0,6));
		$next = CheckDrop($query);
		if ($next && $lowquery == 'create') {
			$t_name = trim(substr($query,0,strpos($query,'(')));
			$t_name = substr($t_name,strrpos($t_name,' ')+1);
			$db->query("DROP TABLE IF EXISTS $t_name");
		}
	}
}
function FileArray($hackdir){
	if (function_exists('file_get_contents')) {
		$filedata = @file_get_contents(Pcv(R_P."hack/$hackdir/sql.txt"));
	} else {
		$filedata = readover(R_P."hack/$hackdir/sql.txt");
	}
	$filedata = trim(str_replace(array("\t","\r","\n\n",';'),array('','','',";\n"),$filedata));
	$sqlarray = $filedata ? explode("\n",$filedata) : array();
	return $sqlarray;
}
function CheckDrop($query){
	global $db;
	require_once(R_P.'admin/table.php');
	list($pwdb) = N_getTabledb();
	$next = true;
	foreach ($pwdb as $value) {
		if (strpos(strtolower($query),strtolower($value))!==false) {
			$next = false;
			break;
		}
	}
	return $next;
}
?>