<?
  include "../../mainfile.php";
?>
<?
  ini_set("max_execution_time",0);
  extract($_POST);
?>
<?
  $target_path = "bkpfile/";
  $target_path = $target_path . "dump.sql";

  if(move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
    echo "<br><br><br><br><center><table border=1><tr><td  bgcolor='#D2E8D8'><strong>The file ".  basename( $_FILES['uploadedfile']['name']). 
         " has been uploaded</strong></td></tr></table></center>";
  }else{
    echo "<br><br><br><br><center><table border=1><tr><td  bgcolor='#D2E8D8'><font color=red><strong>There was an error uploading the file, please try again!</strong></font></td></tr></table></center><br><br><a href='rssystem.php?pg=bkp'>Back</a>";
    break;
  }
//---------------------------------------------------------------------------------
?>
<?
$url="bkpfile/dump.sql";
$i = 0;
$file = fopen($url, "r");
while(!feof($file)) {
//  $data = str_replace("_aps_","",fgets($file, 4096));
  $data = fgets($file, 4096);
  
//		   echo $data . "<br>";
  $i++;

//echo $data . "<br>";
  mysql_query($data);
}
fclose ($file);

//----------------------------------------------------------------------------
/*
  $filetype = "sql";
  $fileName = "mt";
  
$cdb_user_name = $dbuser;
$cdb_user_password = $dbpass;
//$cdb_database_name = "testingxoops";
$cdb_database_name = $dbname;
mysql_connect($dbhost,$cdb_user_name,$cdb_user_password);
@mysql_select_db($cdb_database_name);

$iiii = 0;
//$url = $path.$fileName.$tday.".$filetype";
$url="dbbackup/dump.sql";
//$url="C:\\Documents and Settings\\User\\Desktop\\mt061124.sql";
//echo $url . "<br>";

       $file = fopen($url, "r");
       while(!feof($file)) {
           $data = fgets($file, 4096);
//		   echo $data . "<br>";
           $iiii++;

//echo $data;
           mysql_query($data);
       }
       fclose ($file);

?>
<script>
alert("Backup Data Restore success.");
</script>
<?
//redirect_header("main.php?pg=sy&ac=bk",0, "");
*/
?>