Hi. I am developing a site with two databases - one is for customers to apply to join as members, the other is a members database. Everything seemed to be working well, until I tried "bug hunting".
When a new member signs up, they are deleted from the first db and added to the second. If that member then uses the back button, hits F5, or calls the php page directly, problems start occurring.
I am convinced that the problem lies here :
this code checks weather the person has applied or not. If they are found (exists=1) they are added to the new db and deleted from this one.
This is working perfectly in regular use. however, even after they have been deleted, recalling the page makes $_SESSION[exists] = "1" even when they dont, resulting in duplicate entries to the members database.
I have checked the applydb and it is empty.
adding this:
to both the top and the bottom of the script, returns 0 then 1, saying it found the non-existent member :/
Again, just to iterate, this works perfectly with normal use. It is only when recalled that the error occurs.
This is what I used to delete the member:
I can include more script if wanted, but cannot see that it is relevant; the database is empty.
Is this perhaps just a peculiarity?
Hope this makes sense, and that you can help.
When a new member signs up, they are deleted from the first db and added to the second. If that member then uses the back button, hits F5, or calls the php page directly, problems start occurring.
I am convinced that the problem lies here :
Code:
...
$_SESSION[exists] = "0";
mysql_select_db("applydb", $con);
$result = mysql_query("SELECT email FROM apply
WHERE email = '$_SESSION[email]' LIMIT 1");
while($row = mysql_fetch_array($result))
{
$_SESSION[exists] = "1";
}
mysql_close($con);
...
This is working perfectly in regular use. however, even after they have been deleted, recalling the page makes $_SESSION[exists] = "1" even when they dont, resulting in duplicate entries to the members database.
I have checked the applydb and it is empty.
adding this:
Code:
echo "registered exists is ".$_SESSION[exists];
Again, just to iterate, this works perfectly with normal use. It is only when recalled that the error occurs.
This is what I used to delete the member:
Code:
<?php
require("connectdb.php");
mysql_select_db("applydb", $con);
mysql_query("DELETE FROM apply WHERE email = '$_SESSION[email]' LIMIT 1");
if (!$con)
{ die('Error: ' . mysql_error());}
mysql_close($con);
?>
I can include more script if wanted, but cannot see that it is relevant; the database is empty.
Is this perhaps just a peculiarity?
Hope this makes sense, and that you can help.