PHP User::findEmail Examples

PHP User::findEmail - 4 examples found. These are the top rated real world PHP examples of User::findEmail extracted from open source projects. You can rate examples to help us improve the quality of examples.
 public function isEmailAlreadyRegister($emailId)
 {
     $userObj = new User();
     if ($userObj->findEmail($emailId) == 0) {
         return false;
     } else {
         return true;
     }
 }
Example #2
0
 $errors = array();
 $SQLVars = User::processForm($_REQUEST['userForm'], $errors);
 if (count($errors)) {
     throw new Exception(implode('. ', $errors));
 }
 unset($errors);
 $allowed = array('E-mail' => 'email', 'E-mail hiding' => 'hideEmail', 'Homepage' => 'homepage', 'Comment' => 'comment');
 $User->options->set($_REQUEST['userForm']);
 $User->options->load();
 $set = '';
 foreach ($allowed as $name => $SQLName) {
     if (!isset($SQLVars[$SQLName]) or $User->{$SQLName} == $SQLVars[$SQLName]) {
         continue;
     }
     if ($SQLName == 'email') {
         if (User::findEmail($SQLVars['email'])) {
             throw new Exception(l_t("The e-mail address '%s', is already in use. Please choose another.", $SQLVars['email']));
         }
         $Mailer->Send(array($SQLVars['email'] => $User->username), l_t('Changing your e-mail address'), l_t("Hello %s", $User->username) . ",<br><br>\r\n\r\n" . l_t("You can use this link to change your account's e-mail address to this one:") . "<br>\r\n" . libAuth::email_validateURL($SQLVars['email']) . "<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>\r\n" . l_t("Regards,<br>The webDiplomacy Gamemaster") . "<br>\r\n");
         $formOutput .= l_t('A validation e-mail was sent to the new address, containing a link which will confirm ' . 'the e-mail change. If you don\'t see it after a few minutes check your spam folder.');
         unset($SQLVars['email']);
         continue;
     } elseif ($SQLName == 'comment') {
         if ($User->{$SQLName} == $DB->msg_escape($SQLVars[$SQLName])) {
             continue;
         }
     }
     if ($set != '') {
         $set .= ', ';
     }
     $set .= $SQLName . " = '" . $SQLVars[$SQLName] . "'";
Example #3
0
				<li><input type="submit" class="form-submit" value="' . l_t('Send code') . '"></li>
				</ul>
			</form>';
        } elseif ($_REQUEST['forgotPassword'] == 2 && isset($_REQUEST['forgotUsername'])) {
            try {
                $forgottenUser = new User(0, $DB->escape($_REQUEST['forgotUsername']));
            } catch (Exception $e) {
                throw new Exception(l_t("Cannot find an account for the given username, please " . "<a href='logon.php?forgotPassword=1' class='light'>go back</a> and check your spelling."));
            }
            require_once l_r('objects/mailer.php');
            $Mailer = new Mailer();
            $Mailer->Send(array($forgottenUser->email => $forgottenUser->username), l_t('webDiplomacy forgotten password verification link'), l_t("You can use this link to get a new password generated:") . "<br>\r\n" . libAuth::email_validateURL($forgottenUser->email) . "&forgotPassword=3<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>");
            print '<p>' . l_t('An e-mail has been sent with a verification link, which will allow you to have your password reset. ' . 'If you can\'t find the e-mail in your inbox try your junk folder/spam-box.') . '</p>';
        } elseif ($_REQUEST['forgotPassword'] == 3 && isset($_REQUEST['emailToken'])) {
            $email = $DB->escape(libAuth::emailToken_email($_REQUEST['emailToken']));
            $userID = User::findEmail($email);
            $newPassword = base64_encode(rand(1000000000, 2000000000));
            $DB->sql_put("UPDATE wD_Users\r\n\t\t\t\tSET password=UNHEX('" . libAuth::pass_Hash($newPassword) . "')\r\n\t\t\t\tWHERE id=" . $userID . " LIMIT 1");
            print '<p>' . l_t('Thanks for verifying your address, this is your new password, which you can ' . 'change once you have logged back on:') . '<br /><br />

				<strong>' . $newPassword . '</strong></p>

				<p><a href="logon.php" class="light">' . l_t('Back to log-on prompt') . '</a></p>';
        }
    } catch (Exception $e) {
        print '<p class="notice">' . $e->getMessage() . '</p>';
    }
    print '</div>';
    libHTML::footer();
}
if (!$User->type['User']) {
Example #4
0
if (isset($_COOKIE['imageToken']) && isset($_REQUEST['imageText']) && isset($_REQUEST['emailValidate'])) {
    try {
        // Validate and send e-mail
        $imageToken = explode('|', $_COOKIE['imageToken'], 2);
        if (count($imageToken) != 2) {
            throw new Exception(l_t("A bad anti-script code was given, please try again"));
        }
        list($Hash, $Time) = $imageToken;
        if (md5(Config::$secret . $_REQUEST['imageText'] . $_SERVER['REMOTE_ADDR'] . $Time) != $Hash) {
            throw new Exception(l_t("An invalid anti-script code was given, please try again"));
        } elseif (time() - 3 * 60 > $Time) {
            throw new Exception(l_t("This anti-script code has expired, please submit it within 3 minutes"));
        }
        // The user's imageText is validated; he's not a robot. But does he have a real e-mail address?
        $email = trim($DB->escape($_REQUEST['emailValidate']));
        if (User::findEmail($email)) {
            throw new Exception(l_t("The e-mail address '%s', is already in use. Please choose another.", $email));
        }
        if (!libAuth::validate_email($email)) {
            throw new Exception(l_t("A first check of this e-mail is finding it invalid. Remember you need one to " . "play, and it will not be spammed or released."));
        }
        // Prelim checks look okay, lets send the e-mail
        $Mailer->Send(array($email => $email), l_t('Your new webDiplomacy account'), l_t("Hello and welcome!") . "<br><br>\r\n\r\n" . l_t("Thanks for validating your e-mail address; just use this link to create your new webDiplomacy account:") . "<br>\r\n" . libAuth::email_validateURL($email) . "<br><br>\r\n\r\n" . l_t("There are two main rules that we want you to be aware of:") . "<br>\r\n\r\n" . l_t("1. No Multi-Accounting") . "<br><br>\r\n\r\n" . l_t("You may only have one account, second accounts are not allowed under any circumstances, and will be banned. This may also lead to your first account also being banned.  If you forget your password, use the lost password finder here: http://www.webdiplomacy.net/logon.php?forgotPassword=1. If you are still unable to log in, contact the mods.") . "<br><br>\r\n\r\n" . l_t("2. No Meta-gaming") . "<br><br>\r\n\r\n" . l_t("You cannot play a public game with players that you know outside of the site. In doing so, you create an unfair environment for other players by giving yourself the opportunity to form alliances for reasons outside the game. This includes playing public games with family, friends, relatives, coworkers, or even joining a game with any player of a previous game with a predetermined intent to ally with or attack certain players.") . "<br><br>\r\n\r\n" . l_t("Because Diplomacy is a social game, we always encourage playing with friends. However, you should always do so in a private, password-protected game and make sure that every player knows about any real life connections before the game begins.") . "<br><br>\r\n\r\n" . l_t("The rest of the rules can be found here: http://www.webdiplomacy.net/rules.php") . "<br><br>\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br><br>\r\n\r\n" . l_t("Enjoy your new account!") . "<br>\r\n");
        $page = 'emailSent';
    } catch (Exception $e) {
        print '<div class="content">';
        print '<p class="notice">' . $e->getMessage() . '</p>';
        print '</div>';
        $page = 'validationForm';
    }
} elseif (isset($_REQUEST['emailToken'])) {