public function addServer()
 {
     if ($this->validateFields()) {
         try {
             $query = new \Classes\MinecraftServerPing($this->ip_address, $this->port);
             $info = $query->Query();
         } catch (\Classes\MinecraftPingException $e) {
             $this->data['error'][] = 'За да бъде записан,сървърът трябва да е ОНЛАЙН.';
             return false;
         }
         $sql = 'SELECT server_id FROM servers WHERE ip_address=? AND port=?';
         $sth = $this->db->prepare($sql);
         $sth->execute(array($this->ip_address, $this->port));
         if ($sth->rowCount() != 0) {
             $this->data['error'][] = 'Има вече сървър с такова IP:Port';
             return false;
         } else {
             if ($this->server_name == null) {
                 $this->server_name = $info['motd'];
             }
             $sql = 'INSERT INTO servers (ip_address,port,motd,description,tags,user_id,youtubevid,favicon,website,players,maxplayers,status) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)';
             $sth = $this->db->prepare($sql);
             $user_id = \Frame\Application::getInstance()->getSession()->user_info['user_id'];
             $sth->execute(array($this->ip_address, $this->port, $this->server_name, $this->description, $this->tags, $user_id, $this->youtubeVideo, $info['favicon'], $this->website, $info['players'], $info['maxplayers'], $info['status']));
             $id = $this->db->lastInsertId();
             $this->data['message'][] = "Благодарим ви за добавянето на сървъра";
             $this->data['message'][] = 'Страница на сървъра: <a href="' . URL . $id . '-' . \Classes\Common::createSlug($this->server_name) . '">ТУК</a>';
         }
     } else {
         return false;
     }
 }
示例#2
0
            <a class="button" style="width:120px;height:22px;font-size: 16px" href="<?php 
echo URL . 'vote/' . $this->data['server_info']['server_id'];
?>
">Гласувай</a>
        </div>
    </div>


    <div id="tab5" class="tab"><span class="tab-h">Server Baner</span>
        <img alt="Server Baner" style="display:block;margin-left: 5px;" src="<?php 
echo URL . $this->data['server_info']['server_id'] . '-' . \Classes\Common::createSlug($this->data['server_info']['motd']) . '.png';
?>
">
        <textarea style="margin-top:15px;width: 700px;height:100px;font-size:15px;" onClick="this.select()" readonly="readonly" 
                  ><a href="<?php 
echo URL . $this->data['server_info']['server_id'] . '-' . \Classes\Common::createSlug($this->data['server_info']['motd']) . '.png';
?>
" title="<?php 
echo $this->data['title'];
?>
" target="_blank"><img alt="Server baner" src="<?php 
echo URL . $this->data['server_info']['server_id'] . '.png';
?>
" /></a></textarea>
    </div>
</div>

<?php 
$this->script = <<<EOT
<script>
    \$(document).ready(function() {
示例#3
0
 public function json()
 {
     if ($_POST) {
         header('Content-Type: application/json');
         // escape your parameters to prevent sql injection
         $param = $_POST['term'];
         $options = array();
         // fetch a title for a better user experience maybe..
         $sth = $this->db->prepare("SELECT motd,server_id FROM servers\n\n        WHERE motd LIKE CONCAT('%' , ? , '%') ORDER BY status DESC,server_id DESC");
         $sth->execute(array($param));
         $servers = $sth->fetchAll();
         for ($i = 0; $i < count($servers); $i++) {
             $servers[$i]['slug'] = \Classes\Common::createSlug($servers[$i]['motd']);
         }
         echo json_encode($servers);
     } else {
         header('Location:' . URL . 'error');
     }
 }
        echo $name;
        ?>
" width="32" height="32" alt="<?php 
        echo $row['motd'];
        ?>
" src="<?php 
        echo URL;
        ?>
server/image/<?php 
        echo $row["server_id"];
        ?>
"></p></td>

            <td><a class="zag" href="<?php 
        echo URL;
        echo $row["server_id"] . '-' . \Classes\Common::createSlug($name);
        ?>
"> <?php 
        echo $name;
        ?>
</a><br><p class="podzag"><?php 
        echo $host . $port;
        ?>
</p>
            </td>
            <td style="width: 90px;text-align: center;" class="players<?php 
        echo $row["server_id"];
        ?>
"><p class="tdp"><?php 
        echo $row["players"] . '/ ' . $row["maxplayers"];
        ?>