本文整理汇总了PHP中pwdHash函数的典型用法代码示例。如果您正苦于以下问题:PHP pwdHash函数的具体用法?PHP pwdHash怎么用?PHP pwdHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwdHash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pwdHash
protected function pwdHash()
{
if (isset($_POST['password'])) {
return pwdHash($_POST['password']);
} else {
return false;
}
}
示例2: pwdHash
public function pwdHash($passwd)
{
if ($passwd) {
return pwdHash($passwd);
} else {
return false;
}
}
示例3: pwdHash
protected function pwdHash()
{
if (isset($_POST['password'])) {
$password = $_POST['password'] . getSalt();
return pwdHash($password);
} else {
return false;
}
}
示例4: checkLogin
public function checkLogin()
{
if (empty($_POST['account'])) {
$this->error('Bạn chưa nhập tài khoản!');
} elseif (empty($_POST['password'])) {
$this->error('Ban chưa nhập mật khẩu!');
} elseif ('' === trim($_POST['verify'])) {
$this->error('Bạn chưa nhập mã xác thực!');
}
//Generate the certification requirements
$map = array();
// Support the use of binding account login
$map['account'] = $_POST['account'];
$map["status"] = array('gt', 0);
if ($_SESSION['verify'] != md5($_POST['verify'])) {
$this->error('Mã xác thực không đúng!');
}
import('ORG.Util.RBAC');
$authInfo = RBAC::authenticate($map);
//Authentication using the user name, password, and the state
if (false === $authInfo) {
$this->error('Tài khoản không tồn tại hoặc đã bị khoá!');
} else {
if ($authInfo['password'] != pwdHash($_POST['password'])) {
$this->error('Mật khẩu không đúng!');
}
$_SESSION[C('USER_AUTH_KEY')] = $authInfo['id'];
$_SESSION['loginUserName'] = $authInfo['nickname'];
$_SESSION['lastLoginTime'] = $authInfo['last_login_time'];
$_SESSION['login_count'] = $authInfo['login_count'];
$_SESSION['user_type'] = $authInfo['type_id'];
if ($authInfo['account'] == 'admin') {
$_SESSION['administrator'] = true;
}
//Save login information
$User = M('User');
$ip = get_client_ip();
$time = time();
$data = array();
$data['id'] = $authInfo['id'];
$data['last_login_time'] = $time;
$data['login_count'] = array('exp', '(login_count+1)');
$data['last_login_ip'] = $ip;
$User->save($data);
$_SESSION['loginId'] = $loginId;
// Cache access rights
RBAC::saveAccessList();
$this->success('Đăng nhập thành công');
}
}
示例5: changePwd
public function changePwd()
{
$this->checkUser();
//对表单提交处理进行处理或者增加非表单数据
$map = array();
$map['password'] = pwdHash($_POST['oldpassword']);
if (isset($_POST['email'])) {
$map['email'] = $_POST['email'];
} elseif (isset($_SESSION[C('USER_AUTH_KEY')])) {
$map['id'] = $_SESSION[C('USER_AUTH_KEY')];
}
if (trim($_POST['repassword']) != trim($_POST['password'])) {
$this->error('两次密码不一致!');
}
//检查用户
$User = M("User");
$aa = $User->where($map)->find();
//echo $aa['id'];die();
if ($aa['id'] == '') {
$this->error('旧密码不符!');
} else {
$User->password = pwdHash($_POST['password']);
$User->save();
//echo "<script>alert('密码修改成功!');window.parent.location.reload();</script>";
$this->assign('jumpUrl', U("index"));
$this->success('密码修改成功!');
}
}
示例6: catch
try {
$query->execute([$_POST['newDpt'], $_POST['dept']]);
} catch (PDOException $e) {
if ($e->errorInfo[0] != 23000) {
// Ignoring if department already exists, reporting otherwise
postResponse("error", $e->errorInfo[2]);
}
}
$dept_code = strtoupper($_POST['newDpt']);
} else {
rangeCheck('dept', 2, 5);
$dept_code = strtoupper($_POST['dept']);
}
// Add faculty to the databases
$query = $db->prepare('INSERT INTO faculty(uName,fac_name,pswd,dept_code,dateRegd) VALUES (?,?,?,?,?)');
$pswd = pwdHash($uName, $_POST['pswd']);
try {
$query->execute(array($uName, $_POST['fullName'], $pswd, $dept_code, date("d M Y h:i A")));
} catch (PDOException $e) {
if ($e->errorInfo[0] == 23000) {
postResponse("error", "Username already exists");
} else {
postResponse("error", $e->errorInfo[2]);
}
}
if ($newAdmin) {
changeUserLevel($uName, 'dean');
$_SESSION['logged_in'] = true;
$_SESSION['uName'] = $uName;
$_SESSION['level'] = "dean";
$_SESSION['fName'] = $_POST['fullName'];
示例7: guiUserImport
//.........这里部分代码省略.........
//姓名
if ($v['C'] == "男") {
//性别
$saveMap['sex'] = 1;
} else {
if ($v['C'] == "女") {
$saveMap['sex'] = 0;
} else {
$saveMap['sex'] = "";
}
}
$saveMap['dept_id'] = $list['id'];
//部门
$saveMap['duty_id'] = $Duty['id'];
//职务
if ($v['F']) {
$saveMap['work_date'] = strtotime($v['F']);
//入职时间
} else {
$saveMap['work_date'] = "";
}
$saveMap['mobile'] = $v['G'];
$saveMap['email'] = $v['I'];
$saveMap['remark'] = $v['J'];
if ($auditduty) {
//有该职务的审核职级
$saveMap['auditduty'] = $auditduty['auditduty'];
//审核职级
} else {
$saveMap['auditduty'] = $Duty['id'];
//职位相同的审核职级
}
}
$saveMap['password'] = pwdHash(C('USER_DEFAULT_PASSWORD'));
if ($operation == "add") {
//操作类型是 新增
$saveMap['createid'] = $_SESSION[C('USER_AUTH_KEY')];
$saveMap['createtime'] = time();
$saveMap['employeid'] = $employeid['id'];
$result = $UserModel->add($saveMap);
//插入用户表
if (C('SWITCH_BASIC_ROLE_GROUP') == "On") {
foreach ($role as $rk => $rv) {
$roleMap["role_id"] = $rv;
$roleMap['user_id'] = $result;
$roleMap['companyid'] = $company['id'];
$roleMap['createtime'] = time();
$roleMap['createid'] = $_SESSION[C('USER_AUTH_KEY')];
$RoleUserModel->add($roleMap);
//插入基础权限组
unset($roleMap);
}
}
if (C('SWITCH_SENIOR_ROLE_GROUP') == "On") {
foreach ($roleGroup as $k1 => $v1) {
$roleGroupMap["rolegroup_id"] = $v1;
$roleGroupMap['user_id'] = $result;
$roleGroupMap['companyid'] = $company['id'];
$roleGroupMap['createtime'] = time();
$roleGroupMap['createid'] = $_SESSION[C('USER_AUTH_KEY')];
$RolegroupUserModel->add($roleGroupMap);
//插入高级权限组
unset($roleGroupMap);
}
}
} else {
示例8: chgpwd
public function chgpwd()
{
if (!$this->isPost()) {
$this->user('修改密码');
exit;
}
$id = getUserId();
$oldpassword = $this->_post('oldpassword', 'mysql_escape_string');
$password = $this->_post('password', 'mysql_escape_string');
$model = D("User");
$data = $model->where("id={$id}")->find();
//校验
if ($data['password'] == pwdHash($oldpassword . $data['salt'])) {
$data['salt'] = getSalt();
$data['password'] = pwdHash($password . $data['salt']);
$model->where("id={$id}")->save($data);
$this->success($model->getError());
} else {
$this->error("原密码错误!");
}
}
示例9: SetSystem
public function SetSystem()
{
$EmployeeId = $_GET['id'];
if ($EmployeeId) {
$User = D("User");
$Employee = D("Employee");
$EmployeeName = $Employee->where('id = ' . $EmployeeId)->getField('employeeName');
$data['account'] = $EmployeeName;
$data['userName'] = $EmployeeName;
$data['password'] = pwdHash('111111');
$data['create_time'] = time();
$data['status'] = '1';
$data['employeeID'] = $EmployeeId;
$UserId = $User->add($data);
$EmployeeData['id'] = $EmployeeId;
$EmployeeData['isSystemUser'] = 1;
$Employee->save($EmployeeData);
$this->assign('jumpUrl', Cookie::get('_currentUrl_'));
$this->success('设置成功!');
} else {
$this->error('设置失败!');
}
}
示例10: changePwd
public function changePwd()
{
$this->checkUser();
//对表单提交处理进行处理或者增加非表单数据
if (md5($_POST['verify']) != $_SESSION['verify']) {
$this->error('验证码错误!');
}
$map = array();
$map['password'] = pwdHash(I('oldpassword'));
if (isset($_SESSION['id'])) {
$map['id'] = $_SESSION['id'];
}
//检查用户
$User = M("Member");
if (!$User->where($map)->field('id')->find()) {
$this->error('输入的旧密码不正确!');
} else {
$User->password = pwdHash(I('password'));
$User->save();
$this->success('密码修改成功!');
}
}
示例11: checkPassword
public function checkPassword()
{
$this->checkUser();
//验证码
if (isset($_POST['verify'])) {
if ($_SESSION['verify'] != md5($_POST['verify'])) {
$this->error('验证码错误!');
}
} else {
//印象码
$YinXiangMa_response = $this->YinXiangMa_ValidResult(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']);
if ($YinXiangMa_response !== "true") {
$this->ajaxReturn('验证码错误', '验证码错误', 0);
}
}
$id = session('id');
if (empty($id)) {
$this->error('没有登录', U('Member/login'));
}
$password = I('password', '');
if ('' === $password) {
$this->error('新密码不能为空!');
}
$oldpassword = I('oldpassword', '');
if ('' === $oldpassword) {
$this->error('旧密码不能为空!');
}
//检查用户
$User = M("Member");
if (!$User->where(array('id' => $id, 'password' => pwdHash($oldpassword)))->find()) {
$this->error('旧密码输入错误!');
} else {
$data = array('password' => pwdHash($password));
if (false !== $User->where(array('id' => $id))->save($data)) {
$this->success('密码修改成功!');
} else {
$this->success('密码修改失败!');
}
}
}
示例12: edit_self
/**
* 修改自己的密码和其它信息
*
*/
public function edit_self()
{
$db_user = M('user');
$info = $this->_param();
$info['id'] = $_SESSION[C('USER_AUTH_KEY')];
if ($info['act'] == 'todo') {
if ($info['old_password']) {
if ($info['old_password'] == $info['new_password']) {
$this->error('新密码与旧密码不能相同,请更换!');
}
$password = pwdHash($info['old_password']);
$rs = $db_user->where("id='{$info['id']}' AND password='{$password}'")->count();
if (!$rs) {
$this->error('原密码不正确!不能修改信息');
}
$info['password'] = pwdHash($info['new_password']);
}
$rs = $db_user->data($info)->save();
if ($rs) {
$this->success('修改成功!');
} else {
$this->error('操作失败!');
}
} else {
$info = $db_user->where("id='{$_SESSION[C('USER_AUTH_KEY')]}'")->find();
$db_role_user = M('role_user');
$pre = C('DB_PREFIX');
$list_role = $db_role_user->join("{$pre}role ON {$pre}role.id={$pre}role_user.role_id")->where("user_id='{$_SESSION[C('USER_AUTH_KEY')]}'")->select();
$this->assign('list_role', $list_role);
$this->assign('info', $info);
$this->display();
}
}
示例13: changePwd
public function changePwd()
{
$this->checkUser();
//对表单提交处理进行处理或者增加非表单数据
if (md5($_POST['verify']) != $_SESSION['verify']) {
echo $this->returnajax(300, "验证码错误!");
die;
}
$map = array();
$map['pass'] = pwdHash($_POST['oldpass']);
if (isset($_POST['user'])) {
$map['user'] = $_POST['user'];
} elseif (isset($_SESSION['shop_id'])) {
$map['id'] = $_SESSION['shop_id'];
}
//检查用户
$User = M("shop_user");
if (!$User->where($map)->field('id')->find()) {
echo $this->returnajax(300, "旧密码不符或者用户名错误!");
die;
} else {
$User->pass = pwdHash($_POST['pass']);
$User->save();
$this->success('密码修改成功!');
}
}
示例14: lookupresat
public function lookupresat()
{
//根据用户名查询用户信息
$account = $_POST['account'];
$UserModel = D('User');
$UserVo = $UserModel->where("status=1 and account ='" . $account . "' or zhname='" . $account . "'")->find();
//随机生成6位数
$rand = rand(100000, 999999);
$date['password'] = pwdHash($rand);
//修改该用户名密码
$userResult = $UserModel->where("id=" . $UserVo['id'])->save($date);
$UserModel->commit();
if (!$userResult) {
$this->error("密码修改失败,请联系系统管理员!");
}
$CommonAction = A("Common");
if ($_POST['resetValidate'] == 'mobile') {
//第二,发送手机验证信息内容
$content = "您在特米洛企业信息化管理平台,重置密码为" . $rand;
//验证手机号码是否有重复的。
$count = $UserModel->where('mobile = ' . $UserVo['mobile'] . " and id neq " . $UserVo['id'])->count("*");
if ($count > 1) {
$this->error("手机号码重复,请更换!");
exit;
}
$result = $CommonAction->SendTelmMsg($content, $UserVo['mobile']);
if ($result) {
$_SESSION['msg'] = "手机" . $UserVo['mobile'];
$this->display("findpasswordnotice");
} else {
$this->error("操作失败!");
}
} else {
//邮箱发送
$title = "[特米洛企业信息化管理平台]请查收您的密码";
$content = "亲爱的用户,您好! 您在[特米洛企业信息化管理平台]的密码已重置为" . $rand;
$configEmailModel = D('MisSystemEmail');
$vo['name'] = C("EMAIL_SERVERNAME");
$vo['address'] = "brianl_yang";
$vo['server'] = "163.com";
$vo['email'] = C("EMAIL_SERVERADDRESS");
$vo['pop3'] = "pop.163.com";
$vo['smtp'] = "smtp.163.com";
$vo['password'] = C("EMAIL_PASSWORD");
$vo['pop3port'] = 110;
$vo['smtpport'] = 25;
$email = array($UserVo['email']);
$result = $CommonAction->SendEmail($title, $content, $email, "", $vo, 1);
if ($result) {
$_SESSION['msg'] = "邮箱" . $UserVo['email'];
$this->display("findpasswordnotice");
} else {
$this->error("操作失败!");
}
}
}
示例15: changePwd
/**
* @Title: 密码修改
* @Description: todo(密码修改)
* @author qchlian
* @date 2013-3-29
*/
public function changePwd()
{
$step = intval($_POST['step']);
if ($step) {
//对表单提交处理进行处理或者增加非表单数据
if (md5($_POST['verify']) != $_SESSION['verify']) {
$this->error('验证码错误!');
}
$map = array();
$map['password'] = pwdHash($_POST['oldpassword']);
if (isset($_POST['account'])) {
$map['account'] = $_POST['account'];
} elseif (isset($_SESSION[C('USER_AUTH_KEY')])) {
$map['id'] = $_SESSION[C('USER_AUTH_KEY')];
}
//检查用户
$User = M("User");
if (!$User->where($map)->field('id')->find()) {
$this->error('旧密码不符或者用户名错误!');
} else {
$User->password = pwdHash($_POST['repassword']);
$result = $User->save();
if (!$result) {
$this->error(L('_ERROR_'));
} else {
$this->success('密码修改成功!');
}
}
}
$this->display();
}