Jump to content

Remembering someone's details... sessions?


dmccabe

Recommended Posts

I have finally got my ldap authentication script working as it needs to.

 

Now when someone logs in, I can grab their full name and what department they are part of from AD server, but how can I store them so  they dont have to log in on every page.

 

basically I have put my authentication script in header.php  then once they have logged in if they go to another page which calles header.php then they have to log in again.

 

How can I make it remember them for the full time they are on the site and also so I can grab their dept no matter what page I am on.

Link to comment
Share on other sites

<?php
session_start();

$_SESSION['fullname'] = $row['fullname']; // $row['fullname'] being the info from the db you check against.
$_SESSION['dept'] = $row['dept']; // same for $row['dept']
?>

 

That will store the info in a session from page to page... then you can access the session:

 

<?php
session_start();

echo $_SESSION['fullname'];
echo $_SESSION['dept'];
?>

 

Or do auth checks or whatever

 

Check out - http://us2.php.net/manual/en/function.session-start.php for more info....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.