<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="5; url=http://www.paint-zone.co.uk/post.php">
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<title>Paint-Zone</title>
</head>
<?php
$dbcnx = @mysql_connect('mysql.lcn.biz', 'myuser', 'mypass');
if (!$dbcnx) {
echo 'Unable to connect to the ' .
'database server at this time.' ;
exit();
}
// Select the database
if (!@mysql_select_db('paintzone')) {
exit('<p>Unable to locate the ' .
'database at this time.</p>');
}
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT password FROM login WHERE username ='$username'";
$result = mysql_query($query);
if (!$result)
{
echo 'Username or Password Incorrect';
}
else
{
$password = mysql_result($result, 0, 'password');
if ($password == $_POST['password'])
{
setcookie ("pzcookie", "you are logged in", time()+3600);
echo 'login success <br />';
echo 'attemtping to redirect <br />';
echo '<p>Click <a href=http://www.paint-zone.co.uk/post.php>here</a> if you do not wish to wait</p>';
}
else
{
echo 'login failed';
}
}
?>
</body>
</html>
Very simple, i've only just started this kind of thing you see 😉
but if you navigate to login.php
"Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 5 in /home/.sites/145/site327/web/login.php on line 49
login success
attemtping to redirect
Click here if you do not wish to wait"