Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
warning cannot modify header information - headers already sent.
01-07-2018, 10:31 AM,
Post: #1
warning cannot modify header information - headers already sent.
Please help me fix this code mobilechat wml

$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultban=rtrim($status[$ri]);

if($nimi=="$resultban"){$admin="5";}
}
if($admin=="5"){
header ('Location: ../tools/yourbanned.php');}

$status=file('../text/bootnames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultboot=rtrim($status[$ri]);

if($nimi=="$resultboot"){$admin="6";}
}
if($admin=="6"){
header ('Location: ../tools/yourbooted.php?nimi=$nimi');}
$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{


$resultipban=rtrim($status[$ri]);

if($nimi=="$resultipban"){$admin="8";}
}
if($admin=="8"){
header ('Location: ../tools/yourbanned.php');}
Reply
01-07-2018, 07:10 PM,
Post: #2
RE: warning cannot modify header information - headers already sent.
Dude Make sure you dont have any emply line before the coding
Just check whether your <?php tag starts from 1st line
If you have some emplty lines before the start of php tag then remove it and then check.
Also if you used 'echo' or 'print' command then also remove it because header and echo cant work at same time
I also stucked in such situation
and it will work for sure
Reply
01-08-2018, 12:24 PM, (This post was last modified: 01-08-2018, 12:25 PM by aznoorali.)
Post: #3
RE: warning cannot modify header information - headers already sent.
(01-07-2018, 07:10 PM)djavinash Wrote: Dude Make sure you dont have any emply line before the coding
Just check whether your <?php tag starts from 1st line
If you have some emplty lines before the start of php tag then remove it and then check.
Also if you used 'echo' or 'print' command then also remove it because header and echo cant work at same time
I also stucked in such situation
and it will work for sure

yes sir.. i've use that tag <?php end ?>
can you fix my code please sir.. help me..

<?php

/**
* @Version 3 (wml 1.2 EN)
* @Description (Should Be Now working On All Servers)
*/

$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultban=rtrim($status[$ri]);

if($nimi=="$resultban"){$admin="5";}
}
if($admin=="5"){
header ('Location: ../tools/yourbanned.php');}

$status=file('../text/bootnames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultboot=rtrim($status[$ri]);

if($nimi=="$resultboot"){$admin="6";}
}
if($admin=="6"){
header ('Location: ../tools/yourbooted.php?nimi=$nimi');}
$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{


$resultipban=rtrim($status[$ri]);

if($nimi=="$resultipban"){$admin="8";}
}
if($admin=="8"){
header ('Location: ../tools/yourbanned.php');}
?>

please fix this code.. help me sir..
Reply
01-17-2018, 08:08 PM,
Post: #4
RE: warning cannot modify header information - headers already sent.
$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultban=rtrim($status[$ri]);

if($nimi==$resultban){$admin=5;}
}
if($admin==5){
header ('Location: ../tools/yourbanned.php');}

$status=file('../text/bootnames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultboot=rtrim($status[$ri]);

if($nimi==$resultboot){$admin=6;}
}
if($admin==6){
header ('Location: ../tools/yourbooted.php?nimi=$nimi');}
$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{


$resultipban=rtrim($status[$ri]);

if($nimi==$resultipban){$admin=8;}
}
if($admin=="8"){
header ('Location: ../tools/yourbanned.php');}
Reply
01-19-2018, 08:52 PM,
Post: #5
RE: warning cannot modify header information - headers already sent.
Solved!
<?php
ob_start();
/**
* @Version 3 (wml 1.2 EN)
* @Description (Should Be Now working On All Servers)
* Modified By PHPRush ([email protected])
*/

$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultban=rtrim($status[$ri]);

if($nimi=="$resultban"){$admin="5";}
}
if($admin=="5"){
header ('Location: ../tools/yourbanned.php');}

$status=file('../text/bootnames.txt');
for ($ri=0; $ri<count($status); $ri++)
{
$resultboot=rtrim($status[$ri]);

if($nimi=="$resultboot"){$admin="6";}
}
if($admin=="6"){
header ('Location: ../tools/yourbooted.php?nimi=$nimi');}
$status=file('../text/bannames.txt');
for ($ri=0; $ri<count($status); $ri++)
{


$resultipban=rtrim($status[$ri]);

if($nimi=="$resultipban"){$admin="8";}
}
if($admin=="8") {

header ('Location: ../tools/yourbanned.php');
exit;
}
?>
Reply
[-] The following 1 user Likes PHPRush's post:
  • weetbokarachai
01-21-2018, 09:27 AM,
Post: #6
RE: warning cannot modify header information - headers already sent.
Warning: Cannot modify header information - headers already sent by (output started at /home/weet/public_html/weet/main/rooms.php:5) in /home/weet/public_html/weet/tools/ban.php on line 27

still cannot modify sir..
Reply
01-23-2018, 02:12 PM,
Post: #7
RE: warning cannot modify header information - headers already sent.
This line is error
PHP Code:
header ('Location: ../tools/yourbooted.php?nimi=$nimi');} 
Reply
02-25-2018, 01:54 PM,
Post: #8
RE: warning cannot modify header information - headers already sent.
Add >>

Code:
ob_start();

After php start that is <?php
On your pages that shows error like rooms.php, ban.php or add this on a main page means main is that page which includes top every pages.
Reply
02-26-2018, 07:02 AM,
Post: #9
RE: warning cannot modify header information - headers already sent.
Oppps.. http://www.refrainbd.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)