Re: setting session variables via a form

From: Date: Mon, 30 Jun 2003 16:20:30 +0000
Subject: Re: setting session variables via a form
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28976@lists.php.net to get a copy of this message
Not to beat a dead horse, but I have a problem associated with differences between 4.3 and 4.0.6. My local server (Mac OSX) is running 4.3 and has globals off. I designed the code to run with $_SESSION for my log in pages, and they work fine. Then I had to move the files to a client's server and discovered that he was running 4.0.6 and globals on. Now I have to revise my login scripts to accomodate. Is there a function like $_SESSION['user_name'] vs. $session_register('user_name') that would work on both? I tried $HTTP_SESSION_VARS["user_name"] but that didn't keep the user_name going into the next page, which causes the login to fail and send back to the login page. Snippets as they are now (for 4.0.6): // this is the log in page <? session_start(); if ($user_name && $login_pass) { // if the user has just tried to log in from <FORM> session_register("user_name"); } if (session_is_registered("user_name")) { header("Location: content.php"); exit(); } .. rest of file ?> // content.php <? session_start(); if (!session_is_registered("user_name")) { header("Location: index.php"); exit(); } die("check:".$user_name); <-- may actually accept the registry of user_name but still does not display it .. rest of file ?> On Monday, June 16, 2003, at 11:11 AM, Ford, Mike [LSS] wrote:
-----Original Message----- From: Hutchins, Richard [mailto:Richard.Hutchins@Getingeusa.com] Sent: 16 June 2003 17:08 session_start(); session_register("isRegistering"); $_SESSION["isRegistering"] = "true";
B'zzzzt! If you're using the $_SESSION array, then you MUST NOT use session_register() and friends. (Well, ok, maybe that's overstating it a bit, but you still shouldn't do it!) Cheers! Mike


« previous php.db (#28976) next »