Forum Moderators: coopster
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php:12) in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php:12) in E:\Apache Group\Apache2\htdocs\testing\Authorize\login\login_auth.php on line 15
this is the code i have right now (it's not completed yet) and lines 14 and 15, are the cookie and headers
<? include ("../admin/config.php");
//checks to see if cookie is set
if (!isset ($_COOKIE["dhananscookie"]))
{
mysql_connect($host ,$user,$pass) or die("Unable to connect to database");
mysql_select_db("$db") or die("Unable to select database $db");
// Formulate the query
$sql = "SELECT * FROM $utable WHERE username='" . $username . "' AND user_password = '" . md5($password) . "' AND user_active = '" . 1 . "'";
// Execute the query and put results in $result
$result = mysql_query($sql);
// Get number of rows in $result. 0 if invalid, 1 if valid.
$num = mysql_num_rows($result);
if ($num!= "0") {
setcookie("testcookie", $username, time()+86400);
header ("../logout_form.php");
exit;
}
}
?>
There are some tips in the PHP Troubleshooting [webmasterworld.com] thread showing how you can use this directive.