July 13th, 2004, 01:51 AM
PHP authentication against a NT4.0 Server
I am starting work at my old highschool and one of my main projects at the moment is developing the school's intranet.
The school has 550 students and i want to use authentication against the NT server, as MySQL wouldnt be as practical to use as straight out authentication against the database.
I was wondering if anyone has code or has a resourse to point me to, for this.
If you guys need more information, just post it.
July 15th, 2004, 04:55 PM
There are scripts on how to use authentication with PHP, here is a simple example:
Then make a database table PHP_AUTH_USER.
//sample login **** using sessions
$mysql_host = "localhost";
$mysql_user = "user";
$mysql_pass = "passwd";
$mysql_db = "auth";
$mysql_table = "user";
//connect to the database....
$connection =mysql_connect ("$mysql_host","$mysql_user","$mysql_pass")
or die ("I cannot connect to the database... arrgh!");
//select the database ****
$database = mysql_select_db("$mysql_db")
or die ("I cannot select a database!!! arrgh!");
$mysql = "SELECT * FROM $mysql_table";
$results = mysql_query("$mysql");
while($**** = mysql_fetch_array($results))
header('WWW-Authenticate: Some ****="My ****"');
header('HTTP/1.0 401 Unauthorized');
//print some **** if somebosy failed to log in
echo 'You have entered thew wrong password. heh';
if($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $password)
//logged in!! w00t
echo "Logged in!!";
echo "Huh? I could not log you in";
Hope this helps.
July 19th, 2004, 02:14 PM
I think you're looking for something that can do NTLM authentication.
If so, take a look at mod_ntlm.
Experience is something you don't get until just after you need it.