
<?php
//    Post a file, or files, to the server: 3 varianges
//postSessionFilesHeader='todo=4';  -- CREATE A NEW SESSION
//postFileHeader='todo=7';
//postInstrumentFileHeader='todo=76';
// saveSelectionFile='todo=802&';

require("phpVars.php");

 header('Content-Type: text/plain; charset=iso-8859-1');

  $sessName='';
  $table='';
  foreach ($_REQUEST as $vname=>$oof) {
     $avar=trim(strtoupper($vname)) ;
     if ($avar=='SESSION') $sessName=trim($oof);
     if ($avar=='TABLE' ) $table=trim($oof) ;
  }

if ($sessName=='') {
  print "- Error. No SESSION= in call to $myScriptName " ;
  exit ;
}
if ($table=='') {
  print "- Error. No TABLE= in call to $myScriptName " ;
  exit ;
}

$link=connectDsurveyDatabase($sessName);
$mdata=$currentDatabase ;

$backupFile=$sessions_dir.'backup/savetest1.sql';

$aexists=file_exists($backupFile); 
if ($aexists) {
  $astat=unlink($backupFile);
  if (!$astat) {
     print "Sorry. Unable to delete existing backup file: $backupFile ";
     exit ;
  }
}

$foo=saveMysqlTable($table,$backupFile,$link) ;
print "\n result of save = ". $foo ;


exit;


?>


