Page 1 of 2

can anybody help me understand this?

Posted: Sun Feb 15, 2004 12:35 pm
by crazytopu
i got this code online and tried it:

Code: Select all

<?php 
    /* database connect script. */ 
    require 'db_connect.php'; 
    if($logged_in == 1) 
    &#123; 
        die('You are already logged in,<b> '.$_SESSION&#1111;'username'].'</b>. Go back <a href = "template2.php">HOME</a>.');
         
    &#125; 
    if (isset($_POST&#1111;'submit'])) 
    &#123;    // if form has been submitted 
        /* check they filled in what they were supposed to and authenticate */ 
        if(!$_POST&#1111;'uname'] | !$_POST&#1111;'passwd']) 
        &#123; 
            die('You did not fill in a required field.'); 
        &#125; 
        // authenticate. 
        if (!get_magic_quotes_gpc()) 
        &#123; 
            $_POST&#1111;'uname'] = addslashes($_POST&#1111;'uname']); 
        &#125; 
        $check = "SELECT username, password FROM users WHERE username = '".$_POST&#1111;'uname']."'"; 
        $result = mysql_query($check); 
        $num_rows = mysql_num_rows($result); 
     
        if (!($num_rows))         
        &#123; 
            die('That username does not exist in our database.'); 
        &#125; 
        $info = mysql_fetch_Array($result); 
     
        // check passwords match 
        $_POST&#1111;'passwd'] = stripslashes($_POST&#1111;'passwd']); 
        $info&#1111;'password'] = stripslashes($info&#1111;'password']); 
        $_POST&#1111;'passwd'] = md5($_POST&#1111;'passwd']); 
        if ($_POST&#1111;'passwd'] != $info&#1111;'password']) 
        &#123; 
            die('Incorrect password, please try again.'); 
        &#125; 
        /* if we get here username and password are correct, 
        register session variables and set last login time.*/ 
        $date = date('m d, Y'); 
        $update_login = mysql_query("UPDATE users SET last_login = '$date' WHERE username = '".$_POST&#1111;'uname']."'"); 
        $_POST&#1111;'uname'] = stripslashes($_POST&#1111;'uname']); 
        $_SESSION&#1111;'username'] = $_POST&#1111;'uname']; 
        $_SESSION&#1111;'password'] = $_POST&#1111;'passwd']; 
// Remember Me cookie will be set after successful login 
if (isset($_POST&#1111;'remember_me'])) &#123; 
  $time_expire = time()+31536000; 
  setcookie("uname", $_POST&#1111;'uname'], $time_expire); 
  setcookie("passwd", md5($_POST&#1111;'passwd']), $time_expire); 
  &#125; 
?>
<?php
header("Location: template2.php");
?>
<?php 
    &#125; 
    else 
    &#123;    // if form hasn't been submitted 
?> 
<html> 
<head> 
<title>Login</title> 
</head> 
<body> 
        <!-- This is the first screen when a user sees when he is not logged in --> 
        <form action="<?php echo $_SERVER&#1111;'PHP_SELF']?>?var=login" method="post"> 
        <center> 
        <table width="250" border="1" cellspacing="0" cellpadding="4" bordercolor="#000000" bordercolordark="#000000" bordercolorlight="#000000" bgcolor="#FFFFFF" style="border-collapse: collapse"> 
        <tr> 
        <td class="updatecontent"><center>         
        <form action="<?php echo $_SERVER&#1111;'PHP_SELF']?>" method="post"> 
        Username<br> 
        <input type="text" name="uname" maxlength="40"><br><br> 
        Password<br> 
        <input type="password" name="passwd" maxlength="50"> 
        </center> 
        </td></tr> 
        <tr><td class="updatefooter"> 
        <input type="Checkbox" name="Remember_Me"> Remember Me<br>                      
<input type="submit" name="submit" value="Login"> 
        </td></tr> 
        </table> 
        </form>
<?php 
    &#125; 
?> 
</body> 
</html>
But i got this error messege:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\db_connect.php:26) in c:\program files\apache group\apache\htdocs\login.php on line 54

I have no clue what is this warning trying to say...can anybody tell me a bit where to look at in the code and what to correct?


And one general question about correction...when it says..
error on line n [54]
..how do you quickly find which is the 54th line when u use notepad?

thanks

Posted: Sun Feb 15, 2004 12:43 pm
by qads
head error means you are outputing something before the header() call, try this code:

Code: Select all

<?php
/* database connect script. */ 
require 'db_connect.php'; 
if($logged_in == 1) 
{ 
die('You are already logged in,<b> '.$_SESSION['username'].'</b>. Go back <a href = "template2.php">HOME</a>.'); 
          
} 
if (isset($_POST['submit'])) 
{
// if form has been submitted 
/* check they filled in what they were supposed to and authenticate */ 
if(!$_POST['uname'] | !$_POST['passwd']) 
{ 
die('You did not fill in a required field.'); 
} 
// authenticate. 
if (!get_magic_quotes_gpc()) 
{ 
$_POST['uname'] = addslashes($_POST['uname']); 
} 
$check = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."'"; 
$result = mysql_query($check); 
$num_rows = mysql_num_rows($result); 
if (!($num_rows))          
{ 
die('That username does not exist in our database.'); 
} 
$info = mysql_fetch_Array($result); 
// check passwords match 
$_POST['passwd'] = stripslashes($_POST['passwd']); 
$info['password'] = stripslashes($info['password']); 
$_POST['passwd'] = md5($_POST['passwd']); 
if ($_POST['passwd'] != $info['password']) 
{ 
die('Incorrect password, please try again.'); 
} 
/* if we get here username and password are correct, 
register session variables and set last login time.*/ 
$date = date('m d, Y'); 
$update_login = mysql_query("UPDATE users SET last_login = '$date' WHERE username = '".$_POST['uname']."'"); 
$_POST['uname'] = stripslashes($_POST['uname']); 
$_SESSION['username'] = $_POST['uname']; 
$_SESSION['password'] = $_POST['passwd']; 
// Remember Me cookie will be set after successful login 
if (isset($_POST['remember_me'])) { 
$time_expire = time()+31536000; 
setcookie("uname", $_POST['uname'], $time_expire); 
setcookie("passwd", md5($_POST['passwd']), $time_expire); 
} 
header("Location: template2.php"); 
} 
else 
{
// if form hasn't been submitted 
?> 
<html> 
<head> 
<title>Login</title> 
</head> 
<body> 
        <!-- This is the first screen when a user sees when he is not logged in --> 
        <form action="<?php echo $_SERVER['PHP_SELF']?>?var=login" method="post"> 
        <center> 
        <table width="250" border="1" cellspacing="0" cellpadding="4" bordercolor="#000000" bordercolordark="#000000" bordercolorlight="#000000" bgcolor="#FFFFFF" style="border-collapse: collapse"> 
        <tr> 
        <td class="updatecontent"><center>          
        <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> 
        Username<br> 
        <input type="text" name="uname" maxlength="40"><br><br> 
        Password<br> 
        <input type="password" name="passwd" maxlength="50"> 
        </center> 
        </td></tr> 
        <tr><td class="updatefooter"> 
        <input type="Checkbox" name="Remember_Me"> Remember Me<br>                      
<input type="submit" name="submit" value="Login"> 
        </td></tr> 
        </table> 
        </form> 
<?php 
} 
?> 
</body> 
</html>
?>
dont use notepad if you want line numbers, can use dreamwaver, phpedit or someother php editor.

Posted: Sun Feb 15, 2004 12:43 pm
by JAM
Actually...

Code: Select all

...(output started at c:\program files\apache group\apache\htdocs\db_connect.php:26)...
would be more interesting in this case.
I think that when you include that file, it outputs something (line 26?), so check that file first.

About finding line-numbers... I'm not sure that there is an easy way to do that in norepad. Without going to much into "what editor is the best" discussions, I'm using UltraEdit on my win32 platform for editing. It has a "GOTO Line X" function that I use...

Posted: Mon Feb 16, 2004 12:13 pm
by crazytopu
hi qads,

I am yet to solve it..i tried your code but still getting this warning msg:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\db_connect.php:26) in c:\program files\apache group\apache\htdocs\login.php on line 51
?>
what to do?

Posted: Mon Feb 16, 2004 12:14 pm
by malcolmboston
is there anything in dbconnection.php that shouldnt be there?

Posted: Mon Feb 16, 2004 12:19 pm
by crazytopu
hi malcom,

this is my db_connect.php file:

Code: Select all

<?php
        

  $db_user = 'root'; 
  $db_pass = ''; 
  $db_host = 'localhost'; //Usually "localhost" 
  $db_name = 'library'; 

  $con = mysql_connect($db_host, $db_user, $db_pass) 
or die ("Cannot connect to MySQL.");	
//or die(mysql_error()); 
  

  mysql_select_db($db_name) 
	or die(mysql_error()); 
		
        
	//include('check_login.php');


?>
I am just yet to figure out what is my check_login.php file doing here..in the originial code i got it uncommented but if i leave it uncommented i can't log on to my DB.

Posted: Mon Feb 16, 2004 12:20 pm
by malcolmboston
lol, you know what im goin to ask now

show us you checklogin.php while i have a better look at the other pages

Posted: Mon Feb 16, 2004 12:21 pm
by malcolmboston
and i wish people would start syntax highlighting when posting!!!

no change just making it easier to read

Code: Select all

<?php 
    /* database connect script. */ 
    require 'db_connect.php'; 
    if($logged_in == 1) 
    { 
        die('You are already logged in,<b> '.$_SESSION['username'].'</b>. Go back <a href = "template2.php">HOME</a>.'); 
          
    } 
    if (isset($_POST['submit'])) 
    {    // if form has been submitted 
        /* check they filled in what they were supposed to and authenticate */ 
        if(!$_POST['uname'] | !$_POST['passwd']) 
        { 
            die('You did not fill in a required field.'); 
        } 
        // authenticate. 
        if (!get_magic_quotes_gpc()) 
        { 
            $_POST['uname'] = addslashes($_POST['uname']); 
        } 
        $check = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."'"; 
        $result = mysql_query($check); 
        $num_rows = mysql_num_rows($result); 
      
        if (!($num_rows))          
        { 
            die('That username does not exist in our database.'); 
        } 
        $info = mysql_fetch_Array($result); 
      
        // check passwords match 
        $_POST['passwd'] = stripslashes($_POST['passwd']); 
        $info['password'] = stripslashes($info['password']); 
        $_POST['passwd'] = md5($_POST['passwd']); 
        if ($_POST['passwd'] != $info['password']) 
        { 
            die('Incorrect password, please try again.'); 
        } 
        /* if we get here username and password are correct, 
        register session variables and set last login time.*/ 
        $date = date('m d, Y'); 
        $update_login = mysql_query("UPDATE users SET last_login = '$date' WHERE username = '".$_POST['uname']."'"); 
        $_POST['uname'] = stripslashes($_POST['uname']); 
        $_SESSION['username'] = $_POST['uname']; 
        $_SESSION['password'] = $_POST['passwd']; 
// Remember Me cookie will be set after successful login 
if (isset($_POST['remember_me'])) { 
  $time_expire = time()+31536000; 
  setcookie("uname", $_POST['uname'], $time_expire); 
  setcookie("passwd", md5($_POST['passwd']), $time_expire); 
  } 
?> 
<?php 
header("Location: template2.php"); 
?> 
<?php 
    } 
    else 
    {    // if form hasn't been submitted 
?> 
<html> 
<head> 
<title>Login</title> 
</head> 
<body> 
        <!-- This is the first screen when a user sees when he is not logged in --> 
        <form action="<?php echo $_SERVER['PHP_SELF']?>?var=login" method="post"> 
        <center> 
        <table width="250" border="1" cellspacing="0" cellpadding="4" bordercolor="#000000" bordercolordark="#000000" bordercolorlight="#000000" bgcolor="#FFFFFF" style="border-collapse: collapse"> 
        <tr> 
        <td class="updatecontent"><center>          
        <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> 
        Username<br> 
        <input type="text" name="uname" maxlength="40"><br><br> 
        Password<br> 
        <input type="password" name="passwd" maxlength="50"> 
        </center> 
        </td></tr> 
        <tr><td class="updatefooter"> 
        <input type="Checkbox" name="Remember_Me"> Remember Me<br>                      
<input type="submit" name="submit" value="Login"> 
        </td></tr> 
        </table> 
        </form> 
<?php 
    } 
?> 
</body> 
</html>
out of interest add some exit codes to your conditional statments to see what happens

Posted: Mon Feb 16, 2004 12:27 pm
by crazytopu
lol ;-)

this is my all 7 files..

Code: Select all

<?php

---check_login.php-----

<?php 
    /* check login script, included in db_connect.php. */ 
    session_start();                    //starts a new session 
    /* Here we check if username or password session exists or not if it dosent then we set the logged_in variable to  0 and return to our previous called program */ 
    if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) 
    { 
        $logged_in = 0; 
        return; 
    }     
    else 
    { 
        // remember, $_SESSION['password'] will be encrypted. 
        if(!get_magic_quotes_gpc()) // This gets the current active config of magic quotes. GPC means GET/POST/Cookie. 
        { 
            $_SESSION['username'] = addslashes($_SESSION['username']);    // addslashes to session username before using in a query. 
        } 
        $pass = "SELECT password FROM users WHERE username = '".$_SESSION['username']."'"; 
        $result = mysql_query($pass); 
        $num_row = mysql_fetch_row($result); 
        If (!($num_row)) 
        { 
            $logged_in = 0; 
            unset($_SESSION['username']); 
            unset($_SESSION['password']); 
            // kill incorrect session variables. 
        } 
        $db_pass = mysql_fetch_array($result); 
        /* now we have encrypted pass from DB in 
        $db_pass['password'], stripslashes() just incase: */ 
        $db_pass['password'] = stripslashes($num_row[0]); 
        $_SESSION['password'] = stripslashes($_SESSION['password']); 
        //compare: 
        if($_SESSION['password'] == $db_pass['password']) 
        { 
            // valid password for username 
            $logged_in = 1; // they have correct info session Variables. 
        } 
        else 
        { 
            $logged_in = 0; 
             
            unset($_SESSION['username']); 
            unset($_SESSION['password']); 
            // kill incorrect session variables. 
        } 
    } 
    // clean up 
    unset($db_pass['password']); 
    $_SESSION['username'] = stripslashes($_SESSION['username']); 
?> 

?>


Code: Select all

<?php

------register.php----





<?php
	require('db_connect.php');	// database connect script.
?>

<html>
<head>
<title>Register an Account</title>
</head>
<body>

<?php

	if (isset($_POST['submit'])) // if form has been submitted
	/* check they filled in what they supposed to, 	passwords matched, username
	isn't already taken, etc. */
	{ 
		if (!$_POST['uname'] | !$_POST['passwd'] | !$_POST['passwd_again'] | !$_POST['email'])
		{
			die('You did not fill in a required field.');
		}
		
		if (!get_magic_quotes_gpc())
		{
			$_POST['uname'] = addslashes($_POST['uname']);
		}
		$name_check = "SELECT username FROM users WHERE username = '".$_POST['uname']."'"; // check if username exists in database.

		if (!($name_check)) print mysql_error();
		$result = mysql_query($name_check);
		$num_rows = mysql_num_rows($result);
	
		if ($num_rows != 0)
			
		{
			die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.');
		}

		// check passwords match

		if ($_POST['passwd'] != $_POST['passwd_again'])
		{
			die('Passwords did not match.');
		}

		// check e-mail format

		if (!preg_match("/.*@.*..*/", $_POST['email']) | preg_match("/(<|>)/", $_POST['email']))
		{
			die('Invalid e-mail address.');
		}

		// no HTML tags in username, website, location, password

		$_POST['uname'] = strip_tags($_POST['uname']);
		$_POST['passwd'] = strip_tags($_POST['passwd']);
		$_POST['website'] = strip_tags($_POST['website']);
		$_POST['location'] = strip_tags($_POST['location']);
	
		// check show_email data

		if ($_POST['show_email'] != 0 & $_POST['show_email'] != 1)
		{
			die('Nope');
		}

		/* the rest of the information is optional, the only thing we need to 
		check is if they submitted a website, and if so, check the format is ok. */

		if ($_POST['website'] != '' & !preg_match("/^(http|ftp):\/\//", $_POST['website']))
		{
			$_POST['website'] = 'http://'.$_POST['website'];
		}

		// now we can add them to the database.
		// encrypt password

		$_POST['passwd'] = md5($_POST['passwd']);

		if (!get_magic_quotes_gpc())
		{
			$_POST[passwd] = $_POST[passwd];
			$_POST[email] = $_POST[email];
			$_POST[website] = $_POST[website];
			$_POST[location] = $_POST[location];
		}
	
		$regdate = date('m d, Y');

		$insert = "INSERT INTO users (
			username, 
			password, 
			regdate, 
			email, 
			website, 
			location, 
			show_email, 
			last_login) 
			VALUES (
			'".$_POST['uname']."', 
			'".$_POST['passwd']."', 
			'$regdate', 
			'".$_POST['email']."', 
			'".$_POST['website']."', 
			'".$_POST['location']."', 
			'".$_POST['show_email']."', 
			'Never')";

		$add_member = mysql_query($insert);

		if (!($add_member)) print mysql_error();
	
?>

		<h1>Registered</h1>

		<p>Thank you, your information has been added to the database, you may now <a href="login.php" title="Login">log in</a>.</p>

<?php

	}
	else 
	{	// if form hasn't been submitted show new form

?>
		<link rel="stylesheet" type="text/css" href="default.css">
<script> 
function checkUniqLogin(){ 
var login=document.forms['register'].elements['uname'].value; 
window.open('uniq_login.php?login='+login, '_blank', 
'dependent=1,directories=0,height=400,width=300,location=0'); 
} 
</script>                 
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="register">
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>Username*:</td><td>
<input type="text" name="uname" maxlength="40">
</td></tr>
<tr><td>Password*:</td><td>
<input type="password" name="passwd" maxlength="50">
</td></tr>
<tr><td>Confirm Password*:</td><td>
<input type="password" name="passwd_again" maxlength="50">
</td></tr>
<tr><td>E-Mail*:</td><td>
<input type="text" name="email" maxlength="100">
</td></tr>
<tr><td>Website:</td><td>
<input type="text" name="website" maxlength="150">
</td></tr>
<tr><td>Location</td><td>
<input type="text" name="location" maxlength="150">
</td></tr>
<tr><td>Show E-Mail?</td><td>
<select name="show_email">
<option value="1" selected="selected">Yes</option>
<option value="0">No</option></select>
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Sign Up">
</td></tr>
</table>
</form>


		<?php

	}

		?>
</body>
</html>


?>

Code: Select all

<?php

----logout.php-----






<?php 
    ob_start();
    require 'db_connect.php';    // database connect script. 
    if ($logged_in == 0) 
    { 
        die('You are not logged in so you cannot log out.'); 
    }
      setcookie("uname", "", time() - 60); 
      setcookie("passwd", "", time() - 60);    
    unset($_SESSION['username']); 
    unset($_SESSION['password']); 
    // kill session variables 
    $_SESSION = array(); // reset session array 
    session_destroy();   // destroy session.
    header("Location: template2.php"); // redirect them to anywhere you like.
    ob_end_flush();
?> 

?>

Code: Select all

<?php

----example.php----



<?php

require 'db_connect.php';

// require our database connection
// which also contains the check_login.php
// script. We have $logged_in for use.

if ($logged_in == 0) {
	die('<p> Sorry you are not logged in, this area is restricted to registered members. <p> <a href="login.php">Click here</a> to log in.');
}


// show content

?>
<p> Welcome to your  Zone <?php echo $_SESSION['username']; ?>
<p> This is my first test page</p>

Click here to  <a href="logout.php">logout</a>
?>

so, malcom i did post all the 7 files here..now i hope you can take a look n hopefully tell me where i should make a change ..

thanks ..

Posted: Mon Feb 16, 2004 12:30 pm
by malcolmboston
just wanted to confer with other coders as im not currently on my web server

technically, if you have a die() statement with a message inside it, would that cause a header error?

Posted: Mon Feb 16, 2004 12:33 pm
by crazytopu
em..i m not really sure...actually i mostly learn by asking in forum and trying free code sample on the net...so i m yet to go through any real depth into PHP.

Hope you can excuse me this time as being just a 2nd year honors student and not having PHP in my course curriculam.. i just get lots of fun talking to developers and trying to learn some new stuff.

Posted: Mon Feb 16, 2004 12:34 pm
by malcolmboston
i mean if that piece of code 'dies'

edit
it is regarding your cookie and header functions i believe, if someone else can confirm this................

Posted: Mon Feb 16, 2004 12:36 pm
by crazytopu
I think it does....but not positive..

Posted: Mon Feb 16, 2004 4:17 pm
by ol4pr0
for one what i dont get is why did you put in a redirect header within the if / else statement .

Code: Select all

// snippet lines 51 - 60

} 
?> 
<?php 
header("Location: template2.php");  // line 54
?> 
<?php 
    } 
    else 
    {    // if form hasn't been submitted 
?>
i think this should just be

Code: Select all

} 
    } 
    else 
    {    // if form hasn't been submitted 
?> 
<html>
and the rest of that code

Posted: Mon Feb 16, 2004 8:13 pm
by crazytopu
so u mean to change the code into this?:

Code: Select all

<?php

<?php 
/* database connect script. */ 
require 'db_connect.php'; 
if($logged_in == 1) 
{ 
die('You are already logged in,<b> '.$_SESSION['username'].'</b>. Go back <a href = "template2.php">HOME</a>.'); 
          
} 
if (isset($_POST['submit'])) 
{ 
// if form has been submitted 
/* check they filled in what they were supposed to and authenticate */ 
if(!$_POST['uname'] | !$_POST['passwd']) 
{ 
die('You did not fill in a required field.'); 
} 
// authenticate. 
if (!get_magic_quotes_gpc()) 
{ 
$_POST['uname'] = addslashes($_POST['uname']); 
} 
$check = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."'"; 
$result = mysql_query($check); 
$num_rows = mysql_num_rows($result); 
if (!($num_rows))          
{ 
die('That username does not exist in our database.'); 
} 
$info = mysql_fetch_Array($result); 
// check passwords match 
$_POST['passwd'] = stripslashes($_POST['passwd']); 
$info['password'] = stripslashes($info['password']); 
$_POST['passwd'] = md5($_POST['passwd']); 
if ($_POST['passwd'] != $info['password']) 
{ 
die('Incorrect password, please try again.'); 
} 
/* if we get here username and password are correct, 
register session variables and set last login time.*/ 
$date = date('m d, Y'); 
$update_login = mysql_query("UPDATE users SET last_login = '$date' WHERE username = '".$_POST['uname']."'"); 
$_POST['uname'] = stripslashes($_POST['uname']); 
$_SESSION['username'] = $_POST['uname']; 
$_SESSION['password'] = $_POST['passwd']; 
// Remember Me cookie will be set after successful login 
if (isset($_POST['remember_me'])) { 
$time_expire = time()+31536000; 
setcookie("uname", $_POST['uname'], $time_expire); 
setcookie("passwd", md5($_POST['passwd']), $time_expire); 
} 
//header("Location: template2.php"); 
} 
else 
{ 
// if form hasn't been submitted 
?> 
<html> 
<head> 
<title>Login</title> 
</head> 
<body> 
        <!-- This is the first screen when a user sees when he is not logged in --> 
        <form action="<?php echo $_SERVER['PHP_SELF']?>?var=login" method="post"> 
        <center> 
        <table width="250" border="1" cellspacing="0" cellpadding="4" bordercolor="#000000" bordercolordark="#000000" bordercolorlight="#000000" bgcolor="#FFFFFF" style="border-collapse: collapse"> 
        <tr> 
        <td class="updatecontent"><center>          
        <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> 
        Username<br> 
        <input type="text" name="uname" maxlength="40"><br><br> 
        Password<br> 
        <input type="password" name="passwd" maxlength="50"> 
        </center> 
        </td></tr> 
        <tr><td class="updatefooter"> 
        <input type="Checkbox" name="Remember_Me"> Remember Me<br>                      
<input type="submit" name="submit" value="Login"> 
        </td></tr> 
        </table> 
        </form> 
<?php 
} 
?> 
</body> 
</html> 
?> 


?>

But now i m receiving even more warning than before:

Code: Select all

Warning: session_start(): open(/tmp\sess_5bd5d16890242e9bc9dca430bc1f586a, O_RDWR) failed: No such file or directory (2) in c:\program files\apache group\apache\htdocs\check_login.php on line 4

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\apache group\apache\htdocs\check_login.php:2) in c:\program files\apache group\apache\htdocs\check_login.php on line 4

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\check_login.php:2) in c:\program files\apache group\apache\htdocs\check_login.php on line 4

Username


Password
  
 Remember Me
  

?&gt; 
Warning: Unknown(): open(/tmp\sess_5bd5d16890242e9bc9dca430bc1f586a, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0