E-mail Confirmation Script problems

From: Date: Sat, 24 Aug 2002 21:21:45 +0000
Subject: E-mail Confirmation Script problems
Groups: php.general 
Request: Send a blank email to php-general+get-113976@lists.php.net to get a copy of this message
I require a e-mail confirmation for registration. Everything works fine - to point. The last lines of the email have the 'Confirmation Number': https://localhost/confirm.php?unique_id=3BxXp9YLwsCMDuz // localhost is just for testing */ Now, when clicked, it checks the number, $_SESSION['sunique_id'], against the PostgreSQL db, and if OK, loads the appropriate page. No problems. However, I would like to nix the number against further attempts. If I try a conditional flag (on confirm.php): $query = "SELECT * FROM sponsor WHERE sunique_id = '$sunique_id'"; $result = pg_exec($db, $query); $numrows = pg_numrows($result); if ($numrows == 0) { echo "<h5>Registration unsuccessful!"; pg_close($db); } if ($numrows == 1) { $row = 0; $myrow = pg_fetch_array($result,$row); $_SESSION['sid'] = $myrow['sid']; . . . . $_SESSION['sunique_id'] = $myrow['sunique_id']; session_write_close(); switch ($_SESSION['sstatus']): case "Guest": . . . $query = "UPDATE sponsor SET sunique_id = 'confirmed' WHERE sid = '{$_SESSION['sunique_id']}'"; . . . header("location:guest.php"); break; endswitch; } Unfortunately, all this does is set 'sunique_id' to 'confirmed' before it has loaded the correct page (guest.php), and defeats what I like it to do. I've tried reversing the order (putting the UPDATE after the header, and also putting it on the 'guest.php' page instead, with the same result. It seems that the whole page loads with the NEW condition . . . sigh. Any ideas where or how I should flag the new condition (i.e., once the page has loaded once, it should be set to 'confirmed' (not before!)? Tia, Andre

« previous php.general (#113976) next »