All pastes #608306 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-07-08 05:56 UTC
rendered paste body
//RBS         $battlesys = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "battlesys_battles WHERE pollid = '".$pollinfo['pollid']."'");         if($battlesys)         {             $votestowin = $battlesys['votestowin'];             $splitoptions = explode("|||", $pollinfo['options']);             $maxvotes = 0;             $leastvotes = 0;             foreach ($splitvotes as $number => $vote)             {                 global $maxvotes;                 global $leastvotes;                 global $splitoptions;                 if ( $vote > $maxvotes ) {                     $maxvotes = $vote;                     $winner = $splitoptions[$number];                     global $winner;                 }                 if ( $vote < $leastvotes or $vote == 0 ) {                     $leastvotes = $vote;                     $loser = $splitoptions[$number];                     global $loser;                 }             }             if ( $maxvotes >= $votestowin )             {                 $DB_site->query_first("UPDATE " . TABLE_PREFIX . "poll SET active = '0' WHERE pollid = '".$pollinfo['pollid']."'"); //close poll                 //$winnerinfo = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE username = '".$winner."'");                 $DB_site->query("UPDATE user SET bs_wins = bs_wins + 1 WHERE username = '".$winner."'");                 $DB_site->query("UPDATE user SET bs_loses = bs_loses + 1 WHERE username = '".$loser."'");                              }         }             //RBS