Current Path : /web/htdocs/www.entinoprofit.org/home/database/cofapi/
Upload File :
Current File : /web/htdocs/www.entinoprofit.org/home/database/cofapi/restore.php

<?php



require_once("dblib.inc");



require_once("clublib.inc");



checkAdmin();



Step 2 (restore): Browse for backup file
#HTML CODE
<form name="form" method="post" action="proc_restore.php" enctype="multipart/form-data">
  <!-- really big max_size to accomodate potential large backup files -->
  <input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
  <input type="file" name="restorefile" />
  <input type="submit" name="submit" value="Submit" />
</form>

Step 3 (restore): U/L & recreate the DB
#PHP CODE
$uploadFile = $_FILES['restorefile']['name'];
$move = move_uploaded_file($_FILES['restorefile']['tmp_name'], $uploadFile);
# GZOPEN & GZGETS work on gzip'ed files like FOPEN & FGETS work w/ text files
$zp = gzopen($uploadFile, 'r');
while (!gzeof($zp))
{
  $line = gzgets ($zp, 4096);
  # db_query() is a user defined function that executes SQL commands
  $rtl = db_query($line);
}
gzclose($zp);
unlink($uploadFile);
	
?>