Shame Posted January 4, 2010 Posted January 4, 2010 So I am getting this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rpg/public_html/header.php:2) in /home/rpg/public_html/header.php on line 68 And I don't know how to fix it? Any insight? Quote
Shame Posted January 4, 2010 Author Posted January 4, 2010 <? $vip=getenv("REMOTE_ADDR"); /* if($vip != "199.2.101.159") { // exit; } $banip = array( "220.173.67.35"=>1, "222.84.92.152"=>1, "219.159.208.148"=>1 ); $banref=array( "jiangyuech"=>1, "hlj8"=>1, "zhlhpanjg"=>1, "wddhao"=>1, "jbccfeng"=>1, "lhxxibm"=>1, "xingkcjs"=>1, "wangguana"=>1, "makehoot"=>1, "nbfxb"=>1, "wangz4"=>1, "shuishou107"=>1, "zhenshide777"=>1, "gaoshan501"=>1, "xpz008"=>1, "freexzc"=>1, "chenming9"=>1, "cacaqys"=>1, "lhxxibm"=>1, "wangz4"=>1, "shuishou107"=>1, "gaoshan501"=>1, "zhenshide777"=>1, "shuishou107"=>1, "tiger3429"=>1, "jflu123"=>1, "lanyag"=>1, "nbzhlouis"=>1, "lvbinsky"=>1, "eareast"=>1, "worldmoneyfactory"=>1, "ercelya"=>1, "maixiangji"=>1, "jojocraft"=>1, "slon888"=>1, ); if($banref[$ref] == 1) { echo "Please <a href=\"index.php\">Click here to enter FreeRpgSpot</a>"; exit; } if($banip[$vip] == 1) { exit; } */ $permission = 0; include("includes/functions.php"); //**S**// $settingsdemo=false; session_start(); $aurora=true; @header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); @header("Cache-Control: no-cache, must-revalidate"); @header("Pragma: no-cache"); if(isset($referrer)) {$ref=$referrer;} if(isset($referer)) {$ref=$referer;} include("config.php"); require("./includes/globals.php"); include("./includes/mysql.php"); $Db1 = new DB_sql; $Db1->connect($DBHost, $DBDatabase, $DBUser, $DBPassword); if($ref) { // $Db1->query("UPDATE user SET ptp_track=ptp_track+1 WHERE username='$ref'"); } include("./includes/sessions.php"); if($LOGGED_IN) { // $Db1->query("UPDATE user SET hit_track=hit_track+1 WHERE username='$username'"); // $Db1->query("UPDATE user SET last_page='".$REQUEST_URI."' WHERE username='$username'"); } if($zxc == 1) { /* $sql=$Db1->query("SELECT * FROM settings"); echo " "; while($temp=$Db1->fetch_array($sql)) { echo "\"".addslashes($temp[title])."\" => \"".addslashes($temp[setting])."\", "; }*/ } $today_date=date("d/m/y"); $sql=$Db1->query("SELECT id FROM stats WHERE date='$today_date'"); if($Db1->num_rows() == 0) { $sql-$Db1->query("INSERT INTO stats SET date='$today_date'"); } $sql=$Db1->query("UPDATE stats SET hits=hits+1 WHERE date='$today_date'"); $sql=$Db1->query("SELECT * FROM dailyhits WHERE `ip`='$vip'".iif($settings[ptpuniqueuser] == 1," and ref='$ref'").""); if($Db1->num_rows() == 0) { $freshvisit=1; } $sql=$Db1->query("SELECT * FROM dailyhits WHERE `ip`='$vip'"); if($Db1->num_rows() == 0) { $unique=1; $Db1->query("UPDATE stats SET unhits=unhits+1 WHERE date='$today_date'"); $Db1->query("INSERT INTO dailyhits SET `ip`='$vip', ref='$ref'"); } if($ref != "") { if($settings[block_nem] == 1) { $sql=$Db1->query("SELECT suspended FROM user WHERE username='$ref'"); $temp=$Db1->fetch_array($sql); if(($Db1->num_rows() == 0) || ($temp[suspended] == 1)) { $Db1->sql_close(); header("Location: $settings[nem_goto]"); exit; } } $Db1->query("UPDATE user SET ref_hits_raw=ref_hits_raw+1 ".iif($unique==1,", ref_hits_unique=ref_hits_unique+1")." WHERE username='$ref'"); } if(($settings[floodguard_on] == 1)) { $sql=$Db1->query("SELECT * FROM dailyhits WHERE `ip`='$vip' and ref='$ref'"); $temp=$Db1->fetch_array($sql); $sql=$Db1->query("UPDATE dailyhits SET ".iif(($temp[last_time]+$settings[floodguard_seconds])>time(),"mcount=mcount+1","last_time='".time()."', mcount='1'")." WHERE `ip`='$vip' and ref='$ref'"); if(($temp[last_time]+$settings[floodguard_seconds]>time()) && ($temp[mcount] >= $settings[floodguard_hits])) { $sql=$Db1->query("UPDATE stats SET floodguard=floodguard+1 WHERE date='$today_date'"); $sql=$Db1->query("UPDATE user SET floodguard=floodguard+1, floodguard_today=floodguard_today+1 WHERE username='$ref'"); $Db1->sql_close(); header("Location: $settings[floodguard_foward]"); } } $url_variables=iif($sid, "sid=".$sid."&").iif($sid2, "sid2=".$sid2."&").iif($dbg==1, "dbg=1&").iif($siduid, "siduid=".$siduid."&").iif($ref!="","ref=$ref"."&"); $referringurl=parse_url($HTTP_REFERER); if(($settings[track_refers] == 1) && ($ref != "")) { $sql=$Db1->query("SELECT * FROM refdomains WHERE domain='$referringurl[host]'"); if($Db1->num_rows() > 0) { $Db1->query("UPDATE refdomains SET hits = hits + 1 WHERE domain='$referringurl[host]'"); } else { $Db1->query("INSERT INTO refdomains SET domain='$referringurl[host]', hits='1'"); } } if($settings[block_domains] == 1) { $sql=$Db1->query("SELECT * FROM blocklist WHERE domain='$referringurl[host]'"); if($Db1->num_rows() > 0) { $Db1->sql_close(); header("Location: $settings[banned_goto]"); die(); } } if((SETTING_PTP == true) && ($ref != "")) { if(($freshvisit == 1) || ($settings[ptpunique] != 1)) { if($settings[ptpallow] == 1) { $sql=$Db1->query("SELECT * FROM ptp_allow WHERE domain='$referringurl[host]'"); $allowed = $Db1->num_rows(); } if(($ref != "") && ($settings[ptpon] == 1) && ($settings[ptppopup] != 1) && (($allowed > 0) || ($settings[ptpallow] == 0))) { if(($referringurl[host] != "") || ($settings[no_ref_pay] == 1)) { $sql=$Db1->query("SELECT type, membership FROM user WHERE username='$ref'"); $temprefinfo=$Db1->fetch_array($sql); if($temprefinfo[type] == 1) { $sql=$Db1->query("SELECT ptp FROM memberships WHERE id='$temprefinfo[membership]'"); $tempmem=$Db1->fetch_array($sql); $ptppay=$tempmem[ptp]; } else { $ptppay=$settings[ptpamount]; } $Db1->query("UPDATE user SET ptpearns=ptpearns+$ptppay, balance=balance+$ptppay, ptphits_today=ptphits_today+1, ptphits=ptphits+1 WHERE username='$ref'"); $Db1->query("UPDATE stats SET ptphits=ptphits+1, cash=cash+$ptppay WHERE date='$today_date'"); } else { $freshvisit=0; } } } } if($LOGGED_IN) { $sql=$Db1->query("UPDATE user SET last_act='".time()."' WHERE username='$username'"); } $fivemin=time()-60; $sql=$Db1->query("DELETE FROM online WHERE dsub<'$fivemin'"); $sql=$Db1->query("SELECT id FROM online WHERE ip='$vip'"); if($Db1->num_rows() == 0) { $sql=$Db1->query("INSERT INTO online (userid, dsub, ip) VALUES ('$userid','".time()."','$vip')"); } $sql=$Db1->query("SELECT COUNT(id) AS total FROM online"); $temp=$Db1->fetch_array($sql); $total_online=$temp[total]; if(isset($track)) { $sql=$Db1->query("SELECT * FROM tracker WHERE track_id='".addslashes($track)."' and ip='$vip'"); if($Db1->num_rows() == 0) { $sql=$Db1->query("INSERT INTO tracker SET track_id='".addslashes($track)."', ip='$vip', dsub='".time()."'"); } else { $sql=$Db1->query("UPDATE tracker SET visits=visits+1 WHERE track_id='".addslashes($track)."' and ip='$vip'"); } } //**E**// ?> Thats the whole source for my page. Quote
Shame Posted January 4, 2010 Author Posted January 4, 2010 I would appreciate it if some one could help me out. And I am willing to pay by the hour if some one has a AWESOME reputation around this forum for being able to program well. I just need to figure out what I did wrong. I must say that I did not code this myself, and that I did heavily modify it. And I must have made a mistake, obviously, and I need to get it fixed so I can launch my site in February like I plan. Quote
Magictallguy Posted January 4, 2010 Posted January 4, 2010 In functions.php, does it have session_start(); in there already? If so, simply remove it from the code you've posted here Quote
Zeggy Posted January 4, 2010 Posted January 4, 2010 It means you've already sent output before starting the session. Looking at your code, the error's probably in functions.php. Check if you're echo/printing anything, if you've already started a session, if there anything before the PHP opening tag or after, etc. Even whitespace. Quote
Shame Posted January 4, 2010 Author Posted January 4, 2010 I don't mean to offend any one, but you're all wrong. It was a simple fix and what I did was comment out the start_session(); and it was done. I do appreciate you all trying to help. Thanks. FreeRpgSpot is my other account. In hopes I could promote it in the future. Quote
Shame Posted January 4, 2010 Author Posted January 4, 2010 Woops, I do apologize. MagicTallGuy was the closest person to having the correct answer. Appreciate it again guys. And sorry for the double post. Quote
Zeggy Posted January 4, 2010 Posted January 4, 2010 We were both correct. You found a solution, but you still don't understand what the problem was. The problem is quite clear in the error message: "headers already sent (output started..)". From the way you fixed it, that means you already started a session and was trying to start another one, which we both said. We just couldn't give a more specific solution because we didn't have all the code to view, we only had your error message to work with. :) Quote
Shame Posted January 5, 2010 Author Posted January 5, 2010 We were both correct. You found a solution, but you still don't understand what the problem was. The problem is quite clear in the error message: "headers already sent (output started..)". From the way you fixed it, that means you already started a session and was trying to start another one, which we both said. We just couldn't give a more specific solution because we didn't have all the code to view, we only had your error message to work with. :) Thanks again. Quote
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.