当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerUtil::isMailValid方法代码示例

本文整理汇总了PHP中PlayerUtil::isMailValid方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerUtil::isMailValid方法的具体用法?PHP PlayerUtil::isMailValid怎么用?PHP PlayerUtil::isMailValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerUtil的用法示例。


在下文中一共展示了PlayerUtil::isMailValid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 function send()
 {
     $username = HTTP::_GP('username', '', UTF8_SUPPORT);
     $prenom = HTTP::_GP('prenom', '', UTF8_SUPPORT);
     $email = HTTP::_GP('email', '');
     $sujet = HTTP::_GP('sujet', 0);
     $message = HTTP::_GP('message', '');
     $errors = array();
     if (!PlayerUtil::isMailValid($email)) {
         $errors[] = t('registerErrorMailInvalid');
     }
     if (empty($email)) {
         $errors[] = t('registerErrorMailEmpty');
     }
     if (empty($username)) {
         $errors[] = t('registerErrorMailEmpty');
     }
     if (empty($message)) {
         $errors[] = t('registerErrorMailEmpty');
     }
     if (!empty($errors)) {
         $this->printMessage(implode("<br>\r\n", $errors), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
     }
     require 'includes/classes/Mail.class.php';
     $MailRAW = $GLOBALS['LNG']->getTemplate('email_vaild_contact');
     $MailContent = str_replace(array('{NAME}', '{FIRSTNAME}', '{EMAIL}', '{SUBJECT}', '{MESSAGE}', '{IP}'), array($username, $prenom, $email, $sujet, $message, $_SERVER['REMOTE_ADDR']), $MailRAW);
     $to = '(EMAIL)';
     $headers = 'From: ' . $email . '' . "\r\n";
     $headers .= 'Reply-To: ' . $email . '' . "\r\n";
     $headers .= "MIME-Version: 1.0\r\n";
     $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
     //Mail::send($to, $username, Config::get('game_name'), $MailContent);
     mail('(EMAIL)', Config::get('game_name'), $MailContent, $headers);
     $this->redirectTo('index.php?page=disclamer');
 }
开发者ID:fuding,项目名称:Antaris,代码行数:35,代码来源:ShowDisclamerPage.class.php

示例2: send

 function send()
 {
     global $LNG;
     $config = Config::get();
     if ($config->game_disable == 0 || $config->reg_closed == 1) {
         $this->printMessage($LNG['registerErrorUniClosed'], array(array('label' => $LNG['registerBack'], 'url' => 'javascript:window.history.back()')));
     }
     $userName = HTTP::_GP('username', '', UTF8_SUPPORT);
     $password = HTTP::_GP('password', '', true);
     $password2 = HTTP::_GP('passwordReplay', '', true);
     $mailAddress = HTTP::_GP('email', '');
     $mailAddress2 = HTTP::_GP('emailReplay', '');
     $rulesChecked = HTTP::_GP('rules', 0);
     $language = HTTP::_GP('lang', '');
     $referralID = HTTP::_GP('referralID', 0);
     $externalAuth = HTTP::_GP('externalAuth', array());
     if (!isset($externalAuth['account'], $externalAuth['method'])) {
         $externalAuthUID = 0;
         $externalAuthMethod = '';
     } else {
         $externalAuthUID = $externalAuth['account'];
         $externalAuthMethod = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $externalAuth['method']));
     }
     $errors = array();
     if (empty($userName)) {
         $errors[] = $LNG['registerErrorUsernameEmpty'];
     }
     if (!PlayerUtil::isNameValid($userName)) {
         $errors[] = $LNG['registerErrorUsernameChar'];
     }
     if (strlen($password) < 6) {
         $errors[] = $LNG['registerErrorPasswordLength'];
     }
     if ($password != $password2) {
         $errors[] = $LNG['registerErrorPasswordSame'];
     }
     if (!PlayerUtil::isMailValid($mailAddress)) {
         $errors[] = $LNG['registerErrorMailInvalid'];
     }
     if (empty($mailAddress)) {
         $errors[] = $LNG['registerErrorMailEmpty'];
     }
     if ($mailAddress != $mailAddress2) {
         $errors[] = $LNG['registerErrorMailSame'];
     }
     if ($rulesChecked != 1) {
         $errors[] = $LNG['registerErrorRules'];
     }
     $db = Database::get();
     $sql = "SELECT (\n\t\t\t\tSELECT COUNT(*)\n\t\t\t\tFROM %%USERS%%\n\t\t\t\tWHERE universe = :universe\n\t\t\t\tAND username = :userName\n\t\t\t) + (\n\t\t\t\tSELECT COUNT(*)\n\t\t\t\tFROM %%USERS_VALID%%\n\t\t\t\tWHERE universe = :universe\n\t\t\t\tAND username = :userName\n\t\t\t) as count;";
     $countUsername = $db->selectSingle($sql, array(':universe' => Universe::current(), ':userName' => $userName), 'count');
     $sql = "SELECT (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM %%USERS%%\n\t\t\tWHERE universe = :universe\n\t\t\tAND (\n\t\t\t\temail = :mailAddress\n\t\t\t\tOR email_2 = :mailAddress\n\t\t\t)\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM %%USERS_VALID%%\n\t\t\tWHERE universe = :universe\n\t\t\tAND email = :mailAddress\n\t\t) as count;";
     $countMail = $db->selectSingle($sql, array(':universe' => Universe::current(), ':mailAddress' => $mailAddress), 'count');
     if ($countUsername != 0) {
         $errors[] = $LNG['registerErrorUsernameExist'];
     }
     if ($countMail != 0) {
         $errors[] = $LNG['registerErrorMailExist'];
     }
     if ($config->capaktiv === '1') {
         require_once 'includes/libs/reCAPTCHA/recaptchalib.php';
         $recaptcha_challenge_field = HTTP::_GP('recaptcha_challenge_field', '');
         $recaptcha_response_field = HTTP::_GP('recaptcha_response_field', '');
         $resp = recaptcha_check_answer($config->capprivate, Session::getClientIp(), $recaptcha_challenge_field, $recaptcha_response_field);
         if (!$resp->is_valid) {
             $errors[] = $LNG['registerErrorCaptcha'];
         }
     }
     if (!empty($errors)) {
         $this->printMessage(implode("<br>\r\n", $errors), array(array('label' => $LNG['registerBack'], 'url' => 'javascript:window.history.back()')));
     }
     $path = 'includes/extauth/' . $externalAuthMethod . '.class.php';
     if (!empty($externalAuth['account']) && file_exists($path)) {
         require $path;
         $methodClass = ucwords($externalAuthMethod) . 'Auth';
         /** @var $authObj externalAuth */
         $authObj = new $methodClass();
         $externalAuthUID = 0;
         if ($authObj->isActiveMode() && $authObj->isValid()) {
             $externalAuthUID = $authObj->getAccount();
         }
     }
     if ($config->ref_active == 1 && !empty($referralID)) {
         $sql = "SELECT COUNT(*) as state FROM %%USERS%% WHERE id = :referralID AND universe = :universe;";
         $Count = $db->selectSingle($sql, array(':referralID' => $referralID, ':universe' => Universe::current()), 'state');
         if ($Count == 0) {
             $referralID = 0;
         }
     } else {
         $referralID = 0;
     }
     $validationKey = md5(uniqid('2m'));
     $sql = "INSERT INTO %%USERS_VALID%% SET\n\t\t\t\t`userName` = :userName,\n\t\t\t\t`validationKey` = :validationKey,\n\t\t\t\t`password` = :password,\n\t\t\t\t`email` = :mailAddress,\n\t\t\t\t`date` = :timestamp,\n\t\t\t\t`ip` = :remoteAddr,\n\t\t\t\t`language` = :language,\n\t\t\t\t`universe` = :universe,\n\t\t\t\t`referralID` = :referralID,\n\t\t\t\t`externalAuthUID` = :externalAuthUID,\n\t\t\t\t`externalAuthMethod` = :externalAuthMethod;";
     $db->insert($sql, array(':userName' => $userName, ':validationKey' => $validationKey, ':password' => PlayerUtil::cryptPassword($password), ':mailAddress' => $mailAddress, ':timestamp' => TIMESTAMP, ':remoteAddr' => Session::getClientIp(), ':language' => $language, ':universe' => Universe::current(), ':referralID' => $referralID, ':externalAuthUID' => $externalAuthUID, ':externalAuthMethod' => $externalAuthMethod));
     $validationID = $db->lastInsertId();
     $verifyURL = 'index.php?page=vertify&i=' . $validationID . '&k=' . $validationKey;
     if ($config->user_valid == 0 || !empty($externalAuthUID)) {
         $this->redirectTo($verifyURL);
     } else {
         require 'includes/classes/Mail.class.php';
//.........这里部分代码省略.........
开发者ID:bergi9,项目名称:2Moons,代码行数:101,代码来源:ShowRegisterPage.class.php

示例3: show

 function show()
 {
     global $USER, $CONF, $LNG, $UNI;
     $ranki = $GLOBALS['DATABASE']->query("SELECT `id`, s.total_rank, s.build_rank, s.tech_rank FROM " . USERS . " as u INNER JOIN " . STATPOINTS . " as s ON u.id = s.id_owner WHERE onlinetime < " . (TIMESTAMP - 15 * 24 * 60 * 60) . " AND bana = '0' LIMIT  5 ;");
     $balken = $GLOBALS['DATABASE']->countquery("SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . $UNI . " AND onlinetime > '" . (TIMESTAMP - 45 * 60) . "';");
     $länge2 = 365 / $CONF['users_amount'];
     $länge = $balken * $länge2;
     $RangeList = array();
     while ($StatRow = $GLOBALS['DATABASE']->fetch_array($ranki)) {
         $RangeList[] = array('id' => $StatRow['id'], 'total_rank' => $StatRow['total_rank'], 'build_rank' => $StatRow['build_rank'], 'tech_rank' => $StatRow['tech_rank']);
     }
     if ($_POST) {
         $userName = HTTP::_GP('username', '', UTF8_SUPPORT);
         $password = HTTP::_GP('password', '', true);
         $mailAddress = HTTP::_GP('email', '');
         $rulesChecked = HTTP::_GP('rules', 0);
         $id = HTTP::_GP('idc', '');
         $allowedTo = $GLOBALS['DATABASE']->query("SELECT `id`, onlinetime, authlevel FROM " . USERS . " WHERE id = " . $id . " ;");
         $allowedTo = $GLOBALS['DATABASE']->fetch_array($allowedTo);
         $errors = array();
         if (Config::get('game_disable') == 0 || Config::get('reg_closed') == 1) {
             $this->printMessage(t('registerErrorUniClosed'), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
         }
         //Esto es para verificar si existe ya un usuario con esa ip.
         if (empty($userName)) {
             $errors[] = t('registerErrorUsernameEmpty');
         }
         if ($allowedTo['onlinetime'] > TIMESTAMP - 15 * 24 * 60 * 60) {
             $errors[] = t('youcanttakeoverthisaccount');
         }
         if ($allowedTo['authlevel'] > 0) {
             $errors[] = t('adminaccount');
         }
         if (!PlayerUtil::isNameValid($userName)) {
             $errors[] = t('registerErrorUsernameChar');
         }
         if (strlen($password) < 6) {
             $errors[] = t('registerErrorPasswordLength');
         }
         if (!PlayerUtil::isMailValid($mailAddress)) {
             $errors[] = t('registerErrorMailInvalid');
         }
         if (empty($mailAddress)) {
             $errors[] = t('registerErrorMailEmpty');
         }
         if ($rulesChecked != 1) {
             $errors[] = t('registerErrorRules');
         }
         $countUsername = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*) \n\t\t\tFROM " . USERS . " \n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t);");
         $countMail = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND (\n\t\t\t\temail = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t\tOR email_2 = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t)\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND email = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t);");
         if ($countUsername != 0) {
             $errors[] = t('registerErrorUsernameExist');
         }
         if ($countMail != 0) {
             $errors[] = t('registerErrorMailExist');
         }
         if (!empty($errors)) {
             $this->printMessage(implode("<br>\r\n", $errors), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
         }
         $validationKey = md5(uniqid('2m'));
         $SQL = "UPDATE " . USERS . " SET\n\t\t\t\t`userName` = '" . $GLOBALS['DATABASE']->escape($userName) . "',\n\t\t\t\t`password` = '" . PlayerUtil::cryptPassword($password) . "',\n\t\t\t\t`email` = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "',\n\t\t\t\t`darkmatter` = '300000',\n\t\t\t\t`ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "' WHERE id = '" . $id . "' ;";
         $GLOBALS['DATABASE']->query($SQL);
         $vertifyURL = 'game.php?page=overview';
         if (Config::get('user_valid') == 0 || !empty($externalAuthUID)) {
             $this->redirectTo($vertifyURL);
         } else {
             require 'includes/classes/Mail.class.php';
             $MailSubject = t('registerMailVertifyTitle');
             $MailRAW = $GLOBALS['LNG']->getTemplate('email_vaild_reg');
             $MailContent = str_replace(array('{USERNAME}', '{PASSWORD}', '{GAMENAME}', '{GAMEMAIL}'), array($userName, $password, Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail')), $MailRAW);
             Mail::send($mailAddress, $userName, t('registerMailVertifyTitle', Config::get('game_name')), $MailContent);
             $this->printMessage(t('registerSendComplete'));
         }
     }
     $this->tplObj->assign_vars(array('RangeList' => $RangeList, 'reg_user' => $CONF['users_amount'], 'online_users' => $balken, 'balken'));
     $this->render('page.takeover.default.tpl');
 }
开发者ID:Decoder1978,项目名称:Xterium,代码行数:77,代码来源:ShowTakeOverPage.class.php

示例4: ShowCreatorPage

function ShowCreatorPage()
{
    global $LNG, $USER;
    $template = new template();
    switch ($_GET['mode']) {
        case 'user':
            $LNG->includeData(array('PUBLIC'));
            if ($_POST) {
                $UserName = HTTP::_GP('name', '', UTF8_SUPPORT);
                $UserPass = HTTP::_GP('password', '');
                $UserPass2 = HTTP::_GP('password2', '');
                $UserMail = HTTP::_GP('email', '');
                $UserMail2 = HTTP::_GP('email2', '');
                $UserAuth = HTTP::_GP('authlevel', 0);
                $Galaxy = HTTP::_GP('galaxy', 0);
                $System = HTTP::_GP('system', 0);
                $Planet = HTTP::_GP('planet', 0);
                $Language = HTTP::_GP('lang', '');
                $ExistsUser = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND username = '" . $GLOBALS['DATABASE']->sql_escape($UserName) . "') + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND username = '" . $GLOBALS['DATABASE']->sql_escape($UserName) . "')");
                $ExistsMails = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND (email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')) + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')");
                $errors = "";
                $config = Config::get(Universe::getEmulated());
                if (!PlayerUtil::isMailValid($UserMail)) {
                    $errors .= $LNG['invalid_mail_adress'];
                }
                if (empty($UserName)) {
                    $errors .= $LNG['empty_user_field'];
                }
                if (strlen($UserPass) < 6) {
                    $errors .= $LNG['password_lenght_error'];
                }
                if ($UserPass != $UserPass2) {
                    $errors .= $LNG['different_passwords'];
                }
                if ($UserMail != $UserMail2) {
                    $errors .= $LNG['different_mails'];
                }
                if (!PlayerUtil::isNameValid($UserName)) {
                    $errors .= $LNG['user_field_specialchar'];
                }
                if ($ExistsUser != 0) {
                    $errors .= $LNG['user_already_exists'];
                }
                if ($ExistsMails != 0) {
                    $errors .= $LNG['mail_already_exists'];
                }
                if (!PlayerUtil::isPositionFree(Universe::getEmulated(), $Galaxy, $System, $Planet)) {
                    $errors .= $LNG['planet_already_exists'];
                }
                if ($Galaxy > $config->max_galaxy || $System > $config->max_system || $Planet > $config->max_planets) {
                    $errors .= $LNG['po_complete_all2'];
                }
                if (!empty($errors)) {
                    $template->message($errors, '?page=create&mode=user', 10, true);
                    exit;
                }
                $Language = array_key_exists($Language, $LNG->getAllowedLangs(false)) ? $Language : $config->lang;
                PlayerUtil::createPlayer(Universe::getEmulated(), $UserName, PlayerUtil::cryptPassword($UserPass), $UserMail, $Language, $Galaxy, $System, $Planet, $LNG['fcm_planet'], $UserAuth);
                $template->message($LNG['new_user_success'], '?page=create&mode=user', 5, true);
                exit;
            }
            $AUTH = array();
            $AUTH[AUTH_USR] = $LNG['user_level'][AUTH_USR];
            if ($USER['authlevel'] >= AUTH_OPS) {
                $AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS];
            }
            if ($USER['authlevel'] >= AUTH_MOD) {
                $AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD];
            }
            if ($USER['authlevel'] >= AUTH_ADM) {
                $AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM];
            }
            $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'universe' => $LNG['mu_universe'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'lang_reg' => $LNG['lang_reg'], 'new_title' => $LNG['new_title'], 'Selector' => array('auth' => $AUTH, 'lang' => $LNG->getAllowedLangs(false))));
            $template->show('CreatePageUser.tpl');
            break;
        case 'moon':
            if ($_POST) {
                $PlanetID = HTTP::_GP('add_moon', 0);
                $MoonName = HTTP::_GP('name', '', UTF8_SUPPORT);
                $Diameter = HTTP::_GP('diameter', 0);
                $MoonPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT temp_max, temp_min, id_luna, galaxy, system, planet, planet_type, destruyed, id_owner FROM " . PLANETS . " WHERE id = '" . $PlanetID . "' AND universe = '" . Universe::getEmulated() . "' AND planet_type = '1' AND destruyed = '0';");
                if (!isset($MoonPlanet)) {
                    $template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true);
                    exit;
                }
                $moonId = PlayerUtil::createMoon(Universe::getEmulated(), $MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $MoonPlanet['id_owner'], 20, $_POST['diameter_check'] == 'on' ? NULL : $Diameter, $MoonName);
                if ($moonId !== false) {
                    $template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true);
                } else {
                    $template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true);
                }
                exit;
            }
            $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'universum' => $LNG['mu_universe'], 'po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back']));
            $template->show('CreatePageMoon.tpl');
            break;
        case 'planet':
            if ($_POST) {
                $id = HTTP::_GP('id', 0);
                $Galaxy = HTTP::_GP('galaxy', 0);
//.........这里部分代码省略.........
开发者ID:tatarysh,项目名称:2Moons,代码行数:101,代码来源:ShowCreatorPage.php

示例5: send

 function send()
 {
     $userName = HTTP::_GP('username', '', UTF8_SUPPORT);
     $password = HTTP::_GP('password', '', true);
     $mailAddress = HTTP::_GP('email', '');
     $language = HTTP::_GP('lang', '');
     $race = HTTP::_GP('race', '');
     $universum = HTTP::_GP('uni', 1);
     $referralID = HTTP::_GP('referralID', 0);
     $externalAuth = HTTP::_GP('externalAuth', array());
     if (!isset($externalAuth['account'], $externalAuth['method'])) {
         $externalAuthUID = 0;
         $externalAuthMethod = '';
     } else {
         $externalAuthUID = $externalAuth['account'];
         $externalAuthMethod = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $externalAuth['method']));
     }
     $errors = array();
     if (Config::get('game_disable') == 0 || Config::get('reg_closed') == 1) {
         $this->printMessage(t('registerErrorUniClosed'), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
     }
     if (empty($userName)) {
         $errors[] = t('registerErrorUsernameEmpty');
     }
     if (!PlayerUtil::isNameValid($userName)) {
         $errors[] = t('registerErrorUsernameChar');
     }
     if (strlen($password) < 6) {
         $errors[] = t('registerErrorPasswordLength');
     }
     if (!PlayerUtil::isMailValid($mailAddress)) {
         $errors[] = t('registerErrorMailInvalid');
     }
     /* if(!PlayerUtil::valid_mail($mailAddress)) {
     			$errors[]	= t('registerErrorMailInvalid2');
     		} */
     if (empty($mailAddress)) {
         $errors[] = t('registerErrorMailEmpty');
     }
     $countUsername = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*) \n\t\t\tFROM " . USERS . " \n\t\t\tWHERE universe = " . $universum . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $universum . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t);");
     $countMail = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS . "\n\t\t\tWHERE universe = " . $universum . "\n\t\t\tAND (\n\t\t\t\temail = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t\tOR email_2 = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t)\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $universum . "\n\t\t\tAND email = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t);");
     if ($countUsername != 0) {
         $errors[] = t('registerErrorUsernameExist');
     }
     if ($countMail != 0) {
         $errors[] = t('registerErrorMailExist');
     }
     if (Config::get('capaktiv') === '1') {
         require_once 'includes/libs/reCAPTCHA/recaptchalib.php';
         $resp = recaptcha_check_answer(Config::get('capprivate'), $_SERVER['REMOTE_ADDR'], $_REQUEST['recaptcha_challenge_field'], $_REQUEST['recaptcha_response_field']);
         if (!$resp->is_valid) {
             $errors[] = t('registerErrorCaptcha');
         }
     }
     if (!empty($errors)) {
         $this->printMessage(implode("<br>\r\n", $errors), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
     }
     if (!empty($externalAuth['account']) && file_exists('includes/extauth/' . $externalAuthMethod . '.class.php')) {
         require 'includes/extauth/' . $externalAuthMethod . '.class.php';
         $methodClass = ucwords($externalAuthMethod) . 'Auth';
         $authObj = new $methodClass();
         if (!$authObj->isActiveMode()) {
             $externalAuthUID = 0;
         }
         if (!$authObj->isVaild()) {
             $externalAuthUID = 0;
         }
         $externalAuthUID = $authObj->getAccount();
     }
     if (Config::get('ref_active') == 1 && !empty($referralID)) {
         $Count = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . USERS . " WHERE id = " . $referralID . " AND universe = " . $GLOBALS['UNI'] . ";");
         if ($Count == 0) {
             $referralID = 0;
         }
     } else {
         $referralID = 0;
     }
     $validationKey = md5(uniqid('2m'));
     $SQL = "INSERT INTO " . USERS_VALID . " SET\n\t\t\t\t`userName` = '" . $GLOBALS['DATABASE']->escape($userName) . "',\n\t\t\t\t`validationKey` = '" . $validationKey . "',\n\t\t\t\t`password` = '" . md5($password) . "',\n\t\t\t\t`email` = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "',\n\t\t\t\t`date` = '" . TIMESTAMP . "',\n\t\t\t\t`ip` = '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\t`language` = '" . $GLOBALS['DATABASE']->escape($language) . "',\n\t\t\t\t`race` = '" . $GLOBALS['DATABASE']->escape($race) . "',\n\t\t\t\t`universe` = " . $GLOBALS['UNI'] . ",\n\t\t\t\t`referralID` = " . $referralID . ",\n\t\t\t\t`externalAuthUID` = '" . $GLOBALS['DATABASE']->escape($externalAuthUID) . "',\n\t\t\t\t`externalAuthMethod` = '" . $externalAuthMethod . "';";
     $GLOBALS['DATABASE']->query($SQL);
     $validationID = $GLOBALS['DATABASE']->GetInsertID();
     $vertifyURL = 'index.php?page=vertify&i=' . $validationID . '&k=' . $validationKey;
     if (Config::get('user_valid') == 0 || !empty($externalAuthUID)) {
         $this->redirectTo($vertifyURL);
     } else {
         require 'includes/classes/Mail.class.php';
         $MailSubject = t('registerMailVertifyTitle');
         $MailRAW = $GLOBALS['LNG']->getTemplate('email_vaild_reg');
         $MailContent = str_replace(array('{USERNAME}', '{PASSWORD}', '{GAMENAME}', '{VERTIFYURL}', '{GAMEMAIL}'), array($mailAddress, $password, Config::get('game_name') . ' - ' . Config::get('uni_name'), HTTP_PATH . $vertifyURL, Config::get('smtp_sendmail')), $MailRAW);
         Mail::send($mailAddress, $userName, t('registerMailVertifyTitle', Config::get('game_name')), $MailContent);
         $this->printMessage(t('registerSendComplete'));
     }
 }
开发者ID:joancefet,项目名称:Beta7,代码行数:93,代码来源:ShowRegisterPage.class.php

示例6: send

 function send()
 {
     $userName = HTTP::_GP('username', '', UTF8_SUPPORT);
     $password = HTTP::_GP('password', '', true);
     $password2 = HTTP::_GP('passwordReplay', '', true);
     $captcha = HTTP::_GP('captcha', '');
     $mailAddress = HTTP::_GP('email', '');
     $rulesChecked = HTTP::_GP('reglement', 0);
     $condition = HTTP::_GP('condition', 0);
     $id_reprise = HTTP::_GP('id_reprise', 0);
     $nom_planete = HTTP::_GP('nom_planete', '');
     $stats_sql = 'SELECT DISTINCT u.*, s.total_points, p.name, a.ally_tag, a.ally_name FROM ' . USERS . ' as u
             INNER JOIN ' . STATPOINTS . ' as s ON s.id_owner = u.id
             LEFT JOIN ' . ALLIANCE . ' as a ON a.id = u.ally_id
             LEFT JOIN ' . PLANETS . ' as p ON p.id = u.id_planet
             WHERE s.`universe` = 1 AND u.id = ' . $id_reprise . ';';
     $query = $GLOBALS['DATABASE']->query($stats_sql);
     $errors = array();
     if (Config::get('reg_closed') == 1) {
         $this->printMessage(t('registerErrorUniClosed'), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
     }
     if ($_SESSION['code'] != $captcha) {
         $errors[] = t('registerErrorCaptchas');
     }
     while ($StatRow = $GLOBALS['DATABASE']->fetch_array($query)) {
         if ($StatRow['onlinetime'] > TIMESTAMP - 90 * 24 * 3600) {
             $errors[] = t('cannottakeover');
         }
     }
     if (empty($userName)) {
         $errors[] = t('registerErrorUsernameEmpty');
     }
     if (empty($nom_planete)) {
         $errors[] = t('registerErrorPlanetnameEmpty');
     }
     if (strlen($nom_planete) > 18) {
         $errors[] = t('registerErrorPlanetnametolong');
     }
     if (strlen($nom_planete) < 5) {
         $errors[] = t('registerErrorPlanetnametoshort');
     }
     if (!PlayerUtil::isNameValid($userName)) {
         $errors[] = t('registerErrorUsernameChar');
     }
     if (strlen($userName) < 3) {
         $errors[] = t('registerErroruserNameLength');
     }
     if (strlen($userName) > 16) {
         $errors[] = t('registerErroruserNameLength');
     }
     if (strlen($password) < 6) {
         $errors[] = t('registerErrorPasswordLength');
     }
     if (strlen($password) > 32) {
         $errors[] = t('registerErrorPasswordLength');
     }
     if ($password != $password2) {
         $errors[] = t('registerErrorPasswordSame');
     }
     if (!PlayerUtil::isMailValid($mailAddress)) {
         $errors[] = t('registerErrorMailInvalid');
     }
     if (!PlayerUtil::valid_mail($mailAddress)) {
         $errors[] = t('registerErrorMailInvalid2');
     }
     if (empty($mailAddress)) {
         $errors[] = t('registerErrorMailEmpty');
     }
     if ($rulesChecked != 1) {
         $errors[] = t('registerErrorRules');
     }
     if ($condition != 1) {
         $errors[] = t('registerErrorTerms');
     }
     $countUsername = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*) \n\t\t\tFROM " . USERS . " \n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND username = '" . $GLOBALS['DATABASE']->escape($userName) . "'\n\t\t);");
     $countMail = $GLOBALS['DATABASE']->getFirstCell("SELECT (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND (\n\t\t\t\temail = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t\tOR email_2 = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t\t)\n\t\t) + (\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM " . USERS_VALID . "\n\t\t\tWHERE universe = " . $GLOBALS['UNI'] . "\n\t\t\tAND email = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "'\n\t\t);");
     if ($countUsername != 0) {
         $errors[] = t('registerErrorUsernameExist');
     }
     if ($countMail != 0) {
         $errors[] = t('registerErrorMailExist');
     }
     if (!empty($errors)) {
         $this->printMessage(implode("<br>\r\n", $errors), NULL, array(array('label' => t('registerBack'), 'url' => 'javascript:window.history.back()')));
     }
     $validationKey = md5(uniqid('2m'));
     $SQL = "UPDATE " . USERS . " SET\n\t\t\t\t`username` = '" . $GLOBALS['DATABASE']->escape($userName) . "',\n\t\t\t\t`password` = '" . PlayerUtil::cryptPassword($password) . "',\n\t\t\t\t`email` = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "',\n\t\t\t\t`email_2` = '" . $GLOBALS['DATABASE']->escape($mailAddress) . "',\n\t\t\t\t`register_time` = '" . TIMESTAMP . "',\n\t\t\t\t`ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\t`validationKey` = '" . $validationKey . "',\n\t\t\t\t`lang` = 'en',\n\t\t\t\t`sexe` = '',\n\t\t\t\t`date_of_birth` = '0',\n\t\t\t\t`ref_id` = 0,\n\t\t\t\t`ref_bonus` = 0,\n\t\t\t\t`ref_bonus` = 0,\n\t\t\t\t`urlaubs_modus` = 0,\n\t\t\t\t`urlaubs_until` = 0 WHERE id = '" . $id_reprise . "';";
     $GLOBALS['DATABASE']->query($SQL);
     $validationID = $GLOBALS['DATABASE']->GetInsertID();
     $vertifyURL = 'index.php?page=vertifyr&k=' . $validationKey;
     require 'includes/classes/Mail.class.php';
     $MailSubject = t('registerMailVertifyTitle');
     $MailRAW = $GLOBALS['LNG']->getTemplate('email_vaild_reg');
     $MailContent = str_replace(array('{USERNAME}', '{PASSWORD}', '{GAMENAME}', '{VERTIFYURL}', '{GAMEMAIL}', '{EMAIL}', '{REGISTERIP}', '{PLANETNAME}'), array($userName, $password, Config::get('game_name') . ' - ' . Config::get('uni_name'), HTTP_PATH . $vertifyURL, Config::get('smtp_sendmail'), $mailAddress, $_SERVER['REMOTE_ADDR'], $nom_planete), $MailRAW);
     $headers = 'From: (EMAIL)' . "\r\n";
     $headers .= 'Reply-To: (EMAIL)' . "\r\n";
     $headers .= "MIME-Version: 1.0\r\n";
     $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
     //mail($mailAddress, t('registerMailVertifyTitle', Config::get('game_name')), $MailContent, $headers);
     Mail::send($mailAddress, $userName, t('registerMailVertifyTitle', Config::get('game_name')), $MailContent);
//.........这里部分代码省略.........
开发者ID:fuding,项目名称:Antaris,代码行数:101,代码来源:ShowResumePage.class.php


注:本文中的PlayerUtil::isMailValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。