8132c40e4814317f84ba2e42ac2e87485ddd9a47
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 * Weitere Module auf prepar...

Bernd Wurst authored 10 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;", array(":uid" => $uid, ":login" => $login));
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 Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

72)   if ($i_am_admin)
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

73)     $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=?", array($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) 
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

81)   $result = db_query("SELECT password FROM system.subusers WHERE username=?", array($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 Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

114)   $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account=?", array($account));
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;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

130)   $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account=?", array($account));
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 Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 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=?", array($customerno));
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

161)   }
162)   else
163)   {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

165)     DEBUG('looking up customer info for username '.$username);
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 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=?", array($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) {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

184)   $result = db_query("SELECT uid, modules FROM system.subusers WHERE username=?", array($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 IPv6-Option nur anzeigen we...

bernd authored 13 years ago

199)   $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

200)                       FROM system.v_useraccounts WHERE username=:username OR uid=:username", array(":username" => $username));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

202)   {
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

217) function set_customer_verified($customerno)
218) {
219)   $customerno = (int) $customerno;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

220)   db_query("UPDATE kundendaten.kunden SET status=0 WHERE id=?", array($customerno));
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 16 years ago

222) }
223) 
224) function set_customer_lastlogin($customerno)
225) {
226)   $customerno = (int) $customerno;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

228) }
229) 
bernd webinterface => /webinterface

bernd authored 17 years ago

230) function set_customer_password($customerno, $newpass)
231) {
232)   $customerno = (int) $customerno;
233)   $newpass = sha1($newpass);
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

234)   db_query("UPDATE kundendaten.kunden SET passwort=:newpass WHERE id=:customerno", array(":newpass" => $newpass, ":customerno" => $customerno));
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 13 years ago

236) }
237) 
238) function set_subuser_password($subuser, $newpass)
239) {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

240)   $args = array(":subuser" => $subuser,
241)                 ":uid" => (int) $_SESSION['userinfo']['uid'],
242)                 ":newpass" => sha1($newpass));
243)   db_query("UPDATE system.subusers SET password=:newpass WHERE username=:subuser AND uid=:uid", $args);
bernd Passwort-Ändern geht jetzt...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 14 years ago

251)   if (defined("CRYPT_SHA512") && CRYPT_SHA512 == 1)
252)   {
253)     $rounds = rand(1000, 5000);
254)     $salt = "rounds=".$rounds."$".random_string(8);
255)     $newpass = crypt($newpass, "\$6\${$salt}\$");
256)   }
257)   else
258)   {
259)     $salt = random_string(8);
260)     $newpass = crypt($newpass, "\$1\${$salt}\$");
261)   }
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

262)   db_query("UPDATE system.passwoerter SET passwort=:newpass WHERE uid=:uid", array(":newpass" => $newpass, ":uid" => $uid));
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

267) function user_for_mailaccount($account) 
268) {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

269)   $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account=?", array($account));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

274)   return $tmp['uid'];
275) }
276) 
277) function user_for_vmail_account($account)
278) {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

279)   $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)=?", array($account));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

299)     $_SESSION['subuser'] = $useridentity;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

300)     $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", array($info['username']));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

345) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

346) }
347)