Exemplo n.º 1
0
    public static function loadVotingLinks()
    {
        connect::selectDB('webdb');
        $result = mysql_query("SELECT * FROM votingsites ORDER BY id DESC");
        if (mysql_num_rows($result) == 0) {
            buildError("Couldnt fetch any voting links from the database. " . mysql_error());
        } else {
            while ($row = mysql_fetch_assoc($result)) {
                ?>
            <div class='votelink'>
            <table width="100%">
                <tr>
                    <td width="20%"><img src="<?php 
                echo $row['image'];
                ?>
" /></td>
                    <td width="50%"><strong><?php 
                echo $row['title'];
                ?>
</strong> (<?php 
                echo $row['points'];
                ?>
 Vote Points)<td>
                    <td width="40%">
					<?php 
                if (website::checkIfVoted($row['id']) == FALSE) {
                    ?>
                    		<input type='submit' value='Vote'  onclick="vote('<?php 
                    echo $row['id'];
                    ?>
',this)">
					<?php 
                } else {
                    $getNext = mysql_query("SELECT next_vote FROM " . $GLOBALS['connection']['webdb'] . ".votelog\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE userid='" . account::getAccountID($_SESSION['cw_user']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t AND siteid='" . $row['id'] . "' ORDER BY id DESC LIMIT 1");
                    $row = mysql_fetch_assoc($getNext);
                    $time = $row['next_vote'] - time();
                    echo 'Time until reset: ' . convTime($time);
                }
                ?>
                         </td>
                     </tr>
              </table>
              </div>
			  <?php 
            }
        }
    }
Exemplo n.º 2
0
    public static function serverStatus($realm_id)
    {
        //Get status
        $fp = fsockopen($GLOBALS['realms'][$realm_id]['host'], $GLOBALS['realms'][$realm_id]['port'], $errno, $errstr, 1);
        if (!$fp) {
            echo $status = '<h4 class="realm_status_title_offline">' . $GLOBALS['realms'][$realm_id]['name'] . ' -  Offline</h4>';
        } else {
            echo $status = '<h4 class="realm_status_title_online">' . $GLOBALS['realms'][$realm_id]['name'] . ' - Online</h4>';
            echo '<span class="realm_status_text">';
            /* Players online bar */
            if ($GLOBALS['serverStatus']['factionBar'] == TRUE) {
                connect::connectToRealmDB($realm_id);
                $getChars = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1");
                $total_online = mysql_result($getChars, 0);
                $getAlliance = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1 AND race IN('3','4','7','11','1','22')");
                $alliance = mysql_result($getAlliance, 0);
                $getHorde = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1 AND race IN('2','5','6','8','10','9')");
                $horde = mysql_result($getHorde, 0);
                if ($total_online == 0) {
                    $per_alliance = 50;
                    $per_horde = 50;
                } else {
                    if ($alliance == 0) {
                        $per_alliance = 0;
                    } else {
                        $per_alliance = round($alliance / $total_online * 100);
                    }
                    if ($horde == 0) {
                        $per_horde = 0;
                    } else {
                        $per_horde = round($horde / $total_online * 100);
                    }
                }
                if ($per_alliance + $per_horde > 100) {
                    $per_horde = $per_horde - 1;
                }
                ?>
           <div class='srv_status_po'>
                  <div class='srv_status_po_alliance' style="width: <?php 
                echo $per_alliance;
                ?>
%;"></div>
                  <div class='srv_status_po_horde' style="width: <?php 
                echo $per_horde;
                ?>
%;"></div>
                  <div class='srv_status_text'>Alliance: <?php 
                echo $alliance;
                ?>
 &nbsp;  Horde: <?php 
                echo $horde;
                ?>
</div>
           </div>
	   <?php 
            }
            echo '<table width="100%"><tr>';
            //Get players online
            if ($GLOBALS['serverStatus']['playersOnline'] == TRUE) {
                connect::connectToRealmDB($realm_id);
                $getChars = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1");
                $pOnline = mysql_result($getChars, 0);
                echo '<td>
					<b>', $pOnline, '</b> Players online
				  </td>';
            }
            //Get uptime
            if ($GLOBALS['serverStatus']['uptime'] == TRUE) {
                connect::selectDB('logondb');
                $getUp = mysql_query("SELECT starttime FROM uptime WHERE realmid='" . $realm_id . "' ORDER BY starttime DESC LIMIT 1");
                $row = mysql_fetch_assoc($getUp);
                $time = time();
                $uptime = $time - $row['starttime'];
                echo '
			       <td>
			       	   <b>' . convTime($uptime) . '</b> uptime
				   </td>
			       </tr>';
            }
        }
        if ($GLOBALS['serverStatus']['nextArenaFlush'] == TRUE) {
            //Arena flush
            connect::connectToRealmDB($realm_id);
            $getFlush = mysql_query("SELECT value FROM worldstates WHERE comment='NextArenaPointDistributionTime'");
            $row = mysql_fetch_assoc($getFlush);
            $flush = date('d M H:i', $row['value']);
            echo '<tr>
		 	   <td>
			   	   Next arena flush: <b>' . $flush . '</b>
			   </td>';
        }
        echo '</tr>
	      </table>
		  </span>';
    }