Re: session vs. header

From: Date: Wed, 06 Nov 2002 14:01:33 +0000
Subject: Re: session vs. header
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123003@lists.php.net to get a copy of this message
I think I have to re-explain the problem completely. I want to use this script in a login form. Once, someone is authenticated, then I register variables for indentifying him/her through session. After I register those variables I want to redirect him/her to a page, which required authenticated users (and it's done by registering variables through session). Due to this, I decide to use header: location. Futhermore, I use IE 5.5, Apache 1.3.26, PHP 4.2.1 [, MySQL 3.23.51] which running on Windows ME. Here is the script (register globals is off, due to security and default setting in php.ini). <?php $user = $_POST['user']; $user = $_POST['password']; if (authenticate($user)) { session_start(); $_SESSION['user'] = $user; $_SESSION['password'] = $password; header('Location: http://www.mysite.com/member.php'); exit(); } else { header('Location: http://www.mysite.com/login.php'); exit(); } ?> When I try this code with an authenticated user, it seemed browser don't redirect to the page I specify above. The progress bar looked like searching something then it led to an error. I don't know why this could happen. Am I missing something? Thank you. huge junk mail <huge_junk_mail@yahoo.com> wrote:Can someone tell me why I can't have $_SESSION['foo'] = 'content of foo'; following by header('Location: http://www.mysite.com'); Someone from www.php.net told me that it can confuse browser (http://bugs.php.net/19991). But, still I can't the idea why it can happen. Does register session means sending a 'header: location' too? Thanks. ===== Regards, mahara __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Regards, mahara --------------------------------- Do you Yahoo!? HotJobs - Search new jobs daily now

« previous php.general (#123003) next »