Jump to content

404 Not found?


flappy_warbucks

Recommended Posts

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;
	}
}

};
?>

Link to comment
https://forums.phpfreaks.com/topic/73479-404-not-found/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/73479-404-not-found/#findComment-372211
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.