Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 109 | Revision 165 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 109 Revision 162
Zeile 1... Zeile 1...
1
<?
1
<?
2
	//$Id: auth.php 109 2008-05-09 22:19:52Z lars $
2
    //$Id: auth.php 162 2010-03-12 23:25:46Z lars $
3
	/**
3
    /**
4
	 * 	@package	openvz_admin
4
     * 	@package	openvz_admin
5
	 * 	@author		Lars Tiefland <ltiefland@gmail.com> 
5
     * 	@author		Lars Tiefland <ltiefland@gmail.com> 
6
	 **/
6
     **/
7
	function authenticiate()
7
    function authenticiate()
8
	{
8
    {
9
		global $smarty, $meld;
9
        global $smarty, $meld;
10
		$pw=" ";
10
        $pw = " ";
11
		header('HTTP/1.0 401 Unauthorized');
11
        header( 'HTTP/1.0 401 Unauthorized' );
12
		header('WWW-authenticate: basic realm="Pflanzendatenbank"');
12
        header( 'WWW-authenticate: basic realm="Pflanzendatenbank"' );
-
 
13
        $meld = ( ! isset( $meld ) ) ?
13
		$meld=(!isset($meld))?"Ungültige Login-Informationen ==> Zuguriff verweigert!":$meld;
14
            "Ungültige Login-Informationen ==> Zuguriff verweigert!" : $meld;
14
		$smarty->assign("h1","Fehler bei Authentifizierung!");
15
        $smarty->assign( "h1", "Fehler bei Authentifizierung!" );
15
		$smarty->assign("meld",$meld);
16
        $smarty->assign( "meld", $meld );
16
		$smarty->assign("error",true);
17
        $smarty->assign( "error", true );
17
		$smarty->display("meld.tpl");
18
        $smarty->display( "meld.tpl" );
18
		exit;
19
        exit;
19
	}
20
    }
Zeile 20... Zeile 21...
20
 
21
 
21
	if (!isset($_SERVER["PHP_AUTH_USER"]))
22
    if ( ! isset( $_SERVER["PHP_AUTH_USER"] ) )
22
	{
23
    {
23
		authenticiate();
24
        authenticiate();
24
	}
25
    }
25
	else
26
    else
26
	{
27
    {
27
		$u_name=$_SERVER["PHP_AUTH_USER"];
28
        $u_name = $_SERVER["PHP_AUTH_USER"];
28
		if(strtolower($u_name)=="guest")
29
        if ( strtolower( $u_name ) == "guest" )
29
		{
30
        {
30
			require("email.php");
31
            require ( "email.php" );
31
			$pw="";
32
            $pw = "";
32
		}
33
        }
33
		else
34
        else
34
		{
35
        {
35
			$pw=$_SERVER["PHP_AUTH_PW"];
36
            $pw = $_SERVER["PHP_AUTH_PW"];
36
		}
37
        }
37
		$user=new User($u_name, $pw);
38
        $user = new User( $u_name, $pw );
38
		if(is_null($user->u_id))
39
        if ( is_null( $user->u_id ) )
39
		{
40
        {
40
			authenticiate();
41
            authenticiate();
41
		}
42
        }
42
	}
43
    }