Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Can't Get Session to Work!
01-05-2007, 03:57 AM #1
- Join Date
- Dec 2006
- Thanked 0 Times in 0 Posts
Can't Get Session to Work!
hello everyone today is the first time i've tried using sessions and i'm having some trouble getting it to work for me. i've setup my login script to start and register a session if the login was successful.
After registering the session i print it out to make sure it's working. this is what my code looks like.
$sesUser = $uName;
echo "session registered";
$_SESSION['sesUser'] successfully prints it's variable and ..."is_registered" shows the number one (which i'm assuming is "true") but $PHPSESSID yields nothing and when i try to print my session (sesUser) from another page I get nothing... why?!?!
01-05-2007, 04:09 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
session_register is deprecated. Do not use it anymore. Only stick with $_SESSION if you have it available. Watch the default configurations of sessions as well - they may not be what you want (requiring cookies and all).Before PHP 4.3, if you are using $_SESSION and you have disabled register_globals, don't use session_register(), session_is_registered() or session_unregister(). Disabling register_globals is recommended for both security and performance reasons.
Next, I assume you are looking for SID instead, thats an appendable session id. Doesn't matter anyway, it won't register without having required cookies set to off. PHPSESSID if I'm not mistaken is only the value of your cookie session IF you have not chosen to rename it. In that case, its located in the $_COOKIE (or $_REQUEST) superglobal, and cannot be accessed by its name unless your register_globals are enabled - which you shouldn't be using even if they are.
Hope that helps ya.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');