Hye I have this script:
<?php
//The login form
$loginform = "<form name=\"form1\" method=\"post\" action=\"$PHP_SELF\">";
$loginform .="<p>Username:";
$loginform .="<input name=\"username\" type=\"text\" id=\"username\">";
$loginform .="</p>";
$loginform .="<p>Password:";
$loginform .="<input name=\"password\" type=\"password\" id=\"password2\">";
$loginform .="</p>";
$loginform .="<p>";
$loginform .="<input name=\"login\" type=\"submit\" id=\"login\" value=\"Login\">";
$loginform .="</p>";
$loginform .="</form>";
$loginform .="<p></p>";
//Checks if you are alreayd logged in
if($sessionlogged==yes) {print "<b>You are already logged in as $sessionusername!</b>";}
//Otherwise it prints the login script
else
{
print "$loginform";
//Checks if username field is blank and if it is displays a message
$userpass=NULL;
if ($username == NULL)
{
if ($usernameblank==1) {echo ("<p><font color=white>Please input your username</font></p>");}
session_register("usernameblank");
$usernameblank=1;
}
//Checks if password field is blank and if it is deisplays a message
if ($password == NULL)
{
if ($passwordblank==1) {echo ("<p><font color=white>Please input your password</font></p>");}
session_register("passwordblank");
$passwordblank=1;
}
//Registers the username and password into the session
session_register( "sessionusername" );
$sessionusername= "$username";
session_register( "sessionpassword" );
$sessionpassword= "$password";
// MySql Login
$mysqluser=nacd7152;
$domain=localhost;
$mysqlpass=mitchell;
$conn=@mysql_connect($domain, $mysqluser, $mysqlpass)
or die("Sorry Please Press The Back Button On Your Brwoser & Try Again");
//Select database
$database=DB_nacd7152;
$selectdb=@mysql_select_db($database, $conn)
or die("Sorry Please Press The Back Button On Your Brwoser & Try Again");
// Member Login
$checkuserpass=mysql_query("select * from outwarinfo where username=\"$sessionusername\" and password=\"$sessionpassword\" ");
$found=mysql_num_rows($checkuserpass);
//Checks if the matching record is found
if($found == "1") { $loggedoutlink=yes; }
//If it isn't it displays a message
else {
if (secondattempt==1) {print "Sorry wrong login";}
else {secondattempt==1;}
}
/* If the username and password was correct it adds sessionlogged as 'yes' if the password was wrong it
adds the sessionlogged as 'NULL' */
session_register("sessionlogged");
$sessionlogged= "$loggedoutlink";
}
?>
and I want to make it redirect when it sets sessionlogged=yes any ideas on how I would do this?
Help would be appreciated