On a new site I'm making, sessions are not working. They were working previously, and stopped without a single change of the code.
Once a login goes through the verification, it runs:

$_SESSION['uid'] = getIdFromEmail($email);

getIdFromEmail is a function I built to get the user's ID from their email address.
But the session does not register, as when I do

print $_SESSION['uid'];

I get "Notice: Undefined index: uid". I did check by printing "success" to make sure the login was OK. Of course, I have a session_start at the top of the page.
- Aaron.

Recommended Answers

All 2 Replies

r u used

session start();

and register the session.using

session_register('name');

.if not then use these.

Do not use session_register, it is deprecated.

What do you get if you use

var_dump($_SESSION);

?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.