Jump to content

Active Directory and sessions/cookies


Eiolon

Recommended Posts

Hello,

I am working on an intranet site and instead of making a membership system and having all employees remember two usernames/passwords, I am making IIS use the active directory database to protect files and directories that are restricted.  So here is my question:

Is there a way to treat active directory usernames as you would with sessions or cookies?  I would like to restrict pages to certain people but I still want to see who makes changes.

Thanks for your help!
Link to comment
Share on other sites

Can this be then used within the header of index.php and passed to a database to find out what areas they can use (as long as their username is added exactly the same) and create a session for the duration and restrict thier usage throughout?  In one automated process?
Link to comment
Share on other sites

How would I go about calling
[code]$domain_user = $_SERVER['LOGON_USER'];[/code]

Then taking of the prepend of the SERVER\ string to be left with just the user name, to query the Database for that user.

Or would it be easier but slower to retrive a list of the users from the database and compare it to the returned $domain_user to see if they exist in the database?
Link to comment
Share on other sites

If the domain name is always the same then you could substr() it

or explode it with / being the dilmeter and using the second index...

[code]
<?php
// domain user sample: MyDomainName/SharkBait
$domain_user = substr($_SERVER['LOGON_USER'], 0, 13);

// Or split it up
$domain_user = explode("/", $_SERVER['LOGON_USER']);
$domain_user = $domain_user [1];
?>
[/code]



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.