3c4b00512982a5ec3548c7f07a02f92d5b633083
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
12) */
bernd webinterface => /webinterface

bernd authored 17 years ago

13) 
bernd Logging aktiviert

bernd authored 17 years ago

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

bernd authored 17 years ago

15) require_once('inc/debug.php');
16) require_once('inc/error.php');
Bernd Wurst merge passkeys feature

Bernd Wurst authored 1 year ago

17) require_once('modules/loginsecurity/include/totp.php');
bernd webinterface => /webinterface

bernd authored 17 years ago

18) 
19) define('ROLE_ANONYMOUS', 0);
bernd Auch mailaccounts können si...

bernd authored 17 years ago

20) define('ROLE_MAILACCOUNT', 1);
bernd VMail-accounts können sich...

bernd authored 16 years ago

21) define('ROLE_VMAIL_ACCOUNT', 2);
22) define('ROLE_SYSTEMUSER', 4);
23) define('ROLE_CUSTOMER', 8);
24) define('ROLE_SYSADMIN', 16);
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

25) define('ROLE_SUBUSER', 32);
bernd webinterface => /webinterface

bernd authored 17 years ago

26) 
27) 
28) // Gibt die Rolle aus, wenn das Passwort stimmt
29) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

30) function find_role($login, $password, $i_am_admin = false)
bernd webinterface => /webinterface

bernd authored 17 years ago

31) {
Bernd Wurst add brute force protection...

Bernd Wurst authored 5 years ago

32)     if (!$i_am_admin) {
33)         $failed = count_failed_logins();
34)         if ($failed > 5) {
35)             global $title;
36)             $title = '';
37)             system_failure("Zu viele fehlgeschlagenen Login-Versuche! Bitte warten Sie einige Minuten bis zum nächsten Versuch!");
38)         }
39)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

40)     // Domain-Admin?  <not implemented>
41)     // System-User?
42)     $uid = (int) $login;
43)     if ($uid == 0) {
44)         $uid = null;
Bernd Wurst Beachte Groß- und Kleinshre...

Bernd Wurst authored 12 years ago

45)     }
Bernd Wurst merge passkeys feature

Bernd Wurst authored 1 year ago

46)     $result = db_query("SELECT uid, username, passwort AS password, kundenaccount AS `primary`, status, ((SELECT acc.uid FROM system.v_useraccounts AS acc LEFT JOIN system.gruppenzugehoerigkeit USING (uid) LEFT JOIN system.gruppen AS g ON (g.gid=gruppenzugehoerigkeit.gid) WHERE g.name='admin' AND acc.uid=u.uid) IS NOT NULL) AS admin FROM system.v_useraccounts AS u LEFT JOIN system.passwoerter USING(uid) WHERE u.uid=:uid OR username=:login LIMIT 1;", [":uid" => $uid, ":login" => $login]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

47)     if (@$result->rowCount() > 0) {
48)         $entry = $result->fetch(PDO::FETCH_OBJ);
49)         if (strcasecmp($entry->username, $login) == 0 && $entry->username != $login) {
50)             // MySQL matched (warum auch immer) ohne Beachtung der Schreibweise. Wir wollen aber case-sensitive sein.
51)             logger(LOG_WARNING, "session/checkuser", "login", "denying login to wrong cased username »{$login}«.");
52)             warning('Beachten Sie bei der Eingabe Ihrer Zugangsdaten bitte die Groß- und Kleinschreibung.');
53)             return null;
54)         }
55)         $db_password = $entry->password;
56)         $hash = crypt($password, $db_password);
57)         if (($entry->status == 0 && $hash == $db_password) || $i_am_admin) {
58)             $role = ROLE_SYSTEMUSER;
59)             if ($entry->primary) {
60)                 $role = $role | ROLE_CUSTOMER;
61)             }
62)             if ($entry->admin) {
63)                 $role = $role | ROLE_SYSADMIN;
64)             }
65)             logger(LOG_INFO, "session/checkuser", "login", "logged in systemuser »{$login}«.");
66)             return $role;
67)         }
68)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing useraccount »{$login}«.");
69)     } else {
70)         logger(LOG_WARNING, "session/checkuser", "login", "did not find useraccount »{$login}«. trying other roles...");
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

71)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

72) 
73)     // Customer?
74)     $customerno = (int) $login;
75)     $pass = sha1($password);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

76)     $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=:customerno AND passwort=:pass", [":customerno" => $customerno, ":pass" => $pass]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

77)     if ($i_am_admin) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

78)         $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

79)     }
80)     if (@$result->rowCount() > 0) {
81)         return ROLE_CUSTOMER;
82)     }
83) 
84)     // Sub-User
85) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

86)     $result = db_query("SELECT password FROM system.subusers WHERE username=?", [$login]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

87)     if (@$result->rowCount() > 0) {
88)         $entry = $result->fetch(PDO::FETCH_OBJ);
89)         $db_password = $entry->password;
90)         // SHA1 für alte Subuser (kaylee), SHA256 für neue Subuser
91)         if (hash("sha1", $password) == $db_password || hash("sha256", $password) == $db_password || $i_am_admin) {
92)             logger(LOG_INFO, "session/checkuser", "login", "logged in virtual subuser »{$login}«.");
93)             return ROLE_SUBUSER;
94)         }
95)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing subuser »{$login}«.");
96)     }
97) 
98) 
99)     // Mail-Account
100)     $account = $login;
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

101)     if (!strstr($account, '@')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

102)         $account .= '@' . config('masterdomain');
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 12 years ago

103)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

104)     if (!$i_am_admin && have_module('webmailtotp')) {
105)         require_once('modules/webmailtotp/include/totp.php');
106)         if (account_has_totp($account)) {
107)             if (check_webmail_password($account, $password)) {
108)                 $_SESSION['totp_username'] = $account;
109)                 $_SESSION['totp'] = true;
Bernd Wurst merge passkeys feature

Bernd Wurst authored 1 year ago

110)                 show_page('totp-login');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

111)                 die();
112)             } else {
113)                 return null;
114)             }
115)         }
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 12 years ago

116)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

117)     $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

118)     if (@$result->rowCount() > 0) {
119)         $entry = $result->fetch(PDO::FETCH_OBJ);
120)         $db_password = $entry->cryptpass;
121)         $hash = crypt($password, $db_password);
122)         if ($hash == $db_password || $i_am_admin) {
123)             logger(LOG_INFO, "session/checkuser", "login", "logged in e-mail-account »{$account}«.");
124)             return ROLE_MAILACCOUNT;
125)         }
126)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing e-mail-account »{$account}«.");
bernd Auch mailaccounts können si...

bernd authored 17 years ago

127)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

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

Hanno authored 6 years ago

129)     // virtueller Mail-Account
130)     $account = $login;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

131)     $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

132)     if (@$result->rowCount() > 0) {
133)         $entry = $result->fetch(PDO::FETCH_OBJ);
134)         $db_password = $entry->cryptpass;
135)         $hash = crypt($password, $db_password);
136)         if ($hash == $db_password || $i_am_admin) {
137)             logger(LOG_INFO, "session/checkuser", "login", "logged in virtual e-mail-account »{$account}«.");
138)             return ROLE_VMAIL_ACCOUNT;
139)         }
140)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing virtual e-mail-account »{$account}«.");
bernd VMail-accounts können sich...

bernd authored 16 years ago

141)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

142) 
bernd Auch mailaccounts können si...

bernd authored 17 years ago

143) 
144) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

145)     // Nothing?
146)     return null;
bernd webinterface => /webinterface

bernd authored 17 years ago

147) }
148) 
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

149) function is_locked()
150) {
151)     $result = null;
152)     if (isset($_SESSION['customerinfo']['customerno'])) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

153)         $result = db_query("SELECT gesperrt FROM kundendaten.kunden WHERE id=?", [$_SESSION['customerinfo']['customerno']]);
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

154)     } elseif (isset($_SESSION['userinfo']['uid'])) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

155)         $result = db_query("SELECT (SELECT gesperrt FROM kundendaten.kunden WHERE id=useraccounts.kunde) AS gesperrt FROM system.useraccounts WHERE uid=?", [$_SESSION['userinfo']['uid']]);
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

156)     }
157)     if ($result) {
158)         $line = $result->fetch();
159)         if ($line['gesperrt'] == 1) {
160)             return true;
161)         }
162)     }
163)     return false;
164) }
165) 
bernd webinterface => /webinterface

bernd authored 17 years ago

166) 
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

167) function get_customer_info($customer)
bernd webinterface => /webinterface

bernd authored 17 years ago

168) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

169)     if (!$_SESSION['role'] & ROLE_CUSTOMER) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

170)         return [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

171)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

172)     $ret = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

173)     $customerno = (int) $customer;
174)     if ($customerno != 0) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

175)         DEBUG('Looking up customerinfo for customer no. ' . $customerno);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

176)         $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden WHERE id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

177)     } else {
178)         $username = $customer;
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

179)         DEBUG('looking up customer info for username ' . $username);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

180)         $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", [$username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

181)     }
182)     if (@$result->rowCount() == 0) {
183)         system_failure("Konnte Kundendaten nicht auslesen!");
184)     }
185)     $data = $result->fetch();
186)     DEBUG($data);
187)     $ret['customerno'] = $data['id'];
188)     $ret['title'] = $data['anrede'];
189)     $ret['company'] = $data['firma'];
190)     $ret['name'] = $data['name'];
191)     $ret['email'] = $data['email'];
Hanno remove whitespace in empty...

Hanno authored 6 years ago

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

Hanno authored 6 years ago

193)     return $ret;
bernd webinterface => /webinterface

bernd authored 17 years ago

194) }
195) 
196) 
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

197) function get_subuser_info($username)
198) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

199)     $result = db_query("SELECT uid, modules FROM system.subusers WHERE username=?", [$username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

200)     if ($result->rowCount() < 1) {
201)         logger(LOG_ERR, "session/checkuser", "login", "error reading subuser's data: »{$username}«");
202)         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
203)     }
204)     $data = $result->fetch();
205)     $userinfo = get_user_info($data['uid']);
206)     $userinfo['modules'] = $data['modules'];
207)     return $userinfo;
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

208) }
209) 
210) 
bernd webinterface => /webinterface

bernd authored 17 years ago

211) function get_user_info($username)
212) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

213)     $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

214)                       FROM system.v_useraccounts WHERE username=:username OR uid=:username", [":username" => $username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

215)     if ($result->rowCount() < 1) {
216)         logger(LOG_ERR, "session/checkuser", "login", "error reading user's data: »{$username}«");
217)         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
218)     }
219)     $val = @$result->fetch(PDO::FETCH_OBJ);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

220)     return [
bernd webinterface => /webinterface

bernd authored 17 years ago

221)           'username'      => $val->username,
222)           'customerno'    => $val->customerno,
223)           'uid'           => $val->uid,
224)           'homedir'       => $val->homedir,
bernd IPv6-Option nur anzeigen we...

bernd authored 14 years ago

225)           'server'        => $val->server,
bernd webinterface => /webinterface

bernd authored 17 years ago

226)           'name'          => $val->name,
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

227)           ];
bernd webinterface => /webinterface

bernd authored 17 years ago

228) }
229) 
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

230) function set_customer_verified($customerno)
231) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

232)     $customerno = (int) $customerno;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

233)     db_query("UPDATE kundendaten.kunden SET status=0 WHERE id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

234)     logger(LOG_INFO, "session/checkuser", "register", "set customer's status to 0.");
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

235) }
236) 
237) function set_customer_lastlogin($customerno)
238) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

239)     $customerno = (int) $customerno;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

240)     db_query("UPDATE kundendaten.kunden SET lastlogin=NOW() WHERE id=?", [$customerno]);
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

241) }
242) 
bernd webinterface => /webinterface

bernd authored 17 years ago

243) function set_customer_password($customerno, $newpass)
244) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

245)     $customerno = (int) $customerno;
246)     $newpass = sha1($newpass);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

247)     db_query("UPDATE kundendaten.kunden SET passwort=:newpass WHERE id=:customerno", [":newpass" => $newpass, ":customerno" => $customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

248)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed customer's password.");
bernd Passwort-Ändern geht jetzt...

bernd authored 14 years ago

249) }
250) 
251) function set_subuser_password($subuser, $newpass)
252) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

253)     $args = [":subuser" => $subuser,
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

254)                 ":uid" => (int) $_SESSION['userinfo']['uid'],
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

255)                 ":newpass" => sha1($newpass), ];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

256)     db_query("UPDATE system.subusers SET password=:newpass WHERE username=:subuser AND uid=:uid", $args);
257)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed subuser's password.");
bernd webinterface => /webinterface

bernd authored 17 years ago

258) }
259) 
260) function set_systemuser_password($uid, $newpass)
261) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

262)     $uid = (int) $uid;
263)     require_once('inc/base.php');
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

264)     $newpass = crypt($newpass, '$6$' . random_string(8) . '$');
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

265)     db_query("UPDATE system.passwoerter SET passwort=:newpass WHERE uid=:uid", [":newpass" => $newpass, ":uid" => $uid]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

266)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed user's password.");
bernd webinterface => /webinterface

bernd authored 17 years ago

267) }
268) 
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

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

Hanno authored 6 years ago

270) function user_for_mailaccount($account)
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

271) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

272)     $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

273)     if ($result->rowCount() != 1) {
274)         system_failure('Diese Adresse ist herrenlos?!');
275)     }
276)     $tmp = $result->fetch();
277)     return $tmp['uid'];
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

278) }
279) 
280) function user_for_vmail_account($account)
281) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

282)     $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

283)     if ($result->rowCount() != 1) {
284)         system_failure('Diese Adresse ist herrenlos?!');
285)     }
286)     $tmp = $result->fetch();
287)     return $tmp['useraccount'];
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

288) }
289) 
290) 
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

291) function setup_session($role, $useridentity)
292) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

293)     session_regenerate_id();
294)     $_SESSION['role'] = $role;
295)     if ($role & ROLE_SUBUSER) {
296)         DEBUG("We are a sub-user");
297)         $info = get_subuser_info($useridentity);
298)         $_SESSION['userinfo'] = $info;
299)         $_SESSION['restrict_modules'] = explode(',', $info['modules']);
300)         $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_SUBUSER;
301)         $_SESSION['subuser'] = $useridentity;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

302)         $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", [$info['username']]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

303)         if ($entry = $data->fetch()) {
304)             if ($entry['kundenaccount'] == 1) {
305)                 $customer = get_customer_info($_SESSION['userinfo']['username']);
306)                 $_SESSION['customerinfo'] = $customer;
307)                 $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_CUSTOMER | ROLE_SUBUSER;
308)             }
309)         }
310)         logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
Bernd Wurst Subuser sollen nicht automa...

Bernd Wurst authored 11 years ago

311)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

312)     if ($role & ROLE_SYSTEMUSER) {
313)         DEBUG("We are system user");
314)         $info = get_user_info($useridentity);
315)         $_SESSION['userinfo'] = $info;
316)         logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
317)         $useridentity = $info['customerno'];
318)     }
319)     if ($role & ROLE_CUSTOMER) {
320)         $info = get_customer_info($useridentity);
321)         $_SESSION['customerinfo'] = $info;
322)         if (!isset($_SESSION['admin_user'])) {
323)             set_customer_lastlogin($info['customerno']);
324)         }
325)         logger(LOG_INFO, "session/start", "login", "logged in customer no »{$info['customerno']}«");
326)     }
327)     if ($role & ROLE_MAILACCOUNT) {
328)         $id = $useridentity;
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

329)         if (!strstr($id, '@')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

330)             $id .= '@' . config('masterdomain');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

331)         }
332)         $uid = user_for_mailaccount($id);
333)         $_SESSION['mailaccount'] = $id;
334)         $_SESSION['userinfo'] = get_user_info($uid);
335)         DEBUG("We are mailaccount: {$_SESSION['mailaccount']}");
336)     }
337)     if ($role & ROLE_VMAIL_ACCOUNT) {
338)         $id = $useridentity;
339)         $uid = user_for_vmail_account($id);
340)         $_SESSION['mailaccount'] = $id;
341)         $_SESSION['userinfo'] = get_user_info($uid);
342)         DEBUG("We are virtual mailaccount: {$_SESSION['mailaccount']}");
bernd Setze lastlogin nur bei Nic...

bernd authored 13 years ago

343)     }
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

344)     if (!($role & ROLE_CUSTOMER)) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

345)         $_SESSION['customerinfo'] = [];
Bernd Wurst Lösche alte Kundendaten aus...

Bernd Wurst authored 5 years ago

346)     }