Solved

Detect windows user in php

Posted on 2007-11-19
9
2,186 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
  • 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
change password links 7 72
Blog posts not showing up on Blog page 7 50
<? versus <?php 5 35
WP_Query multiple custom taxonomies 5 23
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

948 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now