Probably a stupid question, but whenever there is an error with a login or registration, I would like to provide a link to go back to rectify the problem. At the moment, for example, when someone does not enter a password to log in, I get a new screen which just says please enter the password. There is no link to go back to the login screen.
Is there a way to do this? I would also like to change the font of the error message to Century Gothic.
Here is my login code:
[php]
<? ob_start(); require_once($_SERVER['DOCUMENT_ROOT'].'/database.php'); if(isset($_SESSION['username']) && isset($_SESSION['password'])) { //REDIRECT TO USERS PROFILE... header("Location: http://www.infinite-monkey.co.uk"); } //end if logged in //IF SUBMIT BUTTON PRESSED if(isset($_POST['submit'])) { if(!$_POST['username']) die("You must enter your username before logging in."); if(!$_POST['password']) die("You must enter your password before logging in."); //set cookie if checked if(!empty($_POST['stay_in'])) { $joined =''.$_POST['username'].'[]'.md5($_POST['password']).''; setcookie('login_cookie', $joined, 2147483647, '/', '.www.infinite-monkey.co.uk'); } //end if //verify user... $get_user = mysql_query("SELECT * FROM `members` WHERE username = '".$_POST['username']."' AND user_password = '".md5($_POST['password'])."'"); $q = mysql_fetch_object($get_user); if(!$q) die("Username or password is incorrect. Please try again."); //set session variables $_SESSION['logged_in'] = 1; $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; session_write_close(); header("Location: http://www.infinite-monkey.co.uk"); } else { //show login form ?>
Username:
|
Password:
|
|
Remember Me? |
Thanks!