note 82767 rejected from function.session-start by felipe

From: Date: Sat, 26 Apr 2008 02:44:15 +0000
Subject: note 82767 rejected from function.session-start by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138796@lists.php.net to get a copy of this message
Note Submitter: mathanbox at hotmail dot com ---- <?php session_start(); session_destroy(); $errormsg =''; include ('./dbcon.php'); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>..::Welcome Mathan.info::..</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="icon" href="images/logo.ico" type="image/x-icon" /> <link rel="shortcut icon" href="images/logo.ico" type="image/x-icon" /> <link href="default.css" rel="stylesheet" type="text/css" /> <script language="javascript"> function check() { if (document.form1.td_username.value == '' ) { alert ('username field is empty!'); document.form1.td_username.focus(); return false; } if (document.form1.td_pass.value == '' ) { alert ('password field is empty!'); document.form1.td_pass.focus(); return false; } } </script> </head> <body> <?php // Get Username and Password sent from form $td_username=$_POST['td_username']; $td_pass=$_POST['td_pass']; $tbl_name='task_user'; if (isset($_POST['Submit'])) { $sql="SELECT * FROM $tbl_name WHERE uname='$td_username' and upass='$td_pass'"; $result=mysql_query($sql); $count = mysql_num_rows($result); $row = mysql_fetch_row($result); if ($count !=0) { session_start (); $_SESSION['td_username'] = $td_username; session_register('td_username'); echo $row[2]; if ($row[2] == 1) { header("Location:admin_login.php"); echo $_SESSION['td_username']; //Go to Admin Page } else { header("Location:user_login.php"); echo 'user'; //Go to User Page } } else { $errormsg = "<font color=red><div><img src='images/error.gif'>Invaild Username or Password</div></font>"; //header("Location:index.php"); //echo "error"; } } ?> <div id="header"> <div id="logo"> <p>&nbsp;</p> <p><img src="images/logo.gif" alt="" width="504" height="99" /> </p> </div> <div id="menu"> <ul> <li class="active"><a href="index.php" accesskey="1" title="">Home</a></li> <li></li><li><a href="#" accesskey="3" title="">About</a></li> <li><a href="#" accesskey="4" title="">Contact</a></li> </ul> </div> </div> <hr /> <div id="page"> <div id="bg"> <div id="content"> <div class="post" style="padding-top: 57px;"> <h2 class="title">Welcome to mathan.info</h2> <div class="entry"> <center><strong> <?=$errormsg?></strong></center> <form id="form1" name="form1" method="post" action="index.php" > <p><strong>UserName</strong> <input type="text" name="td_username" /> </p> <p><strong>Password</strong>&nbsp; <input type="password" name="td_pass" /> </p> Â Â Â Â Â Â <img src="images/login.gif" alt="Login" width="48" height="48" style="display: block; float: right" />Â Â Â Â Â Â Â Â Â Â Â Â <input type="submit" name="Submit" value="Submit" onMouseOver="style.background='#00BFFF';style.color='white'" onMouseOut="style.background='';style.color='black'" onClick="return check()" /> </form> <pre><font face="Verdana, Arial, Helvetica, sans-serif">admin: username=admin pass=pass user: username=user pass=demo user: username=mak pass=mak </font></pre> </div> </body> </html> This my index.php code if give some error the error is Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /www/zzl.org/m/a/t/mathan/htdocs/index.php:18) in /www/zzl.org/m/a/t/mathan/htdocs/index.php on line 56 1 Warning: Cannot modify header information - headers already sent by (output started at /www/zzl.org/m/a/t/mathan/htdocs/index.php:18) in /www/zzl.org/m/a/t/mathan/htdocs/index.php on line 63 please help friends

« previous php.notes (#138796) next »