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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.