misterme Posted April 29, 2008 Share Posted April 29, 2008 I am getting a session start error on the top of the header of my page and cant figure for the life of me where, I have edited it to make it work correctly although something is causing the header error and I cant figure it out if someone where to be so kind as to help with this would be greatly appreciated THANK YOU My yourgang.php where I have edited to add the mod case "tag": gang_staff_tag(); break; case "pic": gang_staff_pic(); break; [url='yourgang.php?action=staff&act2=tag']Change Gang Tag[/url] [url='yourgang.php?action=staff&act2=pic']Change Gang Picture[/url] "; function gang_staff_pic() { global $ir,$c,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid || $userid==1) { if(isset($_POST['subm'])) { $_POST['vp']=str_replace(array("<", ">", "\n","\'"), array("<", ">", " ","'"), $_POST['vp']); mysql_query("UPDATE gangs SET gangPIC='{$_POST['vp']}' WHERE gangID={$gangdata['gangID']}",$c); print "Gang pic changed! [url='yourgang.php?action=staff']> Back[/url]"; } else { print "Current Pic: "; if($gangdata['gangPIC']) { print "[img={$gangdata[]"; } else { print "[b]No Gang Picture[/b]"; } print"<hr /> <form action='yourgang.php?action=staff&act2=pic' method='post'> Please note that the pic must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any pics that are not 468x60 will be automatically resized. <input type='hidden' name='subm' value='submit' /> tag: <input type='text' name='vp' value='http://www.domain.com/yourpic.jpg' /> <input type='submit' value='Change' /></form>"; } } } function gang_staff_tag() { global $ir,$c,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid || $userid==1) { if(isset($_POST['subm'])) { $_POST['vp']=str_replace(array("<", ">", "\n"), array("<", ">", " "), $_POST['vp']); mysql_query("UPDATE gangs SET gangPREF='{$_POST['vp']}' WHERE gangID={$gangdata['gangID']}",$c); print "Gang tag changed! [url='yourgang.php?action=staff']> Back[/url]"; } else { print "Current Tag: {$gangdata['gangPREF']} <form action='yourgang.php?action=staff&act2=tag' method='post'> Enter the new tag. <input type='hidden' name='subm' value='submit' /> tag: <input type='text' name='vp' value='' /> <input type='submit' value='Change' /></form>"; } } } Quote Link to comment Share on other sites More sharing options...
jay-dogg2006 Posted April 30, 2008 Share Posted April 30, 2008 Re: Frustrated with Gang Banner Add v1 just replace with this! should sort it! : <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- INDEX.php -----------------------------------------------------*/ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql1.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); Quote Link to comment Share on other sites More sharing options...
misterme Posted April 30, 2008 Author Share Posted April 30, 2008 Re: Frustrated with Gang Banner Add Um i run Version 2 Quote Link to comment Share on other sites More sharing options...
POG1 Posted April 30, 2008 Share Posted April 30, 2008 Re: Frustrated with Gang Banner Add $_POST['vp']=str_replace(array("<", ">", "\n","\'"), array("<", ">", " ","'"), $_POST['vp']); that makes no sence, why would a url have a in it lol Quote Link to comment Share on other sites More sharing options...
Spudinski Posted May 1, 2008 Share Posted May 1, 2008 Re: Frustrated with Gang Banner Add I can't seem to find anything that would indicate to produce a header error. What else have you modified in the script? $_POST['vp']=str_replace(array("<", ">", "\n","\'"), array("<", ">", " ","'"), $_POST['vp']); that makes no sence, why would a url have a in it lol A GET request uses the url to send and receive data, and there are so many reasons why someone would have in a request. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 1, 2008 Share Posted May 1, 2008 Re: Frustrated with Gang Banner Add I am getting a session start error on the top of the header of my page and cant figure for the life of me where, I have edited it to make it work correctly although something is causing the header error and I cant figure it out if someone where to be so kind as to help with this would be greatly appreciated THANK YOU Please post the exact error - Only then can we make a considered opinion and tell you to go read the manual ;) Quote Link to comment Share on other sites More sharing options...
misterme Posted May 3, 2008 Author Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add Sorry Forgot that Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/gyunas2/public_html/yourgang.php:1) in /home/gyunas2/public_html/globals.php on line 6 Globals Lines 6 - 18 session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 3, 2008 Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add headers already sent (output started at /home/gyunas2/public_html/yourgang.php:1 So ballpark guess - you have a space or some text being output in yourgang.php in line #1 Learn to read the error messages - they (almost) always give exactly the information you need to fix the error. Quote Link to comment Share on other sites More sharing options...
misterme Posted May 3, 2008 Author Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add No offense but Im not that new :| No space <?php include "globals.php"; if(!$ir['gang']) { print "Your Not In A Gang"; } else { $gq=mysql_query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangID={$ir['gang']}",$c); $gangdata=mysql_fetch_array($gq); print "<h3><u>Your Gang - {$gangdata['gangNAME']}</u></h3>"; if($gangdata['gangPIC']) { print "[img={$gangdata[]"; } else Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 3, 2008 Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add Did you *really* read the error message ... ? Have you checked globals.php Have you read the manual pages on session_start() ? You're not really supplying much information here... Plus your code is (like most) very difficult to read - Indent dear boy, saves us a lot of time ;) BTW, running a sentinel "above" PHP can help a lot here - buffer all output with an execution callback, setup a new error handler, let the system run. In the callback create a div with any and all errors including a stack trace and insert that just after the <body ...> tag. Simple. Quote Link to comment Share on other sites More sharing options...
misterme Posted May 3, 2008 Author Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add What this page? http://www.php.net/session_start Nope lol.............No Really Its not so much as a resolution as it is why this coding will not work in conjunction with other forms of the same php, what I mean by that is altering anything other is advice to which I will take into consideration. The issue I could not understand is why this would give a session error, considering nothing (that I could tell) as far as the variables with the PHP has changed considering the page worked correctly before adding the Banner add with no header error whatsoever, using the same globals page to control many other pages in the game, when I remove the coding the page is fine, so that led me to believe that the coding itself was off, so after much investigation onto the page noted above, and countless times of looking over the code added I could not find the error, as to what baffles me. The advise you give does make sense, but why should all that have to be altered in order to make an additional 5 lines of coding that causes the header error, perhaps you could elaborate on this some. BTW I do know its the coding of function gang_staff_pic() { global $ir,$c,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid || $userid==1) { if(isset($_POST['subm'])) { $_POST['vp']=str_replace(array("<", ">", "\n","\'"), array("<", ">", " ","'"), $_POST['vp']); mysql_query("UPDATE gangs SET gangPIC='{$_POST['vp']}' WHERE gangID={$gangdata['gangID']}",$c); print "Gang pic changed! [url='yourgang.php?action=staff']> Back[/url]"; } else { print "Current Pic: "; if($gangdata['gangPIC']) { print "[img={$gangdata[]"; } else { print "[b]No Gang Picture[/b]"; } print"<hr /> <form action='yourgang.php?action=staff&act2=pic' method='post'> Please note that the pic must be externally hosted, [url='http://imageshack.us']ImageShack[/url] is our recommendation. Any pics that are not 468x60 will be automatically resized. <input type='hidden' name='subm' value='submit' /> tag: <input type='text' name='vp' value='http://www.domain.com/yourpic.jpg' /> <input type='submit' value='Change' /></form>"; } } As I added each of the suggested lines of coding and testing for the header errors trying to indeed figure the issue Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 3, 2008 Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add Well I advice then looking at the page which is generating the error... Trace ALL included files backup (recursively) Make sure you use include_once or require_once instead of include Clean your code up, make every public facing page require_once a "prepend.php" script which initiates the sessions and preloads any other includes. Try using @ before the session_start(); could well be multiple starts (I believe there was that fault somewhere in MCcodes) Try running curl - fetch the page and export to a text file - have a look at that file - is there anything odd early on. Quote Link to comment Share on other sites More sharing options...
misterme Posted May 3, 2008 Author Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add Thank YOU Nyna !!!! :mrgreen: I tried all that you had suggested, although being a simple solution as the @ symbol weird but worked, Thank You for the tips, now if youll kindly contribute to my bank account as I need Rogaine for hair I pulled out over this, I appreciate the help!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 3, 2008 Share Posted May 3, 2008 Re: Frustrated with Gang Banner Add You want me to contribute to your bank account ... for me helping you ... Now how does this work? I've said it before, and I'll say it again... RTFM ... in fact RATFM - Thats Read ALL the Flippin' Manual ;) The @ operator is fine for a quick fix, but is *NOT* the solution. Yes, I can use it my code, however I don't - ever. I check ALL operations before attempting them. That way I know the environment is in a safe and stable state. Quote Link to comment 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.