本文整理汇总了PHP中make_password函数的典型用法代码示例。如果您正苦于以下问题:PHP make_password函数的具体用法?PHP make_password怎么用?PHP make_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mrt_sub1
function mrt_sub1()
{
?>
<div class=wrap>
<h2><?php
_e('WP - Password Tools');
?>
</h2>
<div style="height:299px">
<?php
echo "<br /><strong>Password Strength Tool</strong>";
?>
<table><tr valign=top><td><form name="commandForm">
Type password: <input type=password size=30 maxlength=50 name=password onkeyup="testPassword(document.forms.commandForm.password.value);" value="">
<br/><font color="#808080">Minimum 6 Characters</td><td><font size="1"> Password Strength:</font><a id="Words"><table><tr><td><table><tr><td height=4 width=150 bgcolor=tan></td></tr></table></td><td> <b>Begin Typing</b></td></tr></table></a></td></tr></table></td></tr></table></form>
<br /><hr align=left size=2 width=612px>
<?php
echo "<br /><br /><strong>Strong Password Generator</strong><br />";
echo "Strong Password: " . '<font color="red">' . make_password(15) . "</font>";
?>
</div>
Plugin by <a href="http://semperfiwebdesign.com/" title="Semper Fi Web Design">Semper Fi Web Design</a>
</div>
<?php
}
示例2: login
function login($lusername,$lpassword,$key,$lifetime=0){
global $set_username,$set_password,$set_loginauth,$set_loginkey;
if(empty($lusername)||empty($lpassword))
{
printerror("EmptyLoginUser","index.php");
}
//验证码
if(!$set_loginkey)
{
if($key<>getcvar('checkkey')||empty($key))
{
printerror("FailLoginKey","index.php");
}
}
if(md5($lusername)<>md5($set_username)||md5($lpassword)<>$set_password)
{
printerror("ErrorUser","index.php");
}
//认证码
if($set_loginauth&&$set_loginauth!=$_POST['loginauth'])
{
printerror("ErrorLoginAuth","index.php");
}
$logintime=time();
$rnd=make_password(12);
$s1=esetcookie("bakusername",$lusername,0);
$s2=esetcookie("bakrnd",$rnd,0);
$s3=esetcookie("baklogintime",$logintime,0);
Ebak_SCookieRnd($lusername,$rnd);
if(!$s1||!$s2)
{
printerror("NotOpenCookie","index.php");
}
printerror("LoginSuccess","admin.php");
}
示例3: registerUser
function registerUser($userInfo)
{
$errors = array();
$result = '';
if (empty($userInfo['name'])) {
$errors[] = 'Вы не ввели имя';
}
if (empty($userInfo['email'])) {
$errors[] = 'Вы не ввели email';
}
if (empty($userInfo['phone'])) {
$errors[] = 'Вы не ввели телефон';
}
if (empty($errors)) {
$user = new CUser();
$password = make_password(8);
$arFields = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "LOGIN" => $userInfo['email'], "ACTIVE" => "Y", "GROUP_ID" => array(6), "PASSWORD" => $password, "CONFIRM_PASSWORD" => $password, "PERSONAL_PHONE" => $userInfo['phone']);
$ID = $user->Add($arFields);
if (intval($ID) > 0) {
$result = "Вы успешно зарегистрированы.";
$arEventField = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "PASSWORD" => $password);
CEvent::SendImmediate("NEW_REG", "s1", $arEventField);
unset($_POST['user']);
global $USER;
global $APPLICATION;
$USER->Authorize($ID);
LocalRedirect($APPLICATION->GetCurPageParam('', array('user[name]', 'user[email]', 'ELEMENT_CODE', 'code')));
} else {
$errors[] = $user->LAST_ERROR;
}
}
return $errors;
}
示例4: QMReturnCheckPass
function QMReturnCheckPass($userid, $username, $email, $ecms = 1)
{
global $ecms_config;
$r['rnd'] = make_password(12);
$r['dotime'] = time();
$r['checkpass'] = md5(md5($r['rnd'] . '-' . $userid . '-' . $r['dotime'] . '-' . $ecms) . $ecms_config['cks']['ckrnd']);
$r['ecms'] = $ecms;
return $r;
}
示例5: mrt_sub1
function mrt_sub1()
{
mrt_wpss_menu_head('WP - Password Tools');
?>
<div class="metabox-holder">
<div class="postbox" style="width: 60%;">
<h3 class="hndle"><span><?php
echo __('Password Strength Tool');
?>
</span></h3>
<div class="inside">
<p></p>
<table id="wsd_pwdtool">
<tr valign="top">
<td>
<form name="commandForm">
Type password: <input type="password" size="30" maxlength="50" name="password" onkeyup="testPassword(this.value);" value="" />
<br/>
<span style="color:#808080">Minimum 6 Characters</span>
</form>
</td>
<td style="padding-left: 6px;">
<span>Password Strength:</span>
<div id="Words">
<p class="indicator"></p>
<p><strong>Begin Typing</strong></p>
</div>
</td>
</tr>
</table>
<p></p>
</div>
</div>
</div>
<div>
<?php
echo "<br /><strong>Strong Password Generator</strong><br />";
echo "Strong Password: " . '<span style="color:#f00;">' . make_password(15) . "</span>";
?>
</div>
<br/><br/>
<p style="margin-top: 75px;"></p>
<hr align="left" size="2" width="612px" />
<?php
mrt_wpss_menu_footer();
}
示例6: changePassword
public function changePassword($oldPwd, $newPwd)
{
$user = $this->getUser();
if (make_password($user->username, $oldPwd) != $user->password) {
return "旧密码不正确";
}
$newPwd = make_password($user->username, $newPwd);
$this->CI->load->model('company/Company_user_model', 'CompanyUserModel');
$where = array('id' => $user->id);
$rs = $this->CI->CompanyUserModel->update(array('password' => $newPwd), $where);
if ($rs == 1) {
return true;
}
return "修改密码失败";
}
示例7: auto_create_user
function auto_create_user($login, $password = false)
{
if ($login && defined('AUTH_AUTO_CREATE') && AUTH_AUTO_CREATE) {
$user_id = $this->find_user_by_login($login);
if (!$password) {
$password = make_password();
}
if (!$user_id) {
$login = $this->dbh->escape_string($login);
$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$pwd_hash = hash_password($password);
$query = "INSERT INTO ttrss_users\n (login,access_level,last_login,created,pwd_hash,salt)\n VALUES ('{$login}', 0, null, NOW(), '{$pwd_hash}','{$salt}')";
$this->dbh->query($query);
return $this->find_user_by_login($login);
}
return $user_id;
}
return $this->find_user_by_login($login);
}
示例8: pleac_Generating_Random_Numbers
function pleac_Generating_Random_Numbers()
{
// Techniques used here simply mirror Perl examples, and are not an endorsement
// of any particular RNG technique
// In PHP do this ...
$random = rand($lowerbound, $upperbound);
$random = rand($x, $y);
// ----------------------------
function make_password($chars, $reqlen)
{
$len = strlen($chars);
for ($i = 0; $i < $reqlen; $i++) {
$password .= substr($chars, rand(0, $len), 1);
}
return $password;
}
$chars = 'ABCDEfghijKLMNOpqrstUVWXYz';
$reqlen = 8;
$password = make_password($chars, $reqlen);
}
示例9: mrt_sub1
function mrt_sub1()
{
mrt_wpss_menu_head('WP - Password Tools');
?>
<div style="height:299px">
<?php
echo "<br /><strong>Password Strength Tool</strong>";
?>
<table><tr valign=top><td><form name="commandForm">
Type password: <input type=password size=30 maxlength=50 name=password onkeyup="testPassword(document.forms.commandForm.password.value);" value="">
<br/><font color="#808080">Minimum 6 Characters</td><td><font size="1"> Password Strength:</font><a id="Words"><table><tr><td><table><tr><td height=4 width=150 bgcolor=tan></td></tr></table></td><td> <b>Begin Typing</b></td></tr></table></a></td></tr></table></td></tr></table></form>
<br /><hr align=left size=2 width=612px>
<?php
echo "<br /><br /><strong>Strong Password Generator</strong><br />";
echo "Strong Password: " . '<font color="red">' . make_password(15) . "</font>";
?>
</div>
<?php
mrt_wpss_menu_footer();
}
示例10: resetUserPassword
static function resetUserPassword($uid, $show_password)
{
$result = db_query("SELECT login,email\n\t\t\t\tFROM ttrss_users WHERE id = '{$uid}'");
$login = db_fetch_result($result, 0, "login");
$email = db_fetch_result($result, 0, "email");
$salt = db_fetch_result($result, 0, "salt");
$new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$tmp_user_pwd = make_password(8);
$pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true);
db_query("UPDATE ttrss_users SET pwd_hash = '{$pwd_hash}', salt = '{$new_salt}', otp_enabled = false\n\t\t\t\tWHERE id = '{$uid}'");
if ($show_password) {
print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
} else {
print_notice(T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email));
}
require_once 'classes/ttrssmailer.php';
if ($email) {
require_once "lib/MiniTemplator.class.php";
$tpl = new MiniTemplator();
$tpl->readTemplateFromFile("templates/resetpass_template.txt");
$tpl->setVariable('LOGIN', $login);
$tpl->setVariable('NEWPASS', $tmp_user_pwd);
$tpl->addBlock('message');
$message = "";
$tpl->generateOutputToString($message);
$mail = new ttrssMailer();
$rc = $mail->quickMail($email, $login, __("[tt-rss] Password change notification"), $message, false);
if (!$rc) {
print_error($mail->ErrorInfo);
}
}
}
示例11: mb_strtolower
$login = mb_strtolower(trim(db_escape_string($_REQUEST["login"])));
$email = trim(db_escape_string($_REQUEST["email"]));
$test = trim(db_escape_string($_REQUEST["turing_test"]));
if (!$login || !$email || !$test) {
print_error(__("Your registration information is incomplete."));
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
return;
}
if ($test == "four" || $test == "4") {
$result = db_query("SELECT id FROM ttrss_users WHERE\n\t\t\t\tlogin = '{$login}'");
$is_registered = db_num_rows($result) > 0;
if ($is_registered) {
print_error(__('Sorry, this username is already taken.'));
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>";
} else {
$password = make_password();
$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$pwd_hash = encrypt_password($password, $salt, true);
db_query("INSERT INTO ttrss_users\n\t\t\t\t\t(login,pwd_hash,access_level,last_login, email, created, salt)\n\t\t\t\t\tVALUES ('{$login}', '{$pwd_hash}', 0, null, '{$email}', NOW(), '{$salt}')");
$result = db_query("SELECT id FROM ttrss_users WHERE\n\t\t\t\t\tlogin = '{$login}' AND pwd_hash = '{$pwd_hash}'");
if (db_num_rows($result) != 1) {
print_error(__('Registration failed.'));
print "<p><form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t</form>";
} else {
$new_uid = db_fetch_result($result, 0, "id");
initialize_user($new_uid);
$reg_text = "Hi!\n" . "\n" . "You are receiving this message, because you (or somebody else) have opened\n" . "an account at Tiny Tiny RSS.\n" . "\n" . "Your login information is as follows:\n" . "\n" . "Login: {$login}\n" . "Password: {$password}\n" . "\n" . "Don't forget to login at least once to your new account, otherwise\n" . "it will be deleted in 24 hours.\n" . "\n" . "If that wasn't you, just ignore this message. Thanks.";
$mail = new ttrssMailer();
$mail->IsHTML(false);
$rc = $mail->quickMail($email, "", "Registration information for Tiny Tiny RSS", $reg_text, false);
if (!$rc) {
示例12: register
function register($add)
{
global $empire, $dbtbpre, $public_r, $ecms_config;
//关闭注册
if ($public_r['register_ok']) {
printerror('CloseRegister', '', 1);
}
//验证时间段允许操作
eCheckTimeCloseDo('reg');
//验证IP
eCheckAccessDoIp('register');
if (!empty($ecms_config['member']['registerurl'])) {
Header("Location:" . $ecms_config['member']['registerurl']);
exit;
}
//已经登陆不能注册
if (getcvar('mluserid')) {
printerror('LoginToRegister', '', 1);
}
CheckCanPostUrl();
//验证来源
$username = trim($add['username']);
$password = trim($add['password']);
$username = RepPostVar($username);
$password = RepPostVar($password);
$email = RepPostStr($add['email']);
if (!$username || !$password || !$email) {
printerror("EmptyMember", "history.go(-1)", 1);
}
$tobind = (int) $add['tobind'];
//验证码
$keyvname = 'checkregkey';
if ($public_r['regkey_ok']) {
ecmsCheckShowKey($keyvname, $add['key'], 1);
}
$user_groupid = eReturnMemberDefGroupid();
$groupid = (int) $add['groupid'];
$groupid = empty($groupid) ? $user_groupid : $groupid;
CheckMemberGroupCanReg($groupid);
//IP
$regip = egetip();
$regipport = egetipport();
//用户字数
$pr = $empire->fetch1("select min_userlen,max_userlen,min_passlen,max_passlen,regretime,regclosewords,regemailonly from {$dbtbpre}enewspublic limit 1");
$userlen = strlen($username);
if ($userlen < $pr[min_userlen] || $userlen > $pr[max_userlen]) {
printerror('FaiUserlen', '', 1);
}
//密码字数
$passlen = strlen($password);
if ($passlen < $pr[min_passlen] || $passlen > $pr[max_passlen]) {
printerror('FailPasslen', '', 1);
}
if ($add['repassword'] !== $password) {
printerror('NotRepassword', '', 1);
}
if (!chemail($email)) {
printerror('EmailFail', '', 1);
}
if (strstr($username, '|') || strstr($username, '*')) {
printerror('NotSpeWord', '', 1);
}
//同一IP注册
eCheckIpRegTime($regip, $pr['regretime']);
//保留用户
toCheckCloseWord($username, $pr['regclosewords'], 'RegHaveCloseword');
$username = RepPostStr($username);
//重复用户
$num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$username}' limit 1");
if ($num) {
printerror('ReUsername', '', 1);
}
//重复邮箱
if ($pr['regemailonly']) {
$num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('email') . "='{$email}' limit 1");
if ($num) {
printerror('ReEmailFail', '', 1);
}
}
//注册时间
$lasttime = time();
$registertime = eReturnAddMemberRegtime();
$rnd = make_password(20);
//产生随机密码
$userkey = eReturnMemberUserKey();
//密码
$truepassword = $password;
$salt = eReturnMemberSalt();
$password = eDoMemberPw($password, $salt);
//审核
$checked = ReturnGroupChecked($groupid);
if ($checked && $public_r['regacttype'] == 1) {
$checked = 0;
}
//验证附加表必填项
$mr['add_filepass'] = ReturnTranFilepass();
$fid = GetMemberFormId($groupid);
$member_r = ReturnDoMemberF($fid, $add, $mr, 0, $username);
$sql = $empire->query("insert into " . eReturnMemberTable() . "(" . eReturnInsertMemberF('username,password,rnd,email,registertime,groupid,userfen,userdate,money,zgroupid,havemsg,checked,salt,userkey') . ") values('{$username}','{$password}','{$rnd}','{$email}','{$registertime}','{$groupid}','{$public_r['reggetfen']}','0','0','0','0','{$checked}','{$salt}','{$userkey}');");
//取得userid
//.........这里部分代码省略.........
示例13: unset
}
if (!isset($_SESSION['score'])) {
$_SESSION['score'] = 0;
}
if (isset($_POST['password']) && isset($_SESSION['password'])) {
if ($_POST['password'] == $_SESSION['password']) {
$_SESSION['score']++;
unset($_SESSION['password']);
echo "<p>You win !</p>";
} else {
echo "<p>You lose !</p>";
}
}
echo '<p>Score: ', $_SESSION['score'], '/1000';
if ($_SESSION['score'] >= 1000) {
echo "<p>The passphrase is: ", file_get_contents('/tmp/passphrase.txt'), "</p>";
}
$_SESSION['password'] = make_password();
?>
<div>
<?php
echo "<p>Captcha: " . $_SESSION['password'] . "</p>";
?>
</div>
<div>
<form method="POST">
<input name="password" type="text" />
<input type="submit" />
</form>
</div>
示例14: make_password
echo $ecms_config['cks']['ckrnd'];
?>
" size="35">
<input type="button" name="Submit32" value="随机" onclick="document.setform.cookieckrnd.value='<?php
echo make_password(36);
?>
';">
<font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF">COOKIE验证随机码2</td>
<td height="25" bgcolor="#FFFFFF"><input name="cookieckrndtwo" type="text" id="cookieckrndtwo" value="<?php
echo $ecms_config['cks']['ckrndtwo'];
?>
" size="35">
<input type="button" name="Submit322" value="随机" onclick="document.setform.cookieckrndtwo.value='<?php
echo make_password(36);
?>
';">
<font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF"></td>
<td height="25" bgcolor="#FFFFFF"> <input type="submit" name="Submit" value=" 设 置 ">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>
示例15: edit_icon
/**
* Edit Project Icon
*
* @param void
* @return null
*/
function edit_icon()
{
if ($this->active_project->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_project->canEdit($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
if (!extension_loaded('gd')) {
$message = lang('<b>GD not Installed</b> - GD extension is not installed on your system. You will not be able to upload project icons, company logos and avatars!');
if ($this->request->isAsyncCall()) {
echo "<p>{$message}</p>";
die;
} else {
$this->wireframe->addPageMessage($message, PAGE_MESSAGE_ERROR);
}
// if
}
// if
if ($this->request->isSubmitted()) {
if (!isset($_FILES['icon']) || !is_uploaded_file($_FILES['icon']['tmp_name'])) {
$message = lang('Please select an image');
if ($this->request->isAsyncCall()) {
$this->httpError(HTTP_ERR_OPERATION_FAILED, $message);
} else {
flash_error($message);
$this->redirectToUrl($this->active_project->getEditIconUrl());
}
// if
}
// if
if (can_resize_images()) {
$errors = new ValidationErrors();
do {
$from = WORK_PATH . '/' . make_password(10) . '_' . $_FILES['icon']['name'];
} while (is_file($from));
if (!move_uploaded_file($_FILES['icon']['tmp_name'], $from)) {
$errors->addError(lang("Can't copy image to work path"), 'icon');
} else {
if (FIX_UPLOAD_PERMISSION !== false) {
@chmod($from, FIX_UPLOAD_PERMISSION);
}
// if
// small avatar
$to = $this->active_project->getIconPath();
$small = scale_image($from, $to, 16, 16, IMAGETYPE_GIF);
// large avatar
$to = $this->active_project->getIconPath(true);
$large = scale_image($from, $to, 40, 40, IMAGETYPE_GIF);
@unlink($from);
}
// if
if (empty($from)) {
$errors->addError('Select icon', 'icon');
}
// if
if ($errors->hasErrors()) {
$this->smarty->assign('errors', $errors);
$this->render();
}
// if
cache_remove('project_icons');
}
// if
}
// if
}