Dethman Posted July 23, 2008 Share Posted July 23, 2008 well I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at /home2/psionic/public_html/functions/recruit.php:32) in /home2/psionic/public_html/recruit.php on line 13 This is the code with line 13: <?php //start title $pagetitle="Recruitment"; //end title require("db_connect.php"); require("functions/main.php"); require("functions/recruit.php"); $System=getSystemInfo(); $recruit=$_GET['uniqueID']; $recruiter=getRecruiter($recruit); if($recruiter=="Error"){ header("Location: index.php?strErr=Citizen with that recruit link does not exist!"); } $msg=$_GET['strErr']; include("includes/top.php"); ?> This is functions/recruit.php with line 32: <?php function getRecruiter($link){ $q="SELECT * FROM `user_users`"; $v=mysql_query($q); while($row=mysql_fetch_array($v)){ if(md5($row['username'])==$link){ $q2="SELECT * FROM `user_users` WHERE `userid` = '".$row['userid']."'"; $v2=mysql_query($q2); $temp=mysql_fetch_array($v2); $r="SELECT * FROM `recruit_ip` WHERE `userid` = '".$temp['userid']."' AND `ip` = '".$_SERVER['REMOTE_ADDR']."'"; $r2=mysql_query($r); $count=mysql_num_rows($r2); if($count<=0){ $q4="INSERT INTO `recruit_ip` (`recruitID`,`userid`,`ip`) VALUES ('','".$temp['userid']."','".$_SERVER['REMOTE_ADDR']."');"; $q3="UPDATE `user_users` SET `untrainedTroops` = `untrainedTroops` + '40', `miner` = `miner` +'60', `attackTroops` = `attackTroops` + '30' WHERE `userid` = '".$temp['userid']."'"; mysql_query($q3) or die("SQL ERR:".mysql_error()); mysql_query($q4) or die("SQL ERR:".mysql_error()); return $temp; }else{ header("Location: index.php?strErr=you have already clicked that link today. sorry come back tomorrow"); } }else{ return "Error"; } } } ?> Please dont kill me if this isnt allowed I just wasnt sure Thanx, Brian Flores CEO NimbusGames,llc Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/ Share on other sites More sharing options...
stelthius Posted July 23, 2008 Share Posted July 23, 2008 i think its because line 13 is header("Location: index.php?strErr= then yur including this file functions/recruit.php Which also has the header info header("Location: index.php?strErr=tomorrow"); } I maybe wrong but im postive thats what it is Rick Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597367 Share on other sites More sharing options...
Dethman Posted July 23, 2008 Author Share Posted July 23, 2008 How would I fix that? Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597370 Share on other sites More sharing options...
wrathican Posted July 23, 2008 Share Posted July 23, 2008 do any of these: require("db_connect.php"); require("functions/main.php"); require("functions/recruit.php"); output anything? like echo? or html tags? Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597379 Share on other sites More sharing options...
Dethman Posted July 23, 2008 Author Share Posted July 23, 2008 None of those do. Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597384 Share on other sites More sharing options...
unkwntech Posted July 23, 2008 Share Posted July 23, 2008 Even a \r|\n (i.e a return) at the top of a page will produce this error. There can be NOTHING not even white space occurring before you call header() Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597397 Share on other sites More sharing options...
DeanWhitehouse Posted July 23, 2008 Share Posted July 23, 2008 if you want an easy fix put ob_start(); at the top of the page Link to comment https://forums.phpfreaks.com/topic/116164-header-error-im-not-sure-if-this-post-is-allowed/#findComment-597427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.