Re: E-mail Confirmation Script problems

From: Date: Sat, 24 Aug 2002 22:58:04 +0000
Subject: Re: E-mail Confirmation Script problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113986@lists.php.net to get a copy of this message
You might be able to pass the variable in the header, header("location:guest.php?unique_id=3BxXp9YLwsCMDuz&confirm=true "); Then at the top of guest.php put in a section to set the confirmation code in your database to "logged in" and thus prevent others from using the same user name and password while the session lasts. Might work. Hugh ----- Original Message ----- From: "Andre Dubuc" <aajdubuc@webhart.net> To: <php-general@lists.php.net> Sent: Saturday, August 24, 2002 2:21 PM Subject: [PHP] E-mail Confirmation Script problems > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#113986) next »