|
262 | 262 | $app->plugin->raiseEvent('login', $username); |
263 | 263 |
|
264 | 264 | //* Save successfull login message to var |
265 | | - $authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s') . ' with session ID ' .session_id(); |
| 265 | + //$authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s'); |
| 266 | + $authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s') . ' with session ID ' .session_id(); |
266 | 267 | $authlog_handle = fopen($conf['ispconfig_log_dir'].'/auth.log', 'a'); |
267 | 268 | fwrite($authlog_handle, $authlog ."\n"); |
268 | 269 | fclose($authlog_handle); |
269 | | - |
270 | | - // get last IP used to login |
271 | | - $user_data = $app->db->queryOneRecord("SELECT last_login_ip,last_login_at FROM sys_user WHERE username = ?", $username); |
272 | | - |
273 | | - $_SESSION['s']['last_login_ip'] = $user_data['last_login_ip']; |
274 | | - $_SESSION['s']['last_login_at'] = $user_data['last_login_at']; |
275 | | - if(!$loginAs) { |
276 | | - $app->db->query("UPDATE sys_user SET last_login_ip = ?, last_login_at = ? WHERE username = ?", $_SERVER['REMOTE_ADDR'], time(), $username); |
277 | | - } |
| 270 | + $app->db->query("INSERT INTO sys_login (`session_id`, `username`, `ip`, `login-time`) VALUES (?, ?, ?, CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE `login-time`=CURRENT_TIMESTAMP", session_id(), $username, $_SERVER['REMOTE_ADDR']); |
278 | 271 | /* |
279 | 272 | * We need LOGIN_REDIRECT instead of HEADER_REDIRECT to load the |
280 | 273 | * new theme, if the logged-in user has another |
281 | 274 | */ |
282 | 275 |
|
283 | | - if($loginAs) { |
| 276 | + if ($loginAs){ |
284 | 277 | echo 'LOGIN_REDIRECT:'.$_SESSION['s']['module']['startpage']; |
285 | 278 | exit; |
286 | 279 | } else { |
|
292 | 285 | $error = $app->lng('error_user_blocked'); |
293 | 286 | } |
294 | 287 | } else { |
295 | | - if(!$alreadyfailed['times']) { |
| 288 | + if(!$alreadyfailed['times'] ) |
| 289 | + { |
296 | 290 | //* user login the first time wrong |
297 | 291 | $sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES (?, 1, NOW())"; |
298 | 292 | $app->db->query($sql, $ip); |
|
351 | 345 | //die(isset($_SESSION['s']['theme']) ? $_SESSION['s']['theme'] : 'default'); |
352 | 346 |
|
353 | 347 | // Logo |
354 | | -$logo = $app->db->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1"); |
355 | | -if($logo['custom_logo'] != ''){ |
356 | | - $base64_logo_txt = $logo['custom_logo']; |
357 | | -} else { |
358 | | - $base64_logo_txt = $logo['default_logo']; |
359 | | -} |
360 | | -$tmp_base64 = explode(',', $base64_logo_txt, 2); |
361 | | -$logo_dimensions = $app->functions->getimagesizefromstring(base64_decode($tmp_base64[1])); |
362 | | -$app->tpl->setVar('base64_logo_width', $logo_dimensions[0].'px'); |
363 | | -$app->tpl->setVar('base64_logo_height', $logo_dimensions[1].'px'); |
364 | | -$app->tpl->setVar('base64_logo_txt', $base64_logo_txt); |
| 348 | +$app->tpl->logo(); |
365 | 349 |
|
366 | 350 | // Title |
367 | 351 | if (!empty($sys_config['company_name'])) { |
|
0 commit comments