ekante Posted April 19, 2009 Share Posted April 19, 2009 Problem: 1 version: ( i check the remember button ) Error msg: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\pro\index.php:1) in C:\AppServ\www\pro\index.php on line 123 Line: <?php $info = base64_encode("$userid|$username|$password|$ipaddress|$lastlogin_date|$lastlogin_time"); if (isset($remember)){ setcookie("user","$info",time()+1209600); //here is the problem }else{ setcookie("user","$info",0); } ?> 2 version i dont check remember button Error msg: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\pro\index.php:1) in C:\AppServ\www\pro\index.php on line 125 Line: <?php $info = base64_encode("$userid|$username|$password|$ipaddress|$lastlogin_date|$lastlogin_time"); if (isset($remember)){ setcookie("user","$info",time()+1209600); }else{ setcookie("user","$info",0); //here is the problem } ?> If you need ill give you adress or the file. Problem is it works on my pc (xampp) , but wont work on my friends (appserv). Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/ Share on other sites More sharing options...
Maq Posted April 19, 2009 Share Posted April 19, 2009 That doesn't look like the correct page or line numbers. You can't have any output before you call the header() function. Read more here: HEADER ERRORS Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/#findComment-813991 Share on other sites More sharing options...
ekante Posted April 19, 2009 Author Share Posted April 19, 2009 But no my pc its going succesfully but on friends , shows this msg. And there is no header errors on my (xampp) pc server. Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/#findComment-814014 Share on other sites More sharing options...
soak Posted April 19, 2009 Share Posted April 19, 2009 It will likely be because one of you has a buffer set and the other doesn't (or error reporting is configured differently). As Maq said, read the sticky at the top of the forum. Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/#findComment-814025 Share on other sites More sharing options...
alphanumetrix Posted April 19, 2009 Share Posted April 19, 2009 A simple fix to this would be to add these codes around all of your scripts: ob_start(); ob_end_flush(); that should get rid of the error without having to change what you already have. it basically refreshes the headers for you. Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/#findComment-814066 Share on other sites More sharing options...
ekante Posted April 20, 2009 Author Share Posted April 20, 2009 Thx m8 , never thought looking at this function. Solved. Quote Link to comment https://forums.phpfreaks.com/topic/154790-solved-problem-with-header-in-script/#findComment-814271 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.