Reply to php redirect doesnt work

Your name:

Reply:


Posted by Jack on 10/08/07 01:21

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 help me with this.

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

Thanks

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация