Quelltext der Datei: http://www.michaelster.ch/lernen/authinc.php

Dateigrösse: 1.74 kb

[Anzeige ohne Zeilennummern]


 1 <?php
 2 require_once '/home/httpd/vhosts/michaelster.ch/httpdocs/include/login_authinc.php';
 3 require_once 'Auth.php';
 4 
 5 $show_loginwindow = false;
 6 
 7 function eingabe($username, $status)
 8 {
 9     global $show_loginwindow;
10     $show_loginwindow = true;
11      include 'login_form.php';
12 }
13 
14 $params = array( 'dsn'                => $_dbtype.'://'.$_user.':'.$_passwd.'@'.$_host.'/'.$_db, 
15                  'table'          => 'user',          
16                  'usernamecol'   => 'user_name',     
17                  'passwordcol'   => 'user_pw',         
18                    'cryptType'      => 'md5',             
19                  'enableLogging' => true );            
20 /*
21 $params = array( 'dsn'               => 'mysql://webprog08:web8prog@localhost/webprog',
22                   'table'          => 'user',
23                   'usernamecol'      => 'user_name',
24                   'passwordcol'      => 'user_pw',
25                    'cryptType'      => 'md5', 
26                  'enableLogging' => true );
27 */
28 $a =& new Auth ('DB', $params, 'eingabe');
29 //$a = new Auth ('MDB2', $params, 'eingabe');
30 
31 //$a->setSessionname('klik_AuthSession');
32 
33 /* Debugging */  /*
34 require_once 'Log.php';
35 require_once 'Log/observer.php';
36 
37 class Auth_Log_Observer extends Log_observer {
38    var $messages = array();
39    function notify($event) {
40       $this->messages[] = $event;
41    }
42 }
43 
44 $debugObserver = new Auth_Log_Observer(PEAR_LOG_DEBUG);
45 $a->debug($debugObserver); 
46 
47 $infoObserver = new Auth_Log_Observer(PEAR_LOG_INFO);
48 $a->attachLogObserver($infoObserver);
49 
50 
51 $tpl->setVariable('kap', 'angebot');
52 $tpl->setVariable('navid', '2');
53 */
54 $a->setExpire(600);
55 
56 $a->setIdle(30);
57 
58 $a->start();
59 
60 if (isset($_GET['logout']))
61 {
62     $a->logout();
63     if ($show_loginwindow === false)
64     {
65         $a->start();
66     }
67     exit;
68 }
69 
70 if (!$a->getAuth())
71 {
72    exit;
73 }
74 
75 ?>