PHP Store User Data without Sessions

Posted by Sev on Stack Overflow See other posts from Stack Overflow or by Sev
Published on 2010-05-26T22:56:21Z Indexed on 2010/05/26 23:01 UTC
Read the original article Hit count: 196

Filed under:
|

Is there anyway to store users data such as userid, email, etc to be accessible from all pages of a website after they have logged in, but without using sessions or cookies?

For example:

class User
{
  var $userid;
  var $username;
  var $email;

  .. methods..
}

after they login at login.php

$currentUser = new User($_POST['username'])

now, how do I access $currentUser from another page, such as index.php if I shouldn't use sessions or cookies at all?

so that I could do the following in index.php:

if ($currentUser->userid > -1)
{
  echo "you are logged in as: " . $currentUser->username;
}
else
{
  echo "click here to login";
}

i asked a similar question before, here, but the answers didn't fulfill my needs.

© Stack Overflow or respective owner

Related posts about php

Related posts about object-oriented-design