<?php

/******************************************************
 * CjOverkill version 3.0.1
 * © Kaloyan Olegov Georgiev
 * http://www.icefire.org/
 * spam@icefire.org
 * 
 * Please read the lisence before you start editing this script.
 * 
********************************************************/

include ("../cj-conf.inc.php");
include ("../cj-functions.inc.php");   
cjoverkill_connect();
 
include ("security.inc.php");

if ($_POST["repair"]!="") {
    $tables = array ("cjoverkill_blacklist",
		     "cjoverkill_cheatreports",
		     "cjoverkill_daily",
		     "cjoverkill_filter_base",
		     "cjoverkill_filter_client",
		     "cjoverkill_filter_country",
		     "cjoverkill_filter_ip",
		     "cjoverkill_filter_method",
		     "cjoverkill_filter_ipwhite",
		     "cjoverkill_forces",
		     "cjoverkill_iplog_in",
		     "cjoverkill_iplog_out",
		     "cjoverkill_country_log_in",
		     "cjoverkill_country_log_out",
		     "cjoverkill_links",
		     "cjoverkill_ref",
		     "cjoverkill_reset",
		     "cjoverkill_security",
		     "cjoverkill_settings",
		     "cjoverkill_stats",
		     "cjoverkill_trades",
		     "cjoverkill_warnings"
		     );
    $result = "";
    for ($i=0; $i<count($tables); $i++) {
	$table=$tables[$i];
	$sql1=@mysql_query("REPAIR TABLE $table") OR
	  cjoverkill_print_error(mysql_error());
	$tmp1=@mysql_fetch_array($sql1);
	extract ($tmp1);
	$result = $result . "$Table $Op $Msg_type $Msg_text <BR>\n";
    }
    $tms="CjOverkill database has been repaired";
}
else {
    $tms="Repair CjOverkill database?";
}

cjoverkill_disconnect();

echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
	<html>
	<head>
	<title>$tms</title>
	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
	<link href=\"../cj-style.css\" rel=\"stylesheet\" type=\"text/css\">
	</head>
	<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\">
	<form action=\"repair.php\" method=\"POST\">
	<div align=\"center\"><b><font size=\"4\">$tms<br>
	<input name=\"repair\" type=\"submit\" value=\"Repair database\" class=\"buttons\"><br>
	</font>
	");
if ($_POST["repair"]!="") {
    echo ("<br>
	    $result
	    ");
}
echo ("<br><br><font size=\"2\"><a href=\"javascript:window.close()\">Close Window</a></font>
	</div>
	</form>
	</body>
	</html>
	");
    

?>
