Forum Moderators: coopster

Message Too Old, No Replies

login on localhost

         

ayushchd

10:57 am on Jul 28, 2007 (gmt 0)

10+ Year Member



i have the following code for the login section of my website which when on the server works fine...bt when on localhost does not work fine :
Login Section.
$Login=$_POST['Login'];
if($Login){ // If clicked on Login button.

// Check matching of username and password.
$result=mysql_query("select * from users where username='$username' and password='$password'");
if(mysql_num_rows($result)!='0'){ // If match.
setcookie("user", $username, $time+3600);
session_register("password");
header("location:main.php"); // Re-direct to main.php
exit;
}else{ // If not match.
$message="--- Incorrect Username or Password ---";
}

} // End Login

The error it says is ::

Notice: Undefined index: action in C:\Program Files\Apache Group\Apache2\htdocs\virtual\index.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\virtual\index.php:19) in C:\Program Files\Apache Group\Apache2\htdocs\virtual\index.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\virtual\index.php:19) in C:\Program Files\Apache Group\Apache2\htdocs\virtual\index.php on line 104

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

Habtom

8:23 pm on Jul 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Place session_start(); at the top of your page.

The header is sent error is due to the displayed error, if you solve the first error, those messages following will disappear.