ec5ed2ed870b5374ab2c05502621d0c161c3c2d8
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 Session-Name aus einer Conf...

bernd authored 13 years ago

14) session_name(config('session_name'));
bernd Cookie einen eindeutigen Na...

bernd authored 16 years ago

15) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

16) if ($_SERVER['HTTPS']) {
17)     session_set_cookie_params(0, '/', '', true, true);
18) }
bernd sichere cookies

bernd authored 15 years ago

19) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

20) if (!session_start()) {
21)     logger(LOG_ERR, "session/start", "session", "Die session konnte nicht gestartet werden!");
22)     system_failure('Die Sitzung konnte nicht gestartet werden, bitte benachrichtigen Sie den Administrator!');
bernd Logging aktiviert

bernd authored 16 years ago

23) }
bernd webinterface => /webinterface

bernd authored 17 years ago

24) 
hanno nochmal entities:specialchars

hanno authored 16 years ago

25) 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

26) 
Bernd Wurst Umbenennung Google-Auth nac...

Bernd Wurst authored 11 years ago

27) if (have_module('webmailtotp') && isset($_POST['webinterface_totpcode']) && isset($_SESSION['totp']) && isset($_SESSION['totp_username'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

28)     require_once('modules/webmailtotp/include/totp.php');
29)     $role = null;
30)     if (check_totp($_SESSION['totp_username'], $_POST['webinterface_totpcode'])) {
31)         $role = find_role($_SESSION['totp_username'], '', true);
32)     }
33)     if ($role === null) {
34)         $_SESSION['role'] = ROLE_ANONYMOUS;
35)         logger(LOG_WARNING, "session/start", "login", "wrong totp code (username: »{$_SESSION['totp_username']}«)");
36)         warning('Ihre Anmeldung konnte nicht durchgeführt werden. Geben Sie bitte einen neuen Code ein.');
37)         show_page('webmailtotp-login');
38)         die();
39)     } else {
40)         setup_session($role, $_SESSION['totp_username']);
41)     }
42)     unset($_POST['webinterface_totpcode']);
43)     unset($_SESSION['totp']);
44)     unset($_SESSION['totp_username']);
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

45) }
46) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

47) if (isset($_POST['webinterface_username']) && isset($_POST['webinterface_password'])) {
48)     $role = find_role($_POST['webinterface_username'], $_POST['webinterface_password']);
49)     if ($role === null) {
50)         $_SESSION['role'] = ROLE_ANONYMOUS;
51)         logger(LOG_WARNING, "session/start", "login", "wrong user data (username: »{$_POST['webinterface_username']}«)");
52)         login_screen('Ihre Anmeldung konnte nicht durchgeführt werden. Vermutlich haben Sie falsche Zugangsdaten eingegeben.');
53)     } else {
54)         setup_session($role, $_POST['webinterface_username']);
55)     }
56)     unset($_POST['webinterface_username']);
57)     unset($_POST['webinterface_password']);
58) } elseif (isset($_SESSION['role'])) {
59)     /* User ist eingeloggt (aber vielleicht als ROLE_ANONYMOUS!) */
60) } else {
bernd webinterface => /webinterface

bernd authored 17 years ago

61)     $_SESSION['role'] = ROLE_ANONYMOUS;
62) }
63) // Wenn wir hier sind, ist der Benutzer eingeloggt. Möglicherweise nur als ANONYMOUS
64)