header wont work...
Posted: Tue Jul 28, 2009 9:01 pm
Code: Select all
<?php
require ("config.php");
ob_start();
mysql_connect("$host", "$username", "$password")or die("Cannot connect to mysql host with the username & password.");
mysql_select_db("$db_name")or die("Cannot access that database");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
// encrypt password
$encrypted_mypassword=md5($mypassword);
$sql="SELECT * FROM $logintbl_name WHERE username='$myusername' and password='$encrypted_mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == "1"){
// Register $myusername, $mypassword and redirect to members area
session_register("$myusername");
session_register("$mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>it will change the variable to 1, but doesnt load login_success.php... whats the deal??Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at checklogin.php:2) in checklogin.php on line 34
Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at checklogin.php:2) in checklogin.php on line 34
Warning: Cannot modify header information - headers already sent by (output started at checklogin.php:2) in checklogin.php on line 36