Jump to content

Recommended Posts

i have a system where people can submit adverts and when they do so they also enter a password, so if their item is sold they can view their advert and enter their password into a form on it and if they match up delete the record. At the moment i am seeing the url in address bar but the page comes up blank when you submit the password.

 

Advert view with delete form:

<?php
$password = $info ['password'];
							$ref = $info ['ref'];
							echo "<h2>Is this your item, and has it been sold?</h2>";
							echo "<p>Simply type the password you entered when submitting the item and it will be removed from our website instantly.</p>";
							echo "<form method=\"POST\" action=\"delete_item.php?ref=".$info['ref']."\">
							Password: <input type=\"text\" name=\"password_entered\" size=10>
							<input name=\"hidden_password\" type=\"hidden\" value=\"$password\" />
							<input name=\"id_delete\" type=\"hidden\" value=\"$ref\" />
							<input type=\"submit\" value=\"Sold\">
							</form>";
?>

 

delete item:

<?php
$con = mysql_connect("serv","usr","pass");
		if (!$con)
			{
			  die('Could not connect: ' . mysql_error());
			 }

			mysql_select_db("db", $con);

$id=$_GET['id_delete'];
$password_entered = $_GET['password_entered'];
$hidden_password = $_GET['hidden_password'];

if ($password_entered == $hidden_password)
{

mysql_query("delete from classifieds where ref='$id'");

mysql_close(); 

header("location:thankyou.html"); 
}
else
{
echo "You entered the wrong password";
}
?>

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.