deedc3e35d94c0d716ccb63996c7d4cafd95267d
bernd webinterface => /webinterface

bernd authored 16 years ago

1) <?php
2) /*
3) 
4)   Session-Start-Script wird vom dispatcher eingebunden
5) 
6) */
7) 
8) require_once('session/checkuser.php');
9) require_once('inc/error.php');
10) require_once('inc/debug.php');
11) 
bernd Logging aktiviert

bernd authored 16 years ago

12) require_once('inc/base.php');
13) 
bernd webinterface => /webinterface

bernd authored 16 years ago

14) if (!session_start())
bernd Logging aktiviert

bernd authored 16 years ago

15) {
16)         logger("session/start.php", "session", "Die session konnte nicht gestartet werden!");
bernd webinterface => /webinterface

bernd authored 16 years ago

17)         system_failure('Die Sitzung konnte nicht gestartet werden, bitte benachrichtigen Sie den Administrator!');
bernd Logging aktiviert

bernd authored 16 years ago

18) }
bernd webinterface => /webinterface

bernd authored 16 years ago

19) 
hanno nochmal entities:specialchars

hanno authored 16 years ago

20) DEBUG("<pre>POST-DATA: ".htmlspecialchars(print_r($_POST, true))."\nSESSION_DATA: ".htmlspecialchars(print_r($_SESSION, true))."</pre>");
bernd webinterface => /webinterface

bernd authored 16 years ago

21) 
22) if (isset($_POST['username']) && isset($_POST['password']))
23) {
24)   $role = find_role($_POST['username'], $_POST['password']);
25)   if ($role === NULL)
26)   {
27)     $_SESSION['role'] = ROLE_ANONYMOUS;
bernd typo

bernd authored 16 years ago

28)     logger("session/start.php", "login", "wrong user data (username: »{$_POST['username']}«)");
bernd webinterface => /webinterface

bernd authored 16 years ago

29)     login_screen('Ihre Anmeldung konnte nicht durchgeführt werden. Vermutlich haben Sie falsche Zugangsdaten eingegeben.');
30)   }
31)   else
32)   {
33)     session_regenerate_id();
34)     $_SESSION['role'] = $role;
35) 
36)     switch ($role)
37)     {
38)     case ROLE_SYSTEMUSER:
39)       $info = get_user_info($_POST['username']);
40)       $_SESSION['userinfo'] = $info;
bernd Logging aktiviert

bernd authored 16 years ago

41)       logger("session/start.php", "login", "logged in user »{$info['username']}«");
bernd webinterface => /webinterface

bernd authored 16 years ago

42)       break;
43)     case ROLE_CUSTOMER:
44)       $info = get_customer_info($_POST['username']);
45)       $_SESSION['customerinfo'] = $info;
bernd Logging aktiviert

bernd authored 16 years ago

46)       logger("session/start.php", "login", "logged in customer no »{$info['customerno']}«");
bernd webinterface => /webinterface

bernd authored 16 years ago

47)       break;
48)     }
49)   }
50)   unset($_POST['username']);
51)   unset($_POST['password']);
52) }
53) 
54) elseif (isset($_SESSION['role']))
55) {
56)   /* User ist eingeloggt (aber vielleicht als ROLE_ANONYMOUS!) */
57) }
58) 
59) else
60) {
61)   $_SESSION['role'] = ROLE_ANONYMOUS;
62) }
63) // Wenn wir hier sind, ist der Benutzer eingeloggt. Möglicherweise nur als ANONYMOUS
64) 
bernd Menü-Includes sinnvoller /...

bernd authored 16 years ago

65) 
66) DEBUG("Role: ".$_SESSION['role']);
67)