Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2202
  • Last Modified:

Detect windows user in php

Dear experts,

I am designing an intranet application, and I would like to use the windows authentification on my intranet.

What are my options? Can I detect either the windows user or the current active directory user with php?

Thnx in advance :D
0
ChoobsTech
Asked:
ChoobsTech
  • 4
  • 3
  • 2
2 Solutions
 
ChoobsTechAuthor Commented:
Please provide an explicit answer, as I have to admit I didn't fully understand following link:
http://de3.php.net/manual/en/features.http-auth.php
0
 
nizsmoDeveloperCommented:
so basically you are wanting the user to enter a password and a username upon reaching for example your local domain address http://10.1.2.3?
0
 
v2MediaCommented:
is php installed on the intranet server as an isapi module or cgi binary?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ChoobsTechAuthor Commented:
To nizsmo:
Ideally I would like to grant access, onsite or remotly without asking users to enter credentials again, based on the username detection I would do...

To v2Media:
I don't know, I will check with my admin and get back to you.
0
 
v2MediaCommented:
As a quick solution, if using IIS you can eliminate anonymous access to the website and use integrated windows authentication. This is simply done by opening IIS Admin, right clicking the default web site for properties and selecting the directory security tab.

Under directory security there's anonymous access, disable it. Check the option for "Integrated Windows Authentication".

0
 
nizsmoDeveloperCommented:
I'm not too sure if this is what you are looking for, but it is a very simple PHP authentication script, and you have to specify the username and password at the top.

You can easily configure it for multiple users and passwords by using a password and username array.

As i said, not sure if this is what you are looking for but hope it helps.
<?php
// specify password & username
$username = "test";
$password = "testing";
 
if (!isset($_SERVER['PHP_AUTH_USER'])) 
{
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    exit;
}
 
if($_SERVER['PHP_AUTH_USER'] != $username || $_SERVER['PHP_AUTH_PW'] != $password)
{
	header('WWW-Authenticate: Basic realm="My Realm"');
	header('HTTP/1.0 401 Unauthorized');
	exit;
}
 
// Your PHP CONTENTS HERE IF THEY ENTER CORRECT PASSWORD & USERNAME!
echo "Success!!";
?> 

Open in new window

0
 
ChoobsTechAuthor Commented:
Question has not been forgotten... I'll do the test in the next 2-3 days and assign points if it works...
0
 
ChoobsTechAuthor Commented:
Ok could not really test it as I opted for another solution. Still people that helped deserve points.

nizsmo   350 points (as answers were more precise)
v2Media 150 points
0
 
nizsmoDeveloperCommented:
Thanks ChoobsTech :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now