Hello everybody,
To test propagation of session, I have three scripts:
idnex.php:
Code:
<html>
<head><title>abc</title></head>
<center><h1>abc</h1></center>
<body bgcolor="pink">
<form action="user_auth.php" method="post">
User Name:<input type="text" name="user_name"/><br /><br />
Password :<input type="password" name="password"/><br /><br />
<input type="submit" name="submit" />
</form>
</body>
</html>
user_auth.php:
Code:
<html>
<head></head>
<body bgcolor="pink">
<?php
session_start();
$_SESSION['user']=$_POST['user_name'];
$_SESSION['passwd']=$_POST['password'];
$link=mysql_connect("localhost",$_SESSION['user'],$_SESSION['passwd']);
mysql_select_db("pali");
$result=mysql_query("select * from wll");
echo "<table border=\"2\">";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "\t<tr>\n";
foreach ($line as $col_value)
{
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>";
mysql_free_result($result);
mysql_close($link)
?>
<form action="ex.php" method="post">
<input type="submit">
</form>
</body>
</html>
When I go from the first page to the second page, following warnings are issued:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/user_auth.php:4) in /var/www/html/user_auth.php on line 5
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/user_auth.php:4) in /var/www/html/user_auth.php on line 5
Then the output is produced.
Why are there warnings ?
Can anyone tell me ?
Thanks in advance.