/* This PHP script is designed to clear an IC Card DB. --prr6 04.20.2007. University of Pittsburgh*/ header('Content-Type: text/html; charset=utf-8'); echo ''."\n"; ?>
IC Card Management System - Clear IC Card Database Tool
$theDatabases = array(0 => 'icdb.xml', 1 => 'icInteractionDb.xml'); $bkExt = '.bak'; if(isSet($_POST['confirmclear'])) { echo '';
if(is_writable('.'))
{
foreach($theDatabases as $dbFile)
{
if(file_exists($dbFile))
{
if(copy($dbFile,$dbFile.$bkExt))
{
if(@unlink($dbFile))
{
echo 'Database File '.$dbFile
.' backed up and deleted.
';
}
else
{
echo 'Database File '.$dbFile
.' backed up but deletion'
.' failed.
';
}
}
else
{
echo 'Database File '.$dbFile
.', failed to be backed up'
.' cancelling clearing of file.
';
}
}
else
{
echo 'Database File '.$dbFile
.' not found, nothing to clear.
';
}
}
}
else
{
echo 'The database directory is not writable.';
}
echo 'Done.