a4247c64b1a2f9238a5a84a72ceeda3fafb8b414
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 Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 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) {
35)   // Domain-Admin?  <not implemented>
36)   // System-User?
37)   $uid = (int) $login;
38)   if ($uid == 0)
Bernd Wurst String 'NULL' eliminiert

Bernd Wurst authored 10 years ago

39)     $uid = NULL;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

40)   $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

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

bernd authored 17 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

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

bernd authored 12 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 15 years ago

63)   } else {
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 17 years ago

65)   }
66) 
67)   // Customer?
68)   $customerno = (int) $login;
69)   $pass = sha1($password);
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

70)   $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

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

Bernd Wurst authored 10 years ago

72)     $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

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

bernd authored 17 years ago

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

Bernd Wurst authored 11 years ago

78)   // Sub-User
79) 
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

80)   $result = db_query("SELECT password FROM system.subusers WHERE username=?", array($login));
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 11 years ago

107)         die();
108)       } else {
109)         return NULL;
110)       }
111)     }
112)   }
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

113)   $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

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

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

bernd authored 16 years ago

127)   // virtueller Mail-Account
128)   $account = $login;
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

129)   $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

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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)   }
142)   
bernd Auch mailaccounts können si...

bernd authored 16 years ago

143) 
144) 
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

151) {
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

155)   $customerno = (int) $customer;
156)   if ($customerno != 0)
157)   {
158)     DEBUG('Looking up customerinfo for customer no. '.$customerno);
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

159)     $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

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

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

165)     $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

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

Bernd Wurst authored 10 years ago

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

bernd authored 17 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

181) function get_subuser_info($username)
182) {
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

183)   $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

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

196) function get_user_info($username)
197) {
bernd IPv6-Option nur anzeigen we...

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

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

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

bernd authored 16 years ago

201)   {
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 16 years ago

227) }
228) 
bernd webinterface => /webinterface

bernd authored 17 years ago

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

Bernd Wurst authored 10 years ago

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

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

239)   $args = array(":subuser" => $subuser,
240)                 ":uid" => (int) $_SESSION['userinfo']['uid'],
241)                 ":newpass" => sha1($newpass));
242)   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

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

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

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

bernd authored 17 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

268)   $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

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

278)   $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

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

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

Bernd Wurst authored 10 years ago

299)     $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", array($info['username']));
Bernd Wurst Modul subusers auf prepared...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

344) 
bernd * Initialisierung der Sessi...

bernd authored 16 years ago

345) }
346)