function log_user($login_donne, $pass_donne) { // create session vars global $auto_restrict; if ($auto_restrict['login'] === $login_donne && $auto_restrict['pass'] === hash('sha512', $auto_restrict["salt"] . $pass_donne)) { $_SESSION['id_user'] = chiffre(id_user(), $auto_restrict['encryption_key']); $_SESSION['login'] = $auto_restrict['login']; $_SESSION['expire'] = time() + 60 * $auto_restrict['session_expiration_delay']; return true; } else { if ($login_donne != 'dis' && $pass_donne != 'connect') { add_banned_ip(); } } exit_redirect(); return false; }
<?php session_start(); require 'libs/funciones.php'; conectar(); if (md5($_POST['password']) != comprobar($_POST['user'])) { echo "Contraseña no válida.<br />"; } else { $id_user = id_user($_POST['user']); $_SESSION['user_logged'] = $id_user; echo "<script>parent.location.href=\"index.php\";</script>"; }
function log_user($login_donne, $pass_donne) { # create session vars $save = false; global $auto_restrict, $default_language; if (empty($default_language)) { $default_language = 'en'; } session_destroy(); session_start(); foreach ($auto_restrict['users'] as $key => $user) { if ($user['login'] === $login_donne && $user['pass'] === hash('sha512', $user["salt"] . $pass_donne)) { $_SESSION['id_user'] = chiffre(id_user(), $user['encryption_key']); $_SESSION['login'] = $user['login']; $_SESSION['expire'] = time() + 60 * $auto_restrict['session_expiration_delay']; $admin = first($auto_restrict['users']); $_SESSION['status'] = $user['status']; $_SESSION['language'] = $user['lang']; if ($save) { save_users(); } return true; } } if ($login_donne != 'dis' && $pass_donne != 'connect') { add_banned_ip(); } else { exit_redirect(); } return false; }
function log_user($login_donne, $pass_donne) { global $config; if ($config['login'] == $login_donne && $config['pass'] == hash('sha512', $config["salt"] . $pass_donne)) { inlog('<em class="ok">User ' . $login_donne . ' logged successfully</em>'); $_SESSION['id_user'] = Crypte(id_user(), $config['encryption_key']); $_SESSION['login'] = $config['login']; $_SESSION['expire'] = time() + 60 * $config['session_expiration_delay']; return true; } else { if ($login_donne != '' && $pass_donne != '') { inlog('<em class="warning">User tried to log</em>'); } exit_redirect(); return false; } }