Hey guys
I've been writing this login code and ive been having some minor problems i dunno what seemds to be the problem ive tried everything :s
Here's the html part of the login, the username and pass are sent by post to login.php below to compare with the ones in the database
<form method="POST" action="login.php">
Username : <input type="text" name="username">
Password : <input type="password" name="password">
<input type="submit" value="Login">
</form>
$connect=mysql_connect("localhost","swcri_tarakji","xxxxxxxxxx");
mysql_select_db("swcri_working",$connect) or die (mysql_errno().":<b> ".mysql_error()."</b>");
$select_user =
mysql_query('select * from users where username = "' .
$_POST['username'] . '" and password = "' .
md5($_POST['password'] . '"'));
if (mysql_num_rows($select_user) != 0)
{
session_start();
session_register('authorized');
$_SESSION['authorized'] = true;
header("Location: protected.php");
exit;
}
else
{
header("Location: login_form.php");
exit;
}
i get the following errors when i try to login :
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/swcri/public_html/working/login.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at /home/swcri/public_html/working/login.php:10) in /home/swcri/public_html/working/login.php on line 30
Pleaassseee help me