You should be able to do exactly what you want, I do this myself. I am wondering if you are hitting a bug that is present in PHP in versions prior to 4.0.6, where $someflag and$HTTP_SESSION_VARS["someflag"] do not reference the same value. Try changing two lines in your code to read as below, instead of using the $HTTP_SESSION_VARS array: $someflag = "somevalue"; $failedattempts++; Kirk > -----Original Message----- > From: Johnny Nguyen [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 13, 2001 12:36 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Session Variables and Redirecting > > > I've done this on other platforms ASP,Cold Fusion, but I need > to know what's > the best way to do it on PHP. > > 1. grab username and password from POST vars. > 2. select count(*) from users where username = '$username' and > password='$password'... something along these lines > 3. if that user exists and password matches, set a flag on > the user and send > them to the right page, otherwise increment failed attempts > and send them > back to login page. > > if (count > 0) > > session_register("someflag"); > $HTTP_SESSION_VARS["someflag"] = somevalue; > header("Location: secretpage.php"); > } > else > > session_register("failedattempts"); > $HTTP_SESSION_VARS["failedattempts"]++; > header("Location: loginpage.php"); > } > > but apparently, i can't start/register a session and then > redirect. Is > there a better way to do this? > > Regards, > Johnny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]