Einzelnen Beitrag anzeigen
Alt 11.03.2004, 14:17   #1
heli2sky
Master
 
Registriert seit: 02.10.2001
Alter: 38
Beiträge: 523


heli2sky eine Nachricht über ICQ schicken
Standard http authentication

http://www.php.net/manual/en/features.http-auth.php

und wie mach ich das jetzt, dass er zugriff gewährt, wenn ich den richtigen user und passwort angegeben habe???

[edit]
sorry... geht schon!

hatte das gestern probiert, da is es nicht gegangen, jetzt gehts:

PHP-Code:
<?php
//http://at.php.net/manual/en/features.http-auth.php
function login_error()
{
 echo 
"error - login process failed.";
}

if (!isset(
$PHP_AUTH_USER))
{
 
header("WWW-Authenticate: Basic realm=\"Mosaic Authorization process\"");
 
header("HTTP/1.0 401 Unauthorized");

 
//Result if user hits cancel button
 
login_error();
}
else
{

 
//check the login and password
 
if($_SERVER['PHP_AUTH_USER']=="user" && md5($_SERVER['PHP_AUTH_PW'])=="pw(md5-verschlüsselt)")
 {
  
//User is logged
    
echo "logged in...";
 }
 else
 {
  
//This re-asks three times the login and password.
  
header"WWW-Authenticate: Basic realm=\"Test Authentication System\"");
  
header("HTTP/1.0 401 Unauthorized");

  
//Result if user does not give good login and pass
  
login_error();
 }

?>
____________________________________
Lang ist der Weg durch Lehren, kurz und wirksam durch Beispiele.
Lucius Annaeus Seneca


...:::www.modellbaulexikon.org:::...

www.acrobat-se.org | www.ams-8c.de.vu
heli2sky ist offline   Mit Zitat antworten