function login() { global $c, $msg; if (hash('sha512', $_POST['password'] . 'loli') != $c['password']) { $msg = 'Wrong password'; return; } if ($_POST['new']) { savePassword($_POST['new']); $msg = 'Password changed'; return; } $_SESSION['l'] = $c['password']; header('Location: ./'); exit; }
if (isset($newPassword1) && isset($newPassword2)) { if ($newPassword1 != "" && $newPassword2 != "") { // They are trying to update their password. if ($newPassword1 != $newPassword2) { throw new Exception('The passwords you entered do not match - please go back and try again.'); } debug($debugIt, "---Update Password!"); $updatePassword = true; } } if ($updateUser) { debug($debugIt, "---Updating User"); saveUser($user, $oldEmail); $_SESSION['current_user'] = $user; } if ($updatePassword) { debug($debugIt, "---Updating Password of " . $user->getEmail() . " to " . $newPassword1); savePassword($user->getEmail(), $newPassword1); } if ($updateUser) { header("Location: /profile_updated.php"); } else { if ($updatePassword) { header("Location: /profile_updated.php"); } else { header("Location: /index.php"); } } } catch (Exception $e) { echo $e->getMessage(); }
function login() { global $c, $msg; if (md5($_POST['password']) != $c['password']) { $msg = 'wrong password'; return; } if ($_POST['new']) { savePassword($_POST['new']); $msg = 'password changed'; return; } $_SESSION['l'] = $c['password']; header('Location: ./'); exit; }