I have designed this login system but been stuck on this issue forever. basicly the page loads up then if the user submits a password and database it checks it and sets a session accordingly. if the password and user name is right but then it should redirect to my peronal area but it just redirects to same page again. its and extenstion from my last thread and the code is a bit long but i have tried to take most bits out.
<?php[code=php]
session_start();
include "conn.php";
if (isset($_POST['submit']))
{
$user_name =$_POST['E-mail'];
$passw = $_POST['password'];
$query ='SELECT `Email` '
. ' FROM `user_info` '
. ' WHERE `Email` = "'.$user_name.'" AND `password` = "'.$passw.'" LIMIT 0, 30';
$result = mysql_query($query) or die(mysql_error());
$temp =mysql_num_rows($result);
if (mysql_num_rows($result) == 1)
{
$_SESSION['user_logged'] = $_POST['E-mail'];
$_SESSION['user_password'] = $_POST['password'];
header ("Refresh: 5; URL=" . $_POST['redirect'] . "");
echo "You are being redirected to your login area!</br>";
echo "(If your browser doesn't support this, <a href=\"" .
$_POST['redirect']. "\">click here</a>)";
}
else
{
?>
<html>
<head>
<title>www.greybooks.com- invalid password</title>
<script language="javascript" type="" src="js/top.js"></script>
<link rel="stylesheet" type="text/css" href="css/top.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<link rel="stylesheet" type="text/css" href="css/search.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<img src="/Images/Logos/Logo2.jpg" alt="www.Greybooks.com"
this is the invalid login area
<form action="user_login.php" method="post" class="center" >
<label class="lab">E-mail : </label>
<input type="text" name="E-mail" call="passwordInputBox" value="" /></br>
<p>
<label class="lab"> Password :</label>
<input type="password" name="password" class="usernameInputBox" /></br>
<input type="submit" value="go"/></p>
</form>
</body>
</html>
<?php
}
}
else
{
if($_SERVER['HTTP_REFERRER'] =="" || $_SERVER['HTTP_REFERRER'] =="http:/localhost/index.php")
{
$redirect ="index.php";
}
else
{
$redirect =$_GET['redirect'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>www.greybooks.com-home</title>
<script language="javascript" type="" src="js/top.js"></script>
<link rel="stylesheet" type="text/css" href="css/top.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<link rel="stylesheet" type="text/css" href="css/search.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<img src="Images/Logos/Logo1.jpg" alt="www.Greybooks.com" class="Logo" />
Default area
<form action="user_login.php" method="post">
<p>E-Mail</br>
<input type="text" name="E-mail" value="" id="usernameInputBox"></br>
</p>
<p> password</br>
<input type="password" name="password" value="" id="passwordInputBox">
<img src="Images/rightarrowsmall.gif" alt="right arrow in a box">
<input name="submit" type="submit" id="submitLogin" value="go">
</p>
<p> </p>
</form></div>
<p>
<img src="Images/rightarrowsmall.gif" alt="right arrow in a box"><a href="forgotten.html" class="forgotten">
Forgotten your</a>
</body>
</html>
<?php
}
?>
can some one help me fix this issue the code for my index page is below
<?php
session_start();
if($_SESSION['user_logged'] == "" || $_SESSION['user_password'] == "")
{
include "user_login.php";
}
else
{
include "user_perosnal.php";
}
?>