public static function emailExist($email) { global $AUTH_DB; //get the column names for table accounts $columns = CORE_COLUMNS::get('accounts'); $res = $AUTH_DB->prepare("SELECT " . $columns['id'] . " FROM `" . $columns['self'] . "` WHERE `" . $columns['email'] . "` = :email LIMIT 1"); $res->bindParam(':email', $email, PDO::PARAM_STR); $res->execute(); $count = $res->rowCount(); if ($count > 0) { unset($res); return true; } unset($res); return false; }
if ($res->rowCount() > 0) { $Logs->append('[Error] This transaction id is a duplicate.'); $Logs->save(); exit; } unset($res); /*Verify that the money ware sent to our email*/ if ($_POST['receiver_email'] != $config['payments']['paypal']['email']) { $Logs->append('[Error] The payment receiver is not our e-mail address.'); $Logs->save(); exit; } /*log successsfull transaction*/ $Logs->append('[Success] Successful transaction, proceeding to user updates!'); //get the column names for table accounts $columns = CORE_COLUMNS::get('accounts'); /*get the account id*/ $res = $AUTH_DB->prepare("SELECT " . $columns['id'] . " FROM `" . $columns['self'] . "` WHERE `" . $columns['username'] . "` = :acc LIMIT 1;"); $res->bindParam(':acc', $Username, PDO::PARAM_STR); $res->execute(); if ($res->rowCount() == 0) { //log invalid account $Logs->SetLogType(TRANSACTION_LOG_TYPE_URGENT); $Logs->append('[Error] Invalid account, could not resolve the account id by username.'); $Logs->save(); exit; } else { //fetch $row = $res->fetch(PDO::FETCH_ASSOC); //save as var $accId = (int) $row[$columns['id']];
public static function register($username, $password, $email, $expansion = 2, $recruiter = 0) { global $AUTH_DB, $CORE, $SECURITY; //get the column names for table accounts $columns = CORE_COLUMNS::get('accounts'); //make the user pass hash $shapasshash = self::makeHash($username, $password); //get the time for the joindate $dateTime = $CORE->getTime(true); $joindate = $dateTime->format("Y-m-d H:i:s"); unset($dateTime); //get the visitor IP Address $lastip = $SECURITY->getip(); $insert = $AUTH_DB->prepare("INSERT INTO `" . $columns['self'] . "` (" . $columns['username'] . ", " . $columns['shapasshash'] . ", " . $columns['email'] . ", " . $columns['joindate'] . ", " . $columns['lastip'] . ", " . $columns['flags'] . ", " . $columns['recruiter'] . ") VALUES (:username, :passhash, :email, :joindate, :lastip, :flags, :recruiter);"); $insert->bindParam(':username', $username, PDO::PARAM_STR); $insert->bindParam(':passhash', $shapasshash, PDO::PARAM_STR); $insert->bindParam(':email', $email, PDO::PARAM_STR); $insert->bindParam(':joindate', $joindate, PDO::PARAM_STR); $insert->bindParam(':lastip', $lastip, PDO::PARAM_STR); $insert->bindParam(':flags', $expansion, PDO::PARAM_INT); $insert->bindParam(':recruiter', $recruiter, PDO::PARAM_INT); //make sure the query was executed without errors if ($insert->execute()) { $return = $AUTH_DB->lastInsertId(); } else { $return = false; } unset($insert); unset($columns); return $return; }
public function getOnline() { $columns = CORE_COLUMNS::get('characters'); //count the Alliance $res = $this->REALM_DB->prepare("SELECT COUNT(" . $columns['guid'] . ") AS a FROM `" . $columns['self'] . "` WHERE `" . $columns['online'] . "` = '1' AND `" . $columns['race'] . "` IN (1, 3, 4, 7, 11, 22)"); $res->execute(); $allyRes = $res->fetch(PDO::FETCH_ASSOC); unset($res); //Count the Horde $res = $this->REALM_DB->prepare("SELECT COUNT(" . $columns['guid'] . ") AS h FROM `" . $columns['self'] . "` WHERE `" . $columns['online'] . "` = '1' AND `" . $columns['race'] . "` IN (2, 5, 6, 8, 9, 10)"); $res->execute(); $hordeRes = $res->fetch(PDO::FETCH_ASSOC); unset($res); //get the count $allyCount = $allyRes['a']; $hordeCount = $hordeRes['h']; $totalCount = $allyCount + $hordeCount; return array('total' => $totalCount, 'alliance' => $allyCount, 'horde' => $hordeCount); }
public function ResolveGuild($guid) { //get the column translation $GMcolumns = CORE_COLUMNS::get('guild_member'); //find out if the char is a guild member $res = $this->DB->prepare("SELECT `" . $GMcolumns['guildid'] . "` AS guildid, `" . $GMcolumns['guid'] . "` AS guid FROM `" . $GMcolumns['self'] . "` WHERE `" . $GMcolumns['guid'] . "` = :guid LIMIT 1;"); $res->bindParam(':guid', $guid, PDO::PARAM_INT); $res->execute(); if ($res->rowCount() > 0) { //we are a member of a guild $row = $res->fetch(); unset($res); //get the column translation $GuildColumns = CORE_COLUMNS::get('guild'); //resolve the guild name $res2 = $this->DB->prepare("SELECT `" . $GuildColumns['name'] . "` AS name FROM `" . $GuildColumns['self'] . "` WHERE `" . $GuildColumns['guildid'] . "` = :guild LIMIT 1;"); $res2->bindParam(':guild', $row['guildid'], PDO::PARAM_INT); $res2->execute(); //check if we have found it if ($res2->rowCount() > 0) { //fetch $row2 = $res2->fetch(); unset($res2); //return both the name and guildid return array('guildid' => $row['guildid'], 'name' => $row2['name']); } else { return false; } } else { //we are not member of any guild return false; } unset($res); return false; }