How and where can I add a 'go back' link in the code?
mysql_connect($server,$dbuser,$dbpass) or die ("<font size=8.4pt face=verdana color=#666666>Could not establish connection</font>"); // make connection
mysql_select_db($dbname); // select database
// convert posted info to easy to use variables
$user = $_REQUEST['username'];
$pass = $_REQUEST['password'];
// strip away any dangerous tags
$user=strip_tags($user);
$pass=strip_tags($pass);
// remove spaces from variables
$user=str_replace(" ","",$user);
$pass=str_replace(" ","",$pass);
// remove escaped spaces
$user=str_replace("%20","",$user);
$pass=str_replace("%20","",$pass);
// add slashes to stop hacking
$user=addslashes($user);
$pass=addslashes($pass);
// encrypt password into md5 (random 32 characters)
$pass=md5($pass);
// search database to check for user
$request = "SELECT * FROM users WHERE password='".$pass."' AND username='".$user."'";
// hand over the request
$results = mysql_query($request);
// if mysql returns any number of rows great than 0 then there is a succesful login
if(mysql_num_rows($results))
{
// get users id
$getid = "SELECT * FROM users WHERE username='".$user."' LIMIT 1";
$getidexec = mysql_query($getid);
while($r=mysql_fetch_array($getidexec)){
$userid = $r[userid];
}
// set a cookie
setcookie( "userid", "$userid", time()+3600, "/", "", 0 );
echo "<font size=8.4pt face=verdana color=#666666>You are logged in.<br><br><a href=\"index.php\">click here to continue</font>";
}
else // only happens if not a succesful username and password match
{
// login failed so display error message and kill script
die("<font size=8.4pt face=verdana color=#666666>Username and password combination are incorrect</font>");
}
?>