Results 1 to 3 of 3

Thread: PHP authentication against a NT4.0 Server

  1. #1
    Join Date
    Jun 2002

    PHP authentication against a NT4.0 Server

    Hey Guys,

    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.


  2. #2
    There are scripts on how to use authentication with PHP, here is a simple example:

    //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))                
      if (!isset($_SERVER['PHP_AUTH_USER'])) 
        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";                
    Then make a database table PHP_AUTH_USER.

    Hope this helps.

  3. #3
    Just Another Geek
    Join Date
    Jul 2002
    Rotterdam, Netherlands
    I think you're looking for something that can do NTLM authentication.

    If so, take a look at mod_ntlm.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts