Jump to content

unlink() problems


meltingpoint

Recommended Posts

Below is my exact code.  I can get the unlink() to work in other scripts- but not this one.

Anyone see anything that would make unlink() not work?

 

$file1, $file2 etc...are defined in the config file as exampled above.

//
switch($database)
{
case "maindb": $filetorestore = 'databases/BACKUPmaindatadb.txt' and $restored = $file2;
						break;
case "homedb": $filetorestore = 'databases/BACKUPdchomedb.txt' and $restored = $file3;
						break;
case "petsdb": $filetorestore = 'databases/BACKUPlostanimals.txt' and $restored = $file8;
						break;
case "vehiclesdb": $filetorestore = 'databases/BACKUPvehicleslist.txt' and $restored = $file11;
						break;
case "bikesdb": $filetorestore = 'databases/BACKUPbikelist.txt' and $restored = $file7;
						break;
case "licensesdb": $filetorestore = 'databases/BACKUPbikelicenses.txt' and $restored = $file12;
						break;
case "parkingdb": $filetorestore = 'databases/BACKUPparkingpermission.txt' and $restored = $file9;
						break;
case "dispatchnotesdb": $filetorestore = 'databases/BACKUPdispatchnotes.txt' and $restored = $file6;
						break;
case "usersdb": $filetorestore = 'databases/BACKUPuserpermissions.txt' and $restored = $file10;
						break;
case "categoriesdb": $filetorestore = 'databases/BACKUPcategories.txt' and $restored = $file5;
						break;
case "spcattndb": $filetorestore = 'databases/BACKUPspcattndatabase.txt' and $restored = $file13;
						break;
default: $filetorestore = $file100;
						break;
}
//
if(empty($filetorestore)){
$message = "<center>ERROR!- no database was selected/detected to be Backed-UP.  Please try again.  If problem persists- notify the Web/IT Administrator.</center>";
include("dcloginmessagepage.php");
exit;
}
//
sleep(1);//---------------supposed fix for IIS Servers that copy() does not work well with------------
//
if(!copy($filetorestore, $restored))
{
$message = "<center>The RESTORATION of the Database was UNSUCCESSFUL!- Please notify the Administrator.</center>";
include("dcloginmessagepage.php");
exit;
}
else
{
$message = "<center>RESTORATION of the Database was sucessfull.</center>";
include("dcloginmessagepage.php");
exit;
}
//
unlink($filetostore);
//
//
//-----------------------------------------------------------------------------------------------------------------------------

Link to comment
https://forums.phpfreaks.com/topic/250245-unlink-problems/#findComment-1284064
Share on other sites

hahahaha----------what a goof moment. My unlink() was outside the script for if it was successful it went to the message page and therefore was never being called.  How funny.

 

Well-------------that's how it goes sometimes.

 

Cheers all.........lol.........lol

Link to comment
https://forums.phpfreaks.com/topic/250245-unlink-problems/#findComment-1284067
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.