All pastes #608308 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-07-08 05:59 UTC
rendered paste body
//RBS        $battlesys = $db->query_first("SELECT * FROM battlesys_battles WHERE pollid = '".$pollinfo['pollid']."'");         if($battlesys)         {             $votestowin = $battlesys['votestowin'];             $splitoptions = explode("|||", $pollinfo['options']);             $maxvotes = 0;             $leastvotes = 0;             //die(print_r($splitvotes, true));            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->query_first("UPDATE " . TABLE_PREFIX . "poll SET active = '0' WHERE pollid = '".$pollinfo['pollid']."'"); //close poll                 $winnerinfo = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE username = '".$winner."'");                 $db->query_write("UPDATE paranormal_user SET bs_wins = bs_wins + 1 WHERE username = '".$winner."'");                 $db->query_write("UPDATE paranormal_user SET bs_loses = bs_loses + 1 WHERE username = '".$loser."'");                              }         }             //RBS