function Login() { $username = trim($_REQUEST['username']); $password = trim($_REQUEST['password']); if (!CheckLoginInDB($username, $password)) { return false; } else { return true; } }
return false; } return true; } if (empty($_POST['username'])) { echo "UserName is empty!<br />"; header("Location: login-again.php"); return false; } if (empty($_POST['password'])) { $error_msg = "Password is empty!"; header("Location: login-again.php"); return false; } $username = trim($_POST['username']); $usrpass = trim($_POST['password']); $salt1 = "qm&h*"; $salt2 = "pg!@"; $password = hash('ripemd128', "{$salt1}{$usrpass}{$salt2}"); //$password = $usrpass; if (!CheckLoginInDB($username, $password)) { //$error_msg = "Wrong Password !!"; header("Location: login-again.php"); return false; } else { $cookieusr = $_POST['username']; setcookie('username', $cookieusr, time() + 36000); echo "You Have logged in succesfully !!"; header("Location: account.php"); } //mysql_close($con);
function Login($con) { if (!empty($_POST['username']) || !empty($_POST['password'])) { if (empty($_POST['username'])) { $_SESSION["error"] = "Please include a username!"; return false; } if (empty($_POST['password'])) { $_SESSION["error"] = "Please include a password!"; return false; } $username = trim($_POST['username']); $password = trim($_POST['password']); if (!CheckLoginInDB($username, $password, $con)) { return false; } session_start(); $_SESSION["username"] = $username; $_SESSION["success"] = "Logged In"; header('Location: LibraryMain.php'); return true; } }