flappy_warbucks Posted October 16, 2007 Share Posted October 16, 2007 OK i have a script (displayed below) but when the script executes, it does whats its supposed to do but not forward into a page thats its supposed to (i.e. the script is there to delete a file, and update the database, so it does that no problems) but when it has finnished executng it then shows a 404? my code is as follows: <?php require "validation.php"; //cookie and session security and validation $file = $_GET['file']; $full_path = "documents/". $file; if (isset($file)) { $removal_class_handler = new delete_file(); $file_removed = $removal_class_handler->remove_file($full_path,$file); // removal class shown below if ($file_removed == false) { die("Something Went Very Wrong"); // if returned false, this happens } else if ($file_removed == true) { header ("Location: main.php?pge=ud"); //this is where i want it to go when it has finnished } } else { die("No file selected"); } class delete_file { function remove_file($full_path,$file) { if (file_exists($full_path)) { if (!unlink($full_path)) { return false; } else { if ($this->db_removal($file) == false) { return false; } else { return true; } } } else { return false; } } function db_removal($file) { require "database.php"; $db_handler = new database_handler(); $query = "select items from users where u_n = \"". $_COOKIE['user_no']. "\";"; $info = $db_handler->run_query($query); extract($info); $files = explode("*_*", $info[0]); foreach($files as $k=>$v) { if ($v != $file) { $elements[] = $v; } else if ($v == $file) { $rem_file = $v; } } $elements = implode("*_*",$elements); $query = "update users set items = \"". $elements. "\" where u_n=\"". $_COOKIE['user_no']. "\";"; if ($db_handler->run_query($query) == false) { die("Failed"); } else { return true; } } }; ?> Quote Link to comment Share on other sites More sharing options...
freakstyle Posted October 16, 2007 Share Posted October 16, 2007 what is the url in your browser say when you get the 404? is it on main.php ? is main.php and validation.php in the same dir as where this script / class is? questions make the world go round Quote Link to comment Share on other sites More sharing options...
flappy_warbucks Posted October 18, 2007 Author Share Posted October 18, 2007 what is the url in your browser say when you get the 404? is it on main.php ? is main.php and validation.php in the same dir as where this script / class is? questions make the world go round the url is delete.php which is the name of the file that you see above. Quote Link to comment Share on other sites More sharing options...
flappy_warbucks Posted October 18, 2007 Author Share Posted October 18, 2007 Oh yea and main.php and delete.php are in the same directory. The strange thing is the script executes without any problems, it deletes the file and updates the database but then when it has finnished, i get a 404, weird huh? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.