i m trying to redirect to attempt page if user fills incorrect information... on the other hand if attempt page got refreshed want it to be redirected on login page... i m using session for that...
if (isset($c))
{
$q = mysql_query("select * from registeration where email='$a' and password='$b'");
$r = mysql_num_rows($q);
if($r)
{
$_SESSION["Authenticated"] = 1;
$_SESSION['id'] = $a;
}
else
{
$_SESSION["Authenticated"] = 0;
$_SESSION["att"] = 1;
}
if(isset($_SESSION["att"]))
{
header("location:attempt1.php");
}
else
{
session_write_close();
header('location:profile.php');
}
}
the above mentioned code is redirecting on attempt1.php but code on attempt1.php redirecting back to index.php
session_start();
if (!isset($_SESSION["att"]))
{
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";
}
i want attempt1.php code to redirect on user on index.php if session is not set.. and destroy session on refresh or direct page load... so that direct access to this page results in redirection to index page please help friends..
ANSWER ANSWER ANSWER all the questions i asked i made silly mistakes... here in this question i had not started session wile storing session variables.... add the below code in first line of login script
session_start();