Exemple #1
0
 public function checkForRunepage($uid, $runepage)
 {
     if (count($this->db->where('user_id', $uid)->get('RunePageVerification')) > 0) {
         if (count($this->db->where('runepage_string', $runepage)->where('user_id', $uid)->get('RunePageVerification')) > 0) {
             $returned = $this->getUserRunepage($uid);
             if ($returned === false) {
                 return false;
             }
             $validRunepage = false;
             foreach ($returned->{$uid}->pages as $summonerRunepage) {
                 if ($summonerRunepage->name == $runepage) {
                     $validRunepage = true;
                 }
             }
             if ($validRunepage) {
                 if (count($this->db->where('summonerID', $uid)->get('Users')) == 0) {
                     $userUUID = genString::random32();
                     $data = array('uuid' => $userUUID, 'summonerID' => htmlspecialchars($uid));
                     $this->db->insert('Users', $data);
                     return true;
                 } else {
                     return true;
                 }
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemple #2
0
 public function searchForUser($username)
 {
     $this->username = $username;
     if ($response = @file_get_contents('https://global.api.pvp.net/api/lol/' . strtolower($this->region) . '/v1.4/summoner/by-name/' . htmlspecialchars($username) . '?summonerName=' . $username . '&api_key=' . $this->key)) {
         $response = json_decode($response);
         return json_encode([$response->{strtolower($username)}->id, genString::random8()]);
     } else {
         responder::sendResponse(400);
     }
 }