Exemplo n.º 1
0
 private static function check($username, $password)
 {
     $result = DriverManager::getConnection()->fetchAssoc('SELECT COUNT(1) AS total
         FROM mw_users WHERE username = :username AND
         password = :password
    ', ['username' => $username, 'password' => md5($password)]);
     return $result['total'] == 1;
 }
Exemplo n.º 2
0
 private static function check($username, $password)
 {
     $total = DriverManager::getConnection()->fetchColumn('SELECT COUNT(1) AS total
        FROM MEMB_INFO WHERE memb___id = :username AND
        memb__pwd = :password
    ', ['username' => $username, 'password' => $password]);
     return $total == 1;
 }
Exemplo n.º 3
0
 public static function count($where = null)
 {
     $where = $where !== null ? ' WHERE ' . $where : '';
     $total = DriverManager::getConnection()->fetchColumn('SELECT
         COUNT(1) AS total FROM Guild
     ' . $where);
     return $total;
 }
Exemplo n.º 4
0
 public function update($items = true)
 {
     DriverManager::getConnection()->executeUpdate('UPDATE warehouse
         SET
         Money = :money
         ' . ($items ? ', Items = 0x' . $this->generate() : '') . '
         WHERE AccountId = :account
     ', ['money' => $this->getMoney(), 'account' => $this->getAccount()->getUsername()]);
 }
Exemplo n.º 5
0
 public static function getMembersTeam()
 {
     $results = DriverManager::getConnection()->fetchAll('SELECT
         c.Name AS name,
         CASE WHEN s.ConnectStat > 0 and ac.GameIDC = c.Name THEN 1 ELSE 0 END as status
         FROM MEMB_STAT s
         INNER JOIN AccountCharacter ac ON (s.memb___id = ac.ID)
         INNER JOIN Character c ON (s.memb___id = c.AccountID)
         WHERE c.CtlCode > 7
     ');
     return $results;
 }
Exemplo n.º 6
0
 public static function save($key, $value = null)
 {
     if (is_array($key)) {
         foreach ($key as $k => $v) {
             static::save($k, $v);
         }
     } else {
         $type = '';
         if (is_array($value)) {
             $type = 'array';
         } elseif (is_bool($value)) {
             $type = 'boolean';
         }
         $result = DriverManager::getConnection()->fetchAssoc('SELECT * FROM mw_config WHERE config = :config', ['config' => $key]);
         if (empty($result)) {
             DriverManager::getConnection()->insert('mw_config', ['config' => $key, 'body' => is_array($value) ? json_encode($value) : htmlentities($value), 'type' => $type]);
         } else {
             DriverManager::getConnection()->update('mw_config', ['body' => is_array($value) ? json_encode($value) : htmlentities($value)], ['config' => $key]);
         }
     }
 }
Exemplo n.º 7
0
 public static function active($service)
 {
     DriverManager::getConnection()->update('mw_services', ['active' => true], ['service' => $service], ['boolean']);
 }
Exemplo n.º 8
0
 public function getQuery()
 {
     $qb = DriverManager::getConnection()->createQueryBuilder();
     $qb->select('s.ConnectStat AS connect_stat', 's.ConnectTM AS last_connection', 's.ServerName AS server', 'ac.GameIDC AS game_idc', 'c.Name AS name', 'c.cLevel AS level', 'c.Experience AS experience', 'c.Class AS class', 'c.PkLevel AS pk_level', 'c.PkCount AS pk_count', 'c.AccountID AS account', 'c.LevelUpPoint AS points', 'c.MapNumber AS map', 'c.MapPosY AS positionY', 'c.MapPosX AS positionX', 'c.CtlCode AS code', 'c.Strength AS strength', 'c.Dexterity AS agility', 'c.Vitality AS vitality', 'c.Energy AS energy', 'c.Money AS money', 'gm.G_Name AS guild', 'CASE WHEN s.ConnectStat > 0 and ac.GameIDC = c.Name THEN 1 ELSE 0 END as status')->from('Character', 'c')->leftJoin('c', 'AccountCharacter', 'ac', 'c.AccountID = ac.ID COLLATE DATABASE_DEFAULT')->leftJoin('c', 'MEMB_STAT', 's', 'c.AccountID = s.memb___id COLLATE DATABASE_DEFAULT')->leftJoin('c', 'GuildMember', 'gm', 'c.Name = gm.Name COLLATE DATABASE_DEFAULT')->setMaxResults(50)->orderBy('c.cLevel', 'DESC');
     return $qb;
 }
Exemplo n.º 9
0
 public function getQuery()
 {
     $qb = DriverManager::getConnection()->createQueryBuilder();
     $qb->select('G_Name as name', 'G_Mark as mark', 'G_Score as score', 'G_Master as master')->from('Guild', 'g')->orderBy('G_Score', 'DESC')->setMaxResults(50);
     return $qb;
 }
Exemplo n.º 10
0
 public static function exists($value, $table, $field)
 {
     $total = DriverManager::getConnection()->fetchColumn('SELECT COUNT(1) AS total FROM ' . $table . ' WHERE ' . $field . ' = :value', ['value' => $value]);
     return $total == 1;
 }
Exemplo n.º 11
0
 public function getAvaliableServices()
 {
     if (empty($this->_services)) {
         $avaliables = DriverManager::getConnection()->fetchAll('SELECT * FROM mw_services s
             WHERE (s.parent_id is null
             OR s.allowed = 1
             OR EXISTS (SELECT 1 FROM mw_viptype_services WHERE viptype = :viptype AND s.id = service_id))
             AND
             (s.active = 1)
             ORDER BY s.sequence
         ', ['viptype' => $this->getVipType()]);
         $services = [];
         foreach ($avaliables as $avaliable) {
             $services[$avaliable['service']] = $avaliable;
         }
         $this->_services = $services;
     }
     return $this->_services;
 }