2e004ad39db52c2ac05e34ca81a392a272b0dce7
bernd webinterface => /webinterface

bernd authored 17 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 Cookie einen eindeutigen Na...

bernd authored 16 years ago

14) session_name('CONFIG_SCHOKOKEKS_ORG');
15) 
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

20) }
bernd webinterface => /webinterface

bernd authored 17 years ago

21) 
hanno nochmal entities:specialchars

hanno authored 17 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

44)       break;
45)     case ROLE_CUSTOMER:
46)       $info = get_customer_info($_POST['username']);
47)       $_SESSION['customerinfo'] = $info;
bernd Kunden-Status wird benutzt...

bernd authored 16 years ago

48)       set_customer_lastlogin($info['customerno']);
bernd Logging aktiviert

bernd authored 16 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

68) 
69) DEBUG("Role: ".$_SESSION['role']);
70)