Afficher un message
Vieux 08/10/2007, 02h21   #1
Jack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut php redirect doesnt work

Hi,
I have a problem that I've been stuck on for while now.
Here is my code

<html>
<head>
<title>Login</title>
</head>
<body>
<h2>Login</h2>
<?php
if ( (isset($_POST['uname'])) && (isset($_POST['pass'])) ){
include '../dbConn.inc';
$uname = $_POST['uname'];
$pass = sha1($_POST['pass']);

$dbResult = mysql_query("select uid from users where
username='$uname' and password='$pass'", $dbh);
mysql_close($dbh);
if (mysql_num_rows($dbResult) < 1){
print "Invalid username or password.";
}else{
session_start();
$_SESSION['uid'] = mysql_result($dbResult, 0, 'uid');
header('Location: main.php');
}
}else{
?>
<form method="post" action="login.php">
<table border="0">
<tr>
<td>Username:</td>
<td><input type="text" name="uname" size="20"/></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" size="20"/></td>
</tr>
<tr>
<td><input type="submit" value="Submit" name="login"/></td>
</tr>
</table>

</form>

</body>
</html>
<?php
}
?>

For some reason, the page doesn't get redirected to main.php. Can
anyone me with this.

ps. there is no spaces after ?> at the bottom of the code.

Thanks

  Réponse avec citation
 
Page generated in 0,06189 seconds with 9 queries