本文整理汇总了PHP中validatePassword函数的典型用法代码示例。如果您正苦于以下问题:PHP validatePassword函数的具体用法?PHP validatePassword怎么用?PHP validatePassword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validatePassword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ValidateRegisterForm
function ValidateRegisterForm($post)
{
if (validateFirstName($post['firstName']) && validateLastName($post['lastName']) && validateEmail($post['email']) && validatePassword($post['password']) && validateConfirmPassword($post['confirmPassword']) && validateGender($post['gender']) && validateContactNumber($post['contactNumber']) && validateAddress($post['address'])) {
return true;
} else {
return false;
}
}
示例2: init
function init()
{
if ($this->esoTalk->user) {
redirect("");
}
global $language, $messages, $config;
$this->title = $language["Forgot your password"];
$this->esoTalk->addToHead("<meta name='robots' content='noindex, noarchive'/>");
// If we're on the second step (they've clicked the link in their email)
if ($hash = @$_GET["q2"]) {
// Get the user with this recover password hash
$result = $this->esoTalk->db->query("SELECT memberId FROM {$config["tablePrefix"]}members WHERE resetPassword='{$hash}'");
if (!$this->esoTalk->db->numRows($result)) {
redirect("forgotPassword");
}
list($memberId) = $this->esoTalk->db->fetchRow($result);
$this->setPassword = true;
// Validate the form if it was submitted
if (isset($_POST["changePassword"])) {
$password = @$_POST["password"];
$confirm = @$_POST["confirm"];
if ($error = validatePassword(@$_POST["password"])) {
$this->errors["password"] = $error;
}
if ($password != $confirm) {
$this->errors["confirm"] = "passwordsDontMatch";
}
if (!count($this->errors)) {
$passwordHash = md5($config["salt"] . $password);
$this->esoTalk->db->query("UPDATE {$config["tablePrefix"]}members SET resetPassword=NULL, password='{$passwordHash}' WHERE memberId={$memberId}");
$this->esoTalk->message("passwordChanged", false);
redirect("");
}
}
}
// If they've submitted their email for a password link, email them!
if (isset($_POST["email"])) {
// Find the member with this email
$result = $this->esoTalk->db->query("SELECT memberId, name, email FROM {$config["tablePrefix"]}members WHERE email='{$_POST["email"]}'");
if (!$this->esoTalk->db->numRows($result)) {
$this->esoTalk->message("emailDoesntExist");
return;
}
list($memberId, $name, $email) = $this->esoTalk->db->fetchRow($result);
// Set a special 'forgot password' hash
$hash = md5(rand());
$this->esoTalk->db->query("UPDATE {$config["tablePrefix"]}members SET resetPassword='{$hash}' WHERE memberId={$memberId}");
// Send the email
if (sendEmail($email, sprintf($language["emails"]["forgotPassword"]["subject"], $name), sprintf($language["emails"]["forgotPassword"]["body"], $name, $config["forumTitle"], $config["baseURL"] . makeLink("forgot-password", $hash)))) {
$this->esoTalk->message("passwordEmailSent", false);
redirect("");
}
}
}
示例3: validatePasswordHandle
public function validatePasswordHandle($password)
{
global $sourcedir;
require_once $sourcedir . '/Subs-Auth.php';
$passwordError = validatePassword($password, $regOptions['username'], array($regOptions['email']));
// Password isn't legal?
if ($passwordError != null) {
return false;
}
return true;
}
示例4: authAdmin
function authAdmin($username, $password)
{
global $config;
if (!checkLock("checkadmin")) {
return false;
}
if ($config['admin_username'] == $username && validatePassword($password, $config['admin_password'], $config['admin_passwordformat'])) {
return true;
} else {
lockAction("checkadmin");
return false;
}
}
示例5: UserSignUp
function UserSignUp()
{
if (isset($_POST['su-btn-submit'])) {
if (isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirm-password']) && isset($_POST['tos-checkbox'])) {
//Get submitted values
$email = validateEmail($_POST['email']) ? 1 : 0;
$user = validateUsername($_POST['username']) ? 1 : 0;
$password = validatePassword($_POST['password']) ? 1 : 0;
$password_hash = password_hash($_POST['password'], PASSWORD_DEFAULT);
$cf_pass = password_verify($_POST['confirm-password'], $password_hash) ? 1 : 0;
$tos_cb = $_POST['tos-checkbox'] ? 1 : 0;
}
}
}
示例6: verification
function verification($username, $password)
{
// On va récupérer l'utilisateur précis
$reponse = getUser($username);
// On vérifie si l'adresse email et mot de passe correspondent
if (validatePassword($username, $password)) {
$connected = true;
// le nom et le prénom servent à assurer à l'utilisateur qu'il est connecté
// et connecté avec le bon compte
$_SESSION['first_name'] = $reponse[0]['Prenom'];
$_SESSION['last_name'] = $reponse[0]['Nom'];
// nécessaire pour valider le niveau d'accès de l'utilisateur
$_SESSION['user_type'] = $reponse[0]['TypeUtilisateur'];
//nécessaire pour accéder à d'autres informations liées à l'utilisateur plus loin
// dans la session
$_SESSION['no_user'] = $reponse[0]['NoUtilisateur'];
} else {
$connected = false;
}
return $connected;
}
示例7: getDataErrors
function getDataErrors($data)
{
$messages = [];
if (empty($data['first_name']) || empty($data['last_name']) || empty($data['username']) || empty($data['password'])) {
$messages[] = 'Παρακαλούμε συμπληρώστε όλα τα πεδία';
return $messages;
}
if (!validateName($data['first_name'])) {
$messages[] = 'Το όνομα σας περιέχει μη επιτρεπτούς χαρακτήρες. Παρακαλούμε εισάγετε μόνο γράμματα της αλφαβήτας';
}
if (!validateName($data['last_name'])) {
$messages[] = 'Το επώνυμό σας περιέχει μη επιτρεπτούς χαρακτήρες. Παρακαλούμε εισάγετε μόνο γράμματα της αλφαβήτας';
}
if (!validateUsername($data['username'])) {
$messages[] = 'Το username σας περιέχει μη πετρεπτούς χαρακτήρες. Παρακαλούμε εισάγετε μόνο λατινικούς χαρακτήρες και αριθμούς';
}
if (!validateEmail($data['email'])) {
$messages[] = 'Το e-mail σας δεν είναι έγκυρο. Παρακούμε εισάγετε ένα έγκυρο e-mail.';
}
if (!validatePassword($data['password'])) {
$messages[] = 'Μη επιτρεπτός κωδικός. Ο κωδικός σας πρέπει να περιλαμβάνει τουλάχιστον 8 ψηφία.';
}
return $messages;
}
示例8: validatePassword
<?php
if (isset($_POST["submit_update_user"])) {
$id = $_GET['id'];
$changepass = false;
//$username = $_POST['new_user_username'];
//$username = validateUserName($username) ? $_POST['new_user_username'] : false;
if (!empty($_POST['new_user_password'])) {
$changepass = true;
$bh_password = $_POST['new_user_password'];
$bh_password = validatePassword($bh_password) ? $_POST['new_user_password'] : false;
$password = passwordHash($bh_password);
}
$email = $_POST['new_user_email'];
//$vip = isset($_POST['new_user_vip']) ? 1 : 0;
$bp_role = $_POST['new_user_role'];
$bp_vip = $_POST['new_user_vip'];
if ($bp_vip == 0) {
$vip = 0;
$vip_start = null;
$vip_expire = null;
} elseif ($bp_vip == -1) {
$vip = -1;
$vip_start = $current_datetime;
$vip_expire = null;
} else {
$vip = $bp_vip;
$vip_start = strtotime($current_datetime);
$vip_expire = strtotime('+' . $vip . ' day', $vip_start);
$vip_start = $current_datetime;
$vip_expire = date('Y-m-d H:i:s', $vip_expire);
示例9: enter
<?php
echo '<html>';
echo '<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="public/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="public/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="public/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>';
enter();
echo '<form method="POST" action="http://localhost:8000">
<div class="form-group">
<label for="exampleInputLogin">Login:</label>
<input type="text" class="form-control" id="exampleInputLogin" name="login"/><br/>' . validateLogin($_REQUEST['login']) . '
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="text" class="form-control" id="exampleInputPassword" name="password"/></br>' . validatePassword($_REQUEST['password']) . '
</div>
<input type="submit" class="btn btn-default" value="Send"/>
</form>';
enter();
echo '<a href="/src/reg.php">Зарегистрируйтесь</a>';
echo '</html>';
/* http://getbootstrap.com/getting-started/#template - Sign-in page http://getbootstrap.com/examples/signin/ */
/*сделать форму регистрации*/
示例10: getPOST
$form['message'] = getPOST('message');
$form['captchaValue'] = getPOST('captchaValue');
$form['captchaId'] = getPOST('captchaId');
// Add datetime
date_default_timezone_set('Europe/Berlin');
$form['date'] = date("F j, Y, g:i a");
// Check for empty fields
foreach ($form as $key => $value) {
if (!$value) {
$errorMsg .= 'The field "' . $key . '" may not be empty.<br>';
}
}
if (!validateEmail($form['email'])) {
$errorMsg .= "Please check your email address entered.<br>";
}
if (!validatePassword($form['password'], $form['confirmPassword'])) {
$errorMsg .= "Passwords does not match.<br>";
}
if (!validateCaptcha($form['captchaValue'], $form['captchaId'])) {
$errorMsg .= "Please check captcha.<br>";
}
// Remember selectbox
for ($i == 1; $i < 4; $i++) {
if ($form['subject'] == $i) {
$formHelper['select' . $i] = "selected=selected";
}
}
## Store if validation was successful
if (!$errorMsg) {
// Save in textfile for demo reasons only.
// Passwords are not filtered and stored in plaintext, hash function with salt and pepper must be used!
示例11: registerMember
function registerMember(&$regOptions, $return_errors = false)
{
global $scripturl, $txt, $modSettings, $context, $sourcedir;
global $user_info, $options, $settings, $smcFunc;
loadLanguage('Login');
// We'll need some external functions.
require_once $sourcedir . '/lib/Subs-Auth.php';
require_once $sourcedir . '/lib/Subs-Post.php';
// Put any errors in here.
$reg_errors = array();
// Registration from the admin center, let them sweat a little more.
if ($regOptions['interface'] == 'admin') {
is_not_guest();
isAllowedTo('moderate_forum');
} elseif ($regOptions['interface'] == 'guest') {
// You cannot register twice...
if (empty($user_info['is_guest'])) {
redirectexit();
}
// Make sure they didn't just register with this session.
if (!empty($_SESSION['just_registered']) && empty($modSettings['disableRegisterCheck'])) {
fatal_lang_error('register_only_once', false);
}
}
// What method of authorization are we going to use?
if (empty($regOptions['auth_method']) || !in_array($regOptions['auth_method'], array('password', 'openid'))) {
if (!empty($regOptions['openid'])) {
$regOptions['auth_method'] = 'openid';
} else {
$regOptions['auth_method'] = 'password';
}
}
// No name?! How can you register with no name?
if (empty($regOptions['username'])) {
$reg_errors[] = array('lang', 'need_username');
}
// Spaces and other odd characters are evil...
$regOptions['username'] = preg_replace('~[\\t\\n\\r\\x0B\\0' . ($context['server']['complex_preg_chars'] ? '\\x{A0}' : " ") . ']+~u', ' ', $regOptions['username']);
// Don't use too long a name.
if (commonAPI::strlen($regOptions['username']) > 25) {
$reg_errors[] = array('lang', 'error_long_name');
}
// Only these characters are permitted.
if (preg_match('~[<>&"\'=\\\\]~', preg_replace('~&#(?:\\d{1,7}|x[0-9a-fA-F]{1,6});~', '', $regOptions['username'])) != 0 || $regOptions['username'] == '_' || $regOptions['username'] == '|' || strpos($regOptions['username'], '[code') !== false || strpos($regOptions['username'], '[/code') !== false) {
$reg_errors[] = array('lang', 'error_invalid_characters_username');
}
if (commonAPI::strtolower($regOptions['username']) === commonAPI::strtolower($txt['guest_title'])) {
$reg_errors[] = array('lang', 'username_reserved', 'general', array($txt['guest_title']));
}
// !!! Separate the sprintf?
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\\-/][0-9A-Za-z=_\'+\\-/\\.]*@[\\w\\-]+(\\.[\\w\\-]+)*(\\.[\\w]{2,6})$~', $regOptions['email']) === 0 || strlen($regOptions['email']) > 255) {
$reg_errors[] = array('done', sprintf($txt['valid_email_needed'], commonAPI::htmlspecialchars($regOptions['username'])));
}
if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false)) {
if ($regOptions['password'] == 'chocolate cake') {
$reg_errors[] = array('done', 'Sorry, I don\'t take bribes... you\'ll need to come up with a different name.');
}
$reg_errors[] = array('done', '(' . htmlspecialchars($regOptions['username']) . ') ' . $txt['name_in_use']);
}
// Generate a validation code if it's supposed to be emailed.
$validation_code = '';
if ($regOptions['require'] == 'activation') {
$validation_code = generateValidationCode();
}
// If you haven't put in a password generate one.
if ($regOptions['interface'] == 'admin' && $regOptions['password'] == '' && $regOptions['auth_method'] == 'password') {
mt_srand(time() + 1277);
$regOptions['password'] = generateValidationCode();
$regOptions['password_check'] = $regOptions['password'];
} elseif ($regOptions['password'] != $regOptions['password_check'] && $regOptions['auth_method'] == 'password') {
$reg_errors[] = array('lang', 'passwords_dont_match');
}
// That's kind of easy to guess...
if ($regOptions['password'] == '') {
if ($regOptions['auth_method'] == 'password') {
$reg_errors[] = array('lang', 'no_password');
} else {
$regOptions['password'] = sha1(mt_rand());
}
}
// Now perform hard password validation as required.
if (!empty($regOptions['check_password_strength'])) {
$passwordError = validatePassword($regOptions['password'], $regOptions['username'], array($regOptions['email']));
// Password isn't legal?
if ($passwordError != null) {
$reg_errors[] = array('lang', 'profile_error_password_' . $passwordError);
}
}
// If they are using an OpenID that hasn't been verified yet error out.
// !!! Change this so they can register without having to attempt a login first
if ($regOptions['auth_method'] == 'openid' && (empty($_SESSION['openid']['verified']) || $_SESSION['openid']['openid_uri'] != $regOptions['openid'])) {
$reg_errors[] = array('lang', 'openid_not_verified');
}
// You may not be allowed to register this email.
if (!empty($regOptions['check_email_ban'])) {
isBannedEmail($regOptions['email'], 'cannot_register', $txt['ban_register_prohibited']);
}
// Check if the email address is in use.
$request = smf_db_query('
SELECT id_member
//.........这里部分代码省略.........
示例12:
echo $styleInvalid;
}
?>
/>
<span class="formcheck" id="spanUsername"> </span><br />
<label>Password:</label>
<input type="password" name="PASSWORD" size="30" id="passwd" class="validates"
onfocus="pValid()" />
<span class="formcheck" id="spanP"></span><br />
<label>Confirm Password:</label>
<input type="password" name="CONFIRMPASSWORD" size="30" id="confirmPasswd" class="validates"
onkeyup="passwdValid()"
<?php
if (!validatePassword($password1, $password2)) {
echo $styleInvalid;
}
?>
/>
<span class="formcheck" id="spanPasswd"></span><br />
</fieldset>
<fieldset id="fieldYN">
Gender:
<input type="radio" name="GENDER" value="male" id="maleRadio" /><label class="noLabel" for="maleRadio">Male </label>
<input type="radio" name="GENDER" value="female" id="femaleRadio" /><label class="noLabel" for="femaleRadio">Female </label><?php
if (!validateGender($gender)) {
echo "*";
}
?>
示例13: authentication
function authentication($memID, $saving = false)
{
global $context, $cur_profile, $sourcedir, $txt, $post_errors, $modSettings;
loadLanguage('Login');
// We are saving?
if ($saving) {
// Moving to password passed authentication?
if ($_POST['authenticate'] == 'passwd') {
// Didn't enter anything?
if ($_POST['passwrd1'] == '') {
$post_errors[] = 'no_password';
} elseif (!isset($_POST['passwrd2']) || $_POST['passwrd1'] != $_POST['passwrd2']) {
$post_errors[] = 'bad_new_password';
} else {
require_once $sourcedir . '/Subs-Auth.php';
$passwordErrors = validatePassword($_POST['passwrd1'], $cur_profile['member_name'], array($cur_profile['real_name'], $cur_profile['email_address']));
// Were there errors?
if ($passwordErrors != null) {
$post_errors[] = 'password_' . $passwordErrors;
}
}
if (empty($post_errors)) {
// Integration?
call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd1']));
// Go then.
$passwd = sha1(strtolower($cur_profile['member_name']) . un_htmlspecialchars($_POST['passwrd1']));
// Do the important bits.
updateMemberData($memID, array('openid_uri' => '', 'passwd' => $passwd));
if ($context['user']['is_owner']) {
setLoginCookie(60 * $modSettings['cookieTime'], $memID, sha1(sha1(strtolower($cur_profile['member_name']) . un_htmlspecialchars($_POST['passwrd2'])) . $cur_profile['password_salt']));
}
redirectexit('action=profile;u=' . $memID);
}
return true;
} elseif ($_POST['authenticate'] == 'openid' && !empty($_POST['openid_identifier'])) {
require_once $sourcedir . '/Subs-OpenID.php';
$_POST['openid_identifier'] = smf_openID_canonize($_POST['openid_identifier']);
if (smf_openid_member_exists($_POST['openid_identifier'])) {
$post_errors[] = 'openid_in_use';
} elseif (empty($post_errors)) {
// Authenticate using the new OpenID URI first to make sure they didn't make a mistake.
if ($context['user']['is_owner']) {
$_SESSION['new_openid_uri'] = $_POST['openid_identifier'];
smf_openID_validate($_POST['openid_identifier'], false, null, 'change_uri');
} else {
updateMemberData($memID, array('openid_uri' => $_POST['openid_identifier']));
}
}
}
}
// Some stuff.
$context['member']['openid_uri'] = $cur_profile['openid_uri'];
$context['auth_method'] = empty($cur_profile['openid_uri']) ? 'password' : 'openid';
$context['sub_template'] = 'authentication_method';
}
示例14: count
<?php
include "validate.php";
$formSend = count($_POST) > 0;
$username = "";
$email = "";
if ($formSend) {
$usernameValid = validateUsername($_POST["username"]);
$emailValid = validateEmail($_POST["email"]);
$passwordValid = validatePassword($_POST["password"]);
$passwordCValid = validateCPassword($_POST["password"], $_POST["passwordC"]);
$username = htmlspecialchars($_POST["username"]);
$email = htmlspecialchars($_POST["email"]);
if ($usernameValid == "" && $emailValid == "" && $passwordValid == "" && $passwordCValid == "") {
header('Location: welcome.php?username=' . strip_tags($_POST["username"]));
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
<link type='text/css' rel='stylesheet' href='style.css'/>
<script src="jquery-2.1.4.min.js"></script>
<script src="jquery.validate.js"></script>
<script type="text/javascript" src="registration.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<header>
示例15: eval
eval("echo \"" . getTemplate("email/account_add") . "\";");
}
}
} else {
standard_error(array('allresourcesused', 'allocatetoomuchquota'), $quota);
}
} elseif ($action == 'changepw' && $id != 0) {
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int) $userinfo['customerid'] . "' AND `id`='" . (int) $id . "'");
if (isset($result['popaccountid']) && $result['popaccountid'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$password = validate($_POST['email_password'], 'password');
if ($password == '') {
standard_error(array('stringisempty', 'mypassword'));
exit;
}
$password = validatePassword($password);
$log->logAction(USR_ACTION, LOG_NOTICE, "changed email password for '" . $result['email_full'] . "'");
$result = $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET " . ($settings['system']['mailpwcleartext'] == '1' ? "`password` = '" . $db->escape($password) . "', " : '') . " `password_enc`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int) $userinfo['customerid'] . "' AND `id`='" . (int) $result['popaccountid'] . "'");
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
$result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result);
$account_changepw_data = (include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php');
$account_changepw_form = htmlform::genHTMLForm($account_changepw_data);
$title = $account_changepw_data['emails_accountchangepasswd']['title'];
$image = $account_changepw_data['emails_accountchangepasswd']['image'];
eval("echo \"" . getTemplate("email/account_changepw") . "\";");
}
}
} elseif ($action == 'changequota' && $settings['system']['mail_quota_enabled'] == '1' && $id != 0) {
$result = $db->query_first("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `u`.`quota` FROM `" . TABLE_MAIL_VIRTUAL . "` `v` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` ON(`v`.`popaccountid` = `u`.`id`)WHERE `v`.`customerid`='" . (int) $userinfo['customerid'] . "' AND `v`.`id`='" . (int) $id . "'");