Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. 'headers already sent' -> one solution remove all output before calling session_start(); (also do not put session_start(); on top of every page, this is not recommended!) or use ob_start(); $buffer = ob_get_contents(); ob_end_flush(); and only call session_start(); whenever you need some session variables do not forget to use session_close(); after. You can also put all session variables in the global scope ($GLOBALS) however again do this only when you have a script like: $protects = array('_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_ENV', 'GLOBALS', '_SESSION'); foreach ($protects as $protect) { if ( in_array($protect , array_keys($_REQUEST)) || in_array($protect , array_keys($_GET)) || in_array($protect , array_keys($_POST)) || in_array($protect , array_keys($_COOKIE)) || in_array($protect , array_keys($_FILES))) { die("Invalid Request."); } } to protect what is inside your global scope. Kinda will solve your first problem... problem2: 'gilman69_poker' is not recognized as a host -> check your configuration... (normally this would be localhost) I said normally... classes and templates... really gets rid of all the fuss :)
  2. function getRank( $start, $stop ){ global $dbResource; // <- output from mysql_connect( bla... ); $arr = array(); for( $curRank = $start; $start<$stop; $curRank++ ){ $query = "SELECT count( `rank` ) as `userRank` FROM `users` WHERE rank='.$curRank.'"; $resource = mysql_query( $query, $dbResource ); while( false !== ( $userRank = mysql_fetch_array( $resource ))){ $arr[$curRank] = $userRank; } } asort( $arr ); return $arr; } $rankings = getRank( 0, 8 ); if( is_array( $rankings )){ for( $i=0; $i < count( $rankings ); $i++ ){ print(' ...data.comes.here...'.$rankings[$i].'...and.so.on... '); } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.