Search engine

Question by killamike513:
does this script have to do with the siteheader?

include("funcs.php");

function doswitch (){
global $ tab, $ time, $ id, $ tru;

$ pimp = mysql_fetch_array(mysql_query("SELECT code FROM $ tab[pimp] WHERE id='$ id';"));
$ user = mysql_fetch_array(mysql_query("SELECT username FROM $ tab[user] WHERE code='$ pimp[0]';"));

$ getgames = mysql_query("SELECT round FROM $ tab[game] WHERE starts<$ time AND ends>$ time ORDER BY round ASC;”);
while ($ game = mysql_fetch_array($ getgames))
{
if(fetch(“SELECT user FROM $ tab[stat] WHERE user=’$ user[0]‘ AND round=’$ game[0]‘;”)){
?>Round , }
}

}

function ADMINHEADER ($ title){
global $ tab, $ tru, $ id;

$ pimp = mysql_fetch_array(mysql_query("SELECT status FROM $ tab[pimp] WHERE id='$ id';"));
if($ pimp[0] != admin){ echo"

ACCESS DENIED!
“; die(); }

header(“Cache-Control: no-cache, must-revalidate”);
Header(“Pragma: no-cache”);
Header(“Expires: Thu, 01 Jan 1970 00:00:00 GMT”);
?>




0){?>onLoad=”settimes()”>
}

function GAMEHEADER ($ title){
global $ tab, $ site, $ id, $ time, $ masteraccount, $ tru;

$ boot = mysql_fetch_array(mysql_query("SELECT online,status,pimp,crew,newalert,alert,rank,nrank,networth,msg,atk,ivt FROM $ tab[pimp] WHERE id='$ id';"));
$ crw = mysql_fetch_array(mysql_query("SELECT name,founder,icon FROM $ tab[crew] WHERE id='$ boot[3]';"));

$ idle=$ time-$ boot[0];

if (!$ boot){ header("Location: ../play.php?msg=select"); }
elseif ($ idle > 3600){ header(“Location: ../play.php?msg=idle”); }
elseif ($ boot[1] == banned){ header(“Location: ../play.php?msg=disabled”); }

$ protection = mysql_fetch_array(mysql_query(“SELECT protection,protectstarted FROM $ tab[pimp] WHERE id=’$ id’;”));
$ protect=$ protection[0]+$ protection[1]-$ time;
if($ protect < 0){$ protect=0;}

header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
Header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
?>





0){?>onLoad=”settimes()”>

contacts:  

“>produce
“>travel
“>ranks


“>find crew
“>crew ranks

function GAMEFOOTER (){
global $ tru, $ tab, $ id;

$ pimp = mysql_fetch_array(mysql_query("SELECT pimp FROM $ tab[pimp] WHERE id='$ id';"));
?>


“>recuiting board
&tru=“>my profile
game guide
game rules
“>logout
copyright © 2004 domain. all rights reserved


?>


——————————————

Answer by byteofk
This bit does:

header(“Cache-Control: no-cache, must-revalidate”);
Header(“Pragma: no-cache”);
Header(“Expires: Thu, 01 Jan 1970 00:00:00 GMT”);

Although this is probably what is triggering the error, not what is causing it.

Somewhere before that you are echoing or printing data to the page and then when it wants to begin the page with this header it errors out. Common PHP beginners error.

Instead of echoing output, store it in a variable and output it right at the end. Nice and safe that way.

——————————————
Add your own answer in the comments!