f1f231f5e074dfa038e70a67d39849e80f2b4b4d
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) 
Bernd Wurst Updated copyright notice (2...

Bernd Wurst authored 11 years ago

5) Written 2008-2013 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) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) 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.
15) */
bernd webinterface => /webinterface

bernd authored 17 years ago

16) 
bernd Logging aktiviert

bernd authored 16 years ago

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

bernd authored 17 years ago

18) require_once('inc/debug.php');
19) require_once('inc/error.php');
20) 
21) 
22) define('ROLE_ANONYMOUS', 0);
bernd Auch mailaccounts können si...

bernd authored 16 years ago

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

bernd authored 16 years ago

24) define('ROLE_VMAIL_ACCOUNT', 2);
25) define('ROLE_SYSTEMUSER', 4);
26) define('ROLE_CUSTOMER', 8);
27) define('ROLE_SYSADMIN', 16);
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

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

bernd authored 17 years ago

29) 
30) 
31) // Gibt die Rolle aus, wenn das Passwort stimmt
32) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

33) function find_role($login, $password, $i_am_admin = False)
bernd webinterface => /webinterface

bernd authored 17 years ago

34) {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

35)   $login = db_escape_string($login);
bernd webinterface => /webinterface

bernd authored 17 years ago

36)   // Domain-Admin?  <not implemented>
37)   // System-User?
38)   $uid = (int) $login;
39)   if ($uid == 0)
40)     $uid = 'NULL';
Bernd Wurst Beachte Groß- und Kleinshre...

Bernd Wurst authored 11 years ago

41)   $result = db_query("SELECT 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;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

42)   if (@$result->rowCount() > 0)
bernd webinterface => /webinterface

bernd authored 17 years ago

43)   {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

44)     $entry = $result->fetch(PDO::FETCH_OBJ);
Bernd Wurst Fixed: Login via UID nicht...

Bernd Wurst authored 11 years ago

45)     if (strcasecmp($entry->username, $login) == 0 && $entry->username != $login) {
Bernd Wurst Beachte Groß- und Kleinshre...

Bernd Wurst authored 11 years ago

46)       // MySQL matched (warum auch immer) ohne Beachtung der Schreibweise. Wir wollen aber case-sensitive sein.
47)       logger(LOG_WARNING, "session/checkuser", "login", "denying login to wrong cased username »{$login}«.");
48)       warning('Beachten Sie bei der Eingabe Ihrer Zugangsdaten bitte die Groß- und Kleinschreibung.');
49)       return NULL;  
50)     }
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

51)     $db_password = $entry->password;
bernd webinterface => /webinterface

bernd authored 17 years ago

52)     $hash = crypt($password, $db_password);
bernd Sperre Login für gesperrte...

bernd authored 12 years ago

53)     if (($entry->status == 0 && $hash == $db_password) || $i_am_admin)
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

54)     {
55)       $role = ROLE_SYSTEMUSER;
56)       if ($entry->primary)
57)         $role = $role | ROLE_CUSTOMER;
58)       if ($entry->admin)
59)         $role = $role | ROLE_SYSADMIN;
bernd Logger mit Logleveln

bernd authored 14 years ago

60)       logger(LOG_INFO, "session/checkuser", "login", "logged in systemuser »{$login}«.");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

61)       return $role;
62)     }
bernd Logger mit Logleveln

bernd authored 14 years ago

63)     logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing useraccount »{$login}«.");
bernd Mehr logging

bernd authored 15 years ago

64)   } else {
bernd Logger mit Logleveln

bernd authored 14 years ago

65)     logger(LOG_WARNING, "session/checkuser", "login", "did not find useraccount »{$login}«. trying other roles...");
bernd webinterface => /webinterface

bernd authored 17 years ago

66)   }
67) 
68)   // Customer?
69)   $customerno = (int) $login;
70)   $pass = sha1($password);
bernd sql-abfragen abstrahiert

bernd authored 16 years ago

71)   $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id={$customerno} AND passwort='{$pass}';");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

72)   if ($i_am_admin)
73)     $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id={$customerno}");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

74)   if (@$result->rowCount() > 0)
bernd webinterface => /webinterface

bernd authored 17 years ago

75)   {
76)     return ROLE_CUSTOMER;
77)   }
78) 
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

79)   // Sub-User
80) 
81)   $result = db_query("SELECT password FROM system.subusers WHERE username='{$login}'");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

82)   if (@$result->rowCount() > 0)
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

83)   {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

84)     $entry = $result->fetch(PDO::FETCH_OBJ);
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

85)     $db_password = $entry->password;
86)     // SHA1 für alte Subuser (kaylee), SHA256 für neue Subuser
87)     if (hash("sha1", $password) == $db_password || hash("sha256", $password) == $db_password || $i_am_admin)
88)     {
89)       logger(LOG_INFO, "session/checkuser", "login", "logged in virtual subuser »{$login}«.");
90)       return ROLE_SUBUSER;
91)     }
92)     logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing subuser »{$login}«.");
93)   }
94) 
95) 
bernd Auch mailaccounts können si...

bernd authored 16 years ago

96)   // Mail-Account
97)   $account = $login;
98)   if (! strstr($account, '@')) {
bernd Mehr config-optionen und co...

bernd authored 14 years ago

99)     $account .= '@'.config('masterdomain');
bernd Auch mailaccounts können si...

bernd authored 16 years ago

100)   }
Bernd Wurst Umbenennung Google-Auth nac...

Bernd Wurst authored 11 years ago

101)   if (!$i_am_admin && have_module('webmailtotp')) {
102)     require_once('modules/webmailtotp/include/totp.php');
103)     if (account_has_totp($account)) {
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

104)       if (check_webmail_password($account, $password)) {
Bernd Wurst Umbenennung Google-Auth nac...

Bernd Wurst authored 11 years ago

105)         $_SESSION['totp_username'] = $account;
106)         $_SESSION['totp'] = True;
107)         show_page('webmailtotp-login');
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

108)         die();
109)       } else {
110)         return NULL;
111)       }
112)     }
113)   }
bernd Auch mailaccounts können si...

bernd authored 16 years ago

114)   $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account='{$account}' LIMIT 1;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

115)   if (@$result->rowCount() > 0)
bernd Auch mailaccounts können si...

bernd authored 16 years ago

116)   {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

117)     $entry = $result->fetch(PDO::FETCH_OBJ);
bernd Auch mailaccounts können si...

bernd authored 16 years ago

118)     $db_password = $entry->cryptpass;
119)     $hash = crypt($password, $db_password);
120)     if ($hash == $db_password || $i_am_admin)
121)     {
bernd Logger mit Logleveln

bernd authored 14 years ago

122)       logger(LOG_INFO, "session/checkuser", "login", "logged in e-mail-account »{$account}«.");
bernd Auch mailaccounts können si...

bernd authored 16 years ago

123)       return ROLE_MAILACCOUNT;
124)     }
bernd Logger mit Logleveln

bernd authored 14 years ago

125)     logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing e-mail-account »{$account}«.");
bernd Auch mailaccounts können si...

bernd authored 16 years ago

126)   }
127)   
bernd VMail-accounts können sich...

bernd authored 16 years ago

128)   // virtueller Mail-Account
129)   $account = $login;
130)   $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account='{$account}' LIMIT 1;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

131)   if (@$result->rowCount() > 0)
bernd VMail-accounts können sich...

bernd authored 16 years ago

132)   {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

133)     $entry = $result->fetch(PDO::FETCH_OBJ);
bernd VMail-accounts können sich...

bernd authored 16 years ago

134)     $db_password = $entry->cryptpass;
135)     $hash = crypt($password, $db_password);
136)     if ($hash == $db_password || $i_am_admin)
137)     {
bernd Logger mit Logleveln

bernd authored 14 years ago

138)       logger(LOG_INFO, "session/checkuser", "login", "logged in virtual e-mail-account »{$account}«.");
bernd VMail-accounts können sich...

bernd authored 16 years ago

139)       return ROLE_VMAIL_ACCOUNT;
140)     }
bernd Logger mit Logleveln

bernd authored 14 years ago

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

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

bernd authored 16 years ago

144) 
145) 
bernd webinterface => /webinterface

bernd authored 17 years ago

146)   // Nothing?
147)   return NULL;
148) }
149) 
150) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

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

bernd authored 17 years ago

152) {
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

153)   if (! $_SESSION['role'] & ROLE_CUSTOMER)
154)     return array();
bernd webinterface => /webinterface

bernd authored 17 years ago

155)   $ret = array();
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

156)   $customerno = (int) $customer;
157)   if ($customerno != 0)
158)   {
159)     DEBUG('Looking up customerinfo for customer no. '.$customerno);
bernd Warnung gefixed

bernd authored 14 years ago

160)     $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} LIMIT 1;");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

161)   }
162)   else
163)   {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

164)     $username = db_escape_string($customer);
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

165)     DEBUG('looking up customer info for username '.$username);
bernd Warnung gefixed

bernd authored 14 years ago

166)     $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}'");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

167)   }
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

168)   if (@$result->rowCount() == 0)
bernd webinterface => /webinterface

bernd authored 17 years ago

169)     system_failure("Konnte Kundendaten nicht auslesen!");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

170)   $data = $result->fetch();
bernd Warnung gefixed

bernd authored 14 years ago

171)   DEBUG($data);
172)   $ret['customerno'] = $data['id'];
173)   $ret['title'] = $data['anrede'];
174)   $ret['company'] = $data['firma'];
175)   $ret['name'] = $data['name'];
176)   $ret['email'] = $data['email'];
bernd webinterface => /webinterface

bernd authored 17 years ago

177)   
178)   return $ret;
179) }
180) 
181) 
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

182) function get_subuser_info($username)
183) {
184)   $result = db_query("SELECT uid, modules FROM system.subusers WHERE username='{$username}'");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

185)   if ($result->rowCount() < 1)
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

186)   {
187)     logger(LOG_ERR, "session/checkuser", "login", "error reading subuser's data: »{$username}«");
188)     system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
189)   }
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

190)   $data = $result->fetch();
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

191)   $userinfo = get_user_info($data['uid']);
192)   $userinfo['modules'] = $data['modules'];
193)   return $userinfo;
194) }
195) 
196) 
bernd webinterface => /webinterface

bernd authored 17 years ago

197) function get_user_info($username)
198) {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

199)   $username = db_escape_string($username);
bernd IPv6-Option nur anzeigen we...

bernd authored 13 years ago

200)   $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
bernd sql-abfragen abstrahiert

bernd authored 16 years ago

201)                       FROM system.v_useraccounts WHERE username='{$username}' OR uid='{$username}' LIMIT 1");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

202)   if ($result->rowCount() < 1)
bernd Kunden-Status wird benutzt...

bernd authored 16 years ago

203)   {
bernd Logger mit Logleveln

bernd authored 14 years ago

204)     logger(LOG_ERR, "session/checkuser", "login", "error reading user's data: »{$username}«");
bernd webinterface => /webinterface

bernd authored 17 years ago

205)     system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
bernd Kunden-Status wird benutzt...

bernd authored 16 years ago

206)   }
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

207)   $val = @$result->fetch(PDO::FETCH_OBJ);
bernd webinterface => /webinterface

bernd authored 17 years ago

208)   return array(
209)           'username'      => $val->username,
210)           'customerno'    => $val->customerno,
211)           'uid'           => $val->uid,
212)           'homedir'       => $val->homedir,
bernd IPv6-Option nur anzeigen we...

bernd authored 13 years ago

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

bernd authored 17 years ago

214)           'name'          => $val->name,
215)           );
216) }
217) 
bernd Kunden-Status wird benutzt...

bernd authored 16 years ago

218) function set_customer_verified($customerno)
219) {
220)   $customerno = (int) $customerno;
221)   db_query("UPDATE kundendaten.kunden SET status=0 WHERE id={$customerno};");
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 16 years ago

223) }
224) 
225) function set_customer_lastlogin($customerno)
226) {
227)   $customerno = (int) $customerno;
228)   db_query("UPDATE kundendaten.kunden SET lastlogin=NOW() WHERE id={$customerno};");
229) }
230) 
bernd webinterface => /webinterface

bernd authored 17 years ago

231) function set_customer_password($customerno, $newpass)
232) {
233)   $customerno = (int) $customerno;
234)   $newpass = sha1($newpass);
bernd sql-abfragen abstrahiert

bernd authored 16 years ago

235)   db_query("UPDATE kundendaten.kunden SET passwort='$newpass' WHERE id='".$customerno."' LIMIT 1");
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 13 years ago

237) }
238) 
239) function set_subuser_password($subuser, $newpass)
240) {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

241)   $subuser = db_escape_string($subuser);
bernd Passwort-Ändern geht jetzt...

bernd authored 13 years ago

242)   $uid = (int) $_SESSION['userinfo']['uid'];
243)   $newpass = sha1($newpass);
244)   db_query("UPDATE system.subusers SET password='$newpass' WHERE username='{$subuser}' AND uid={$uid}");
245)   logger(LOG_INFO, "session/checkuser", "pwchange", "changed subuser's password.");
bernd webinterface => /webinterface

bernd authored 17 years ago

246) }
247) 
248) function set_systemuser_password($uid, $newpass)
249) {
250)   $uid = (int) $uid;
251)   require_once('inc/base.php');
bernd Benutzer SHA512 wenn möglich

bernd authored 14 years ago

252)   if (defined("CRYPT_SHA512") && CRYPT_SHA512 == 1)
253)   {
254)     $rounds = rand(1000, 5000);
255)     $salt = "rounds=".$rounds."$".random_string(8);
256)     $newpass = crypt($newpass, "\$6\${$salt}\$");
257)   }
258)   else
259)   {
260)     $salt = random_string(8);
261)     $newpass = crypt($newpass, "\$1\${$salt}\$");
262)   }
bernd sql-abfragen abstrahiert

bernd authored 16 years ago

263)   db_query("UPDATE system.passwoerter SET passwort='$newpass' WHERE uid='".$uid."' LIMIT 1");
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 17 years ago

265) }
266) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

267) 
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

268) function user_for_mailaccount($account) 
269) {
270)   $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account='{$account}' LIMIT 1;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

271)   if ($result->rowCount() != 1) {
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

272)     system_failure('Diese Adresse ist herrenlos?!');
273)   }
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

274)   $tmp = $result->fetch();
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

275)   return $tmp['uid'];
276) }
277) 
278) function user_for_vmail_account($account)
279) {
280)   $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)='{$account}' LIMIT 1;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

281)   if ($result->rowCount() != 1) {
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

282)     system_failure('Diese Adresse ist herrenlos?!');
283)   }
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

284)   $tmp = $result->fetch();
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

285)   return $tmp['useraccount'];
286) }
287) 
288) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

289) function setup_session($role, $useridentity)
290) {
291)   session_regenerate_id();
292)   $_SESSION['role'] = $role;
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

293)   if ($role & ROLE_SUBUSER)
294)   {
295)     DEBUG("We are a sub-user");
296)     $info = get_subuser_info($useridentity);
297)     $_SESSION['userinfo'] = $info;
Bernd Wurst Logikfehler: Subuser hatte...

Bernd Wurst authored 10 years ago

298)     $_SESSION['restrict_modules'] = explode(',', $info['modules']);
Bernd Wurst Subuser sollen nicht automa...

Bernd Wurst authored 10 years ago

299)     $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_SUBUSER;
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

300)     $_SESSION['subuser'] = $useridentity;
Bernd Wurst Subuser sollen nicht automa...

Bernd Wurst authored 10 years ago

301)     $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username='{$info['username']}'");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

302)     if ($entry = $data->fetch) {
Bernd Wurst Subuser sollen nicht automa...

Bernd Wurst authored 10 years ago

303)       if ($entry['kundenaccount'] == 1) {
304)         $customer = get_customer_info($_SESSION['userinfo']['username']);
305)         $_SESSION['customerinfo'] = $customer;
306)         $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_CUSTOMER | ROLE_SUBUSER;
307)       }
308)     }
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

309)     logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
310)   }
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

311)   if ($role & ROLE_SYSTEMUSER)
312)   {
313)     DEBUG("We are system user");
314)     $info = get_user_info($useridentity);
315)     $_SESSION['userinfo'] = $info;
bernd Logger mit Logleveln

bernd authored 14 years ago

316)     logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

317)     $useridentity = $info['customerno'];
318)   }
319)   if ($role & ROLE_CUSTOMER)
320)   {
321)     $info = get_customer_info($useridentity);
322)     $_SESSION['customerinfo'] = $info;
bernd Setze lastlogin nur bei Nic...

bernd authored 13 years ago

323)     if (!isset($_SESSION['admin_user'])) {
324)       set_customer_lastlogin($info['customerno']);
325)     }
bernd Logger mit Logleveln

bernd authored 14 years ago

326)     logger(LOG_INFO, "session/start", "login", "logged in customer no »{$info['customerno']}«");
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

327)   }
bernd Auch mailaccounts können si...

bernd authored 16 years ago

328)   if ($role & ROLE_MAILACCOUNT)
329)   {
330)     $id = $useridentity;
331)     if (! strstr($id, '@'))
bernd Mehr config-optionen und co...

bernd authored 14 years ago

332)       $id .= '@'.config('masterdomain');
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

333)     $uid = user_for_mailaccount($id);
bernd Auch mailaccounts können si...

bernd authored 16 years ago

334)     $_SESSION['mailaccount'] = $id;
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

335)     $_SESSION['userinfo'] = get_user_info($uid);
bernd Auch mailaccounts können si...

bernd authored 16 years ago

336)     DEBUG("We are mailaccount: {$_SESSION['mailaccount']}");
337)   }
bernd VMail-accounts können sich...

bernd authored 16 years ago

338)   if ($role & ROLE_VMAIL_ACCOUNT)
339)   {
340)     $id = $useridentity;
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

341)     $uid = user_for_vmail_account($id);
bernd VMail-accounts können sich...

bernd authored 16 years ago

342)     $_SESSION['mailaccount'] = $id;
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

343)     $_SESSION['userinfo'] = get_user_info($uid);
bernd VMail-accounts können sich...

bernd authored 16 years ago

344)     DEBUG("We are virtual mailaccount: {$_SESSION['mailaccount']}");
345)   }
bernd Auch mailaccounts können si...

bernd authored 16 years ago

346) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

347) }
348)