webtuto Posted April 20, 2008 Share Posted April 20, 2008 hey i use this code im gonna post here a part of it its an HTML code then php then html <HERE THERE IS MORE HTML CODES> <p> </p> <p> </p> <p></td> <td colspan="5" background="images/Studio_musique_23.gif" valign="top"> <div align="center"> <?php ob_start(); include("config.php"); if(!empty($_POST['nick']) and !empty($_POST['pass']) ) { $md5=@md5($_POST['pass']); $nick = addslashes($_POST['nick']); $sql = "select * from `membre` where nick='$nick' and pass='$md5'"; $res=mysql_query($sql)or die(mysql_error()); $count = mysql_num_rows($res); if($count == 1){ //id fetch------------------------------------- $wor = mysql_query("select * from membre where nick='$nick'")or die(mysql_error()); $oop = mysql_fetch_array($wor); //end id fetch -------------------------------- $timestamp_expire = time() + 365*24*3600; setcookie('nick', $_POST['nick'], $timestamp_expire); setcookie('pass', md5($_POST['pass']), $timestamp_expire); setcookie('id', $oop['id'], $timestamp_expire); echo "<meta http-equiv='refresh' content='0;url=userpanel.php'>"; }else{ echo"<center><h2>Le pseado ou le mot de passe est incorrect. Veuillez réessayer.<h2>"; } } ob_end_flush(); ?> <form method="post" action=""> <table border=0> <tr><td>Pseudo :</td><td><input type="text" name="nick"></td></tr> <tr><td>Mot de passe :</td><td><input type="password" name="pass"></td></tr> <tr></td><td><td><input type="submit" name="send" value=" log in "></td></tr> </table> </form> </div> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <HERE THERE IS MORE HTML CODES> but the problem is that it gives this error Warning: Cannot modify header information - headers already sent by (output started at /home/karimweb/domains/SITE/login.php:4) in /home/karimweb/domains/public_html/SITE/login.php on line 189 Warning: Cannot modify header information - headers already sent by (output started at /home/karimweb/domains/public_html/SITE/login.php:4) in /home/karimweb/domains/public_html/SITE/login.php on line 190 Warning: Cannot modify header information - headers already sent by (output started at /home/karimweb/domains/public_html/SITE/login.php:4) in /home/karimweb/domains/public_html/SITE/login.php on line 191 and the navigator douesnt register the cookies the lines 189 and 190 and 191 are the lines where i write the code to register cookies on the browser Link to comment https://forums.phpfreaks.com/topic/101994-cannot-modify-header-plz-help/ Share on other sites More sharing options...
dptr1988 Posted April 20, 2008 Share Posted April 20, 2008 You are trying to send cookies after outputing HTML http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/101994-cannot-modify-header-plz-help/#findComment-521971 Share on other sites More sharing options...
webtuto Posted April 20, 2008 Author Share Posted April 20, 2008 yeah i know but its necessary that the html code come before that php code Link to comment https://forums.phpfreaks.com/topic/101994-cannot-modify-header-plz-help/#findComment-521972 Share on other sites More sharing options...
discomatt Posted April 20, 2008 Share Posted April 20, 2008 Did you read the thread in the stickies? Link to comment https://forums.phpfreaks.com/topic/101994-cannot-modify-header-plz-help/#findComment-521974 Share on other sites More sharing options...
dptr1988 Posted April 20, 2008 Share Posted April 20, 2008 Ok, then you can put all of that HTML code into a variable, send your cookies and then echo the variable. OR use output buffering as described in the link I gave you. http://ca.php.net/manual/en/ref.outcontrol.php Link to comment https://forums.phpfreaks.com/topic/101994-cannot-modify-header-plz-help/#findComment-521975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.