Solved

Detect windows user in php

Posted on 2007-11-19
9
2,192 Views
Last Modified: 2013-12-24
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
Comment
Question by:ChoobsTech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 2

Author Comment

by:ChoobsTech
ID: 20313789
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20313971
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
 
LVL 19

Expert Comment

by:v2Media
ID: 20316392
is php installed on the intranet server as an isapi module or cgi binary?
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 2

Author Comment

by:ChoobsTech
ID: 20317256
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
 
LVL 19

Assisted Solution

by:v2Media
v2Media earned 150 total points
ID: 20317539
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
 
LVL 21

Accepted Solution

by:
nizsmo earned 350 total points
ID: 20318912
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
 
LVL 2

Author Comment

by:ChoobsTech
ID: 20347015
Question has not been forgotten... I'll do the test in the next 2-3 days and assign points if it works...
0
 
LVL 2

Author Comment

by:ChoobsTech
ID: 20388800
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20388810
Thanks ChoobsTech :)
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
What You Need to Know when Searching for a Webhost Provider
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question