logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



How to Login to MSSQL Server using Windows Authentication?

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
kr33



Joined: 19 Sep 2006
Posts: 64
Location: South Africa

PostPosted: Mon 11 Dec '06 10:43    Post subject: How to Login to MSSQL Server using Windows Authentication? Reply with quote

Hi All,

I'm trying to get me login script in PHP to use the windows authentication method, but I don't know how...I'm currently using the mssql_connect(..,..,..) method, although I know this is strictly for using the SQL Authentication Method.

So How would I achieve my goal using the Windows Authentication method?

Any Help, Much thanks

Kr33

Quote:
A man's dream are an index to his greatness!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Tue 12 Dec '06 20:44    Post subject: Reply with quote

If you want to protect a folder you could use mod_auth_sspi in a .htaccess file. But if you need it in a script
Code:

<?php
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
//

 $users = array(
      "user"=>"passwort",
      "anonyme"=>"devine"
   );

   $auth_text = "You are not allowed to go here";

   if(!(empty($PHP_AUTH_USER) || empty($PHP_AUTH_PW)) && $PHP_AUTH_PW==$users[$PHP_AUTH_USER]){
                  include("page.php");
   }
   else{
      header("www-authenticate: basic realm=\"$auth_text\"");
      header("http/1.0 401 unauthorized");
   }
?>


the users array could be also from a database
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1