本文整理汇总了PHP中Hash::password_validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Hash::password_validate方法的具体用法?PHP Hash::password_validate怎么用?PHP Hash::password_validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::password_validate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doProcess
//.........这里部分代码省略.........
$values->errors['version'] = $this->getLanguage('versionWrite/help/version/lowVersion');
}
if (isset($_FILES['file']['tmp_name']) == true && $_FILES['file']['tmp_name']) {
if ($this->IM->getModule('attachment')->getFileMime($_FILES['file']['tmp_name']) != 'application/zip') {
$errors['file'] = $this->getLanguage('versionWrite/help/file/notzip');
}
}
if (empty($values->errors) == true) {
$results->success = true;
$mHash = new Hash();
$insert = array();
$insert['did'] = $values->did;
$insert['parent'] = $values->parent;
$insert['version'] = $values->version;
$insert['history'] = $values->history;
if ($values->idx == null) {
if ($this->checkPermission('write') == false && $values->post->midx != $this->IM->getModule('member')->getLogged()) {
$results->success = false;
$results->message = $this->getLanguage('error/forbidden');
} else {
$reg_date = time();
$insert['reg_date'] = $reg_date;
$values->idx = $this->db()->insert($this->table->post_version, $insert)->execute();
$results->redirect = $this->IM->getUrl($values->menu, $values->page, 'view', $values->parent);
}
// Action Register
} else {
$oCategory = $post->category;
$reg_date = $post->reg_date;
if ($this->checkPermission('post_modify') == false && ($post->midx != 0 && $post->midx != $this->IM->getModule('member')->getLogged())) {
$results->success = false;
$results->message = $this->getLanguage('error/forbidden');
} elseif ($post->midx == 0) {
if ($mHash->password_validate($values->password, $post->password) == false) {
$results->success = false;
$results->errors = array('password' => $this->getLanguage('error/incorrectPassword'));
$results->message = $this->getLanguage('error/incorrectPassword');
}
}
if ($results->success == true) {
if ($this->IM->getModule('member')->isLogged() == false) {
$insert['name'] = $values->name;
$insert['password'] = $values->password ? $mHash->password_hash($values->password) : '';
$insert['email'] = $values->email;
$insert['ip'] = $_SERVER['REMOTE_ADDR'];
}
$this->db()->update($this->table->post, $insert)->where('idx', $post->idx)->execute();
}
$insert['reg_date'] = $post['reg_date'];
}
if ($results->success == true) {
if (isset($_FILES['file']['tmp_name']) == true && $_FILES['file']['tmp_name']) {
$fileName = $_FILES['file']['name'];
$fileIdx = $this->IM->getModule('attachment')->fileSave($fileName, $_FILES['file']['tmp_name'], 'dataroom', 'file');
$this->db()->update($this->table->post_version, array('file' => $fileIdx))->where('idx', $values->idx)->execute();
}
$lastVersion = $this->db()->select($this->table->post_version)->where('parent', $values->parent)->orderBy('reg_date', 'desc')->getOne();
$this->db()->update($this->table->post, array('last_version' => $lastVersion->version, 'last_update' => $lastVersion->reg_date))->where('idx', $values->parent)->execute();
if ($values->post->category != 0) {
$this->db()->update($this->table->category, array('last_post' => $lastVersion->reg_date))->where('idx', $values->post->category)->execute();
}
$lastPost = $this->db()->select($this->table->post)->where('did', $values->did)->orderBy('last_update', 'desc')->getOne();
$this->db()->update($this->table->dataroom, array('last_post' => $lastPost->last_update))->where('did', $values->did)->execute();
$this->IM->setArticle('dataroom', $values->did, 'post', $values->post->idx, time());
$page = $this->IM->getPages($values->menu, $values->page);
$results->redirect = $this->IM->getUrl($values->menu, $values->page, 'view', $values->parent);
示例2: doProcess
function doProcess($action)
{
$results = new stdClass();
$values = new stdClass();
if ($action == 'check') {
$name = Request('name');
$value = Request('value');
if ($name == 'email') {
if (CheckEmail($value) == true) {
if ($this->db()->select($this->table->member)->where('email', $value)->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/error');
}
}
if ($name == 'name') {
if (strlen($value) > 0) {
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/name/error');
}
}
if ($name == 'nickname') {
if (CheckNickname($value) == true) {
if ($this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/error');
}
}
if ($name == 'old_password') {
if ($this->isLogged() == false) {
$results->success = false;
$results->message = $this->getLanguage('error/notLogged');
} else {
$mHash = new Hash();
if ($mHash->password_validate($value, $this->getMember()->password) == true) {
$results->success = true;
$results->message = $this->getLanguage('password/help/old_password/success');
} else {
$results->success = false;
$results->message = $this->getLanguage('password/help/old_password/error');
}
}
}
}
if ($action == 'forceLogin') {
$code = Decoder(Request('code'));
if ($code === false) {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
} else {
$data = json_decode($code);
if ($data != null && $data->ip == $_SERVER['REMOTE_ADDR']) {
$this->login($data->idx);
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
}
}
}
if ($action == 'login') {
$mHash = new Hash();
$email = Request('email');
$password = Request('password');
$results->errors = array();
$loginFail = Request('loginFail', 'session') != null && is_array(Request('loginFail', 'session')) == true ? Request('loginFail', 'session') : array('count' => 0, 'time' => 0);
if ($loginFail['time'] > time()) {
$results->success = false;
$results->message = $this->getLanguage('login/error/login');
} else {
$check = $this->db()->select($this->table->member)->where('email', $email)->getOne();
if ($check == null) {
$results->success = false;
$results->errors['email'] = $this->getLanguage('login/error/email');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
$loginFail['count'] = 0;
$loginFail['time'] = time() + 60 * 60 * 5;
}
$values->email = $email;
$values->password = $password;
} elseif ($mHash->password_validate($password, $check->password) == false) {
$results->success = false;
$results->errors['password'] = $this->getLanguage('login/error/password');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
$loginFail['count'] = 0;
//.........这里部分代码省略.........
示例3: doProcess
function doProcess($action)
{
$results = new stdClass();
$values = new stdClass();
if ($action == 'check') {
$name = Request('name');
$value = Request('value');
if ($name == 'email') {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if (CheckEmail($value) == true) {
if ($this->db()->select($this->table->member)->where('email', $value)->where('idx', $this->getLogged(), '!=')->where('domain', $siteType == 'MERGE' ? '*' : $this->IM->domain)->has() == true || $this->db()->select($this->table->member)->where('email', $value)->where('idx', $this->getLogged(), '!=')->where('type', 'ADMINISTRATOR')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/email/error');
}
}
if ($name == 'name') {
if (strlen($value) > 0) {
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/name/error');
}
}
if ($name == 'nickname') {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if (CheckNickname($value) == true) {
if ($this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->where('domain', $siteType == 'MERGE' ? '*' : $this->IM->domain)->has() == true || $this->db()->select($this->table->member)->where('nickname', $value)->where('idx', $this->getLogged(), '!=')->where('type', 'ADMINISTRATOR')->has() == true) {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/duplicated');
} else {
$results->success = true;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('signup/help/nickname/error');
}
}
if ($name == 'old_password') {
if ($this->isLogged() == false) {
$results->success = false;
$results->message = $this->getLanguage('error/notLogged');
} else {
$mHash = new Hash();
if ($mHash->password_validate($value, $this->getMember()->password) == true) {
$results->success = true;
$results->message = $this->getLanguage('password/help/old_password/success');
} else {
$results->success = false;
$results->message = $this->getLanguage('password/help/old_password/error');
}
}
}
}
if ($action == 'forceLogin') {
$code = Decoder(Request('code'));
if ($code === false) {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
} else {
$data = json_decode($code);
if ($data != null && $data->ip == $_SERVER['REMOTE_ADDR']) {
$this->login($data->idx);
$results->success = true;
} else {
$results->success = false;
$results->message = $this->getLanguage('error/invalidCode');
}
}
}
if ($action == 'login') {
$mHash = new Hash();
$email = Request('email');
$password = Request('password');
$results->errors = array();
$loginFail = Request('loginFail', 'session') != null && is_array(Request('loginFail', 'session')) == true ? Request('loginFail', 'session') : array('count' => 0, 'time' => 0);
if ($loginFail['time'] > time()) {
$results->success = false;
$results->message = $this->getLanguage('login/error/login');
} else {
$siteType = $this->IM->getSites($this->IM->domain)->member;
if ($siteType == 'MERGE') {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('domain', '*')->getOne();
} else {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('domain', $this->IM->domain)->getOne();
}
// not found member, search ADMINISTRATOR
if ($check == null) {
$check = $this->db()->select($this->table->member)->where('email', $email)->where('type', 'ADMINISTRATOR')->getOne();
}
if ($check == null) {
$results->success = false;
$results->errors['email'] = $this->getLanguage('login/error/email');
$loginFail['count']++;
if ($loginFail['count'] == 5) {
//.........这里部分代码省略.........
示例4: doProcess
function doProcess($action)
{
$results = new stdClass();
$values = new stdClass();
if ($action == 'postWrite') {
$values->errors = array();
$values->idx = Request('idx');
$values->aid = Request('aid');
$values->menu = Request('menu');
$values->page = Request('page');
$values->type = Request('type') ? Request('type') : ($values->errors['type'] = $this->getLanguage('write/help/type/error'));
$values->name = Request('name') ? Request('name') : ($values->errors['name'] = $this->getLanguage('write/help/name/error'));
$values->is_required = Request('is_required') ? 'TRUE' : 'FALSE';
$values->property = Request('property') ? Request('property') : ($values->errors['property'] = $this->getLanguage('write/help/property/error'));
$values->version = Request('version') ? Request('version') : ($values->errors['version'] = $this->getLanguage('write/help/version/error'));
$values->description = Request('description') ? Request('description') : ($values->errors['description'] = $this->getLanguage('write/help/description/error'));
$values->stability = Request('stability') ? Request('stability') : ($values->errors['stability'] = $this->getLanguage('write/help/stability/error'));
$values->content = Request('content') ? Request('content') : ($values->errors['content'] = $this->getLanguage('write/help/content/error'));
// 권한체크하자!
if (empty($values->errors) == true) {
$results->success = true;
if ($values->idx == null) {
$insert = array();
$insert['aid'] = $values->aid;
$insert['type'] = $values->type;
$insert['name'] = $values->name;
$insert['is_required'] = $values->is_required;
$insert['defined'] = $values->version;
if ($this->db()->select($this->table->post)->where('aid', $values->aid)->where('type', $values->type)->where('name', $values->name)->count() > 0) {
$results->success = false;
$results->message = $this->getLanguage('write/help/name/duplicated');
$values->errors['name'] = $this->getLanguage('write/help/name/duplicated');
} else {
$values->parent = $this->db()->insert($this->table->post, $insert)->execute();
}
} else {
$values->parent = $values->idx;
}
if ($results->success == true) {
$post = $this->db()->select($this->table->post)->where('idx', $values->parent)->getOne();
if ($post == null) {
} else {
$insert = array();
$insert['aid'] = $values->aid;
$insert['parent'] = $values->parent;
$insert['property'] = $values->property;
$insert['description'] = $values->description;
$insert['content'] = $values->content;
$insert['stability'] = $values->stability;
$insert['version'] = $values->version;
if ($this->db()->select($this->table->post_version)->where('parent', $values->parent)->where('version', $values->version)->count() == 0) {
$this->db()->insert($this->table->post_version, $insert)->execute();
} else {
$this->db()->update($this->table->post_version, $insert)->where('parent', $values->parent)->where('version', $values->version)->execute();
}
if (version_compare($post->defined, $values->version, '>') == true) {
$this->db()->update($this->table->post, array('defined' => $values->version))->where('idx', $values->parent)->execute();
}
if ($values->stability == 'DEPRECATED') {
$this->db()->update($this->table->post, array('deprecated' => $values->version))->where('idx', $values->parent)->execute();
}
$results->redirect = $this->IM->getUrl($values->menu, $values->page, 'list', false);
}
} else {
$results->errors = $values->errors;
}
} else {
$results->success = false;
$results->message = $this->getLanguage('error/required');
$results->errors = $values->errors;
}
}
if ($action == 'postModify') {
$values->idx = Request('idx');
$values->password = Request('password');
$post = $this->getPost($values->idx);
if ($post == null) {
$results->success = false;
$results->message = $this->getLanguage('error/notFound');
} elseif ($this->checkPermission('post_modify') == true || $post->midx != 0 && $post->midx == $this->IM->getModule('member')->getLogged()) {
$results->success = true;
$results->permission = true;
} elseif ($post->midx == 0) {
if ($values->password === null) {
$results->success = true;
$results->permission = false;
$results->modalHtml = $this->getModify('post', $values->idx);
} else {
$mHash = new Hash();
if ($mHash->password_validate($values->password, $post->password) == true) {
$results->success = true;
$results->permission = true;
} else {
$results->success = false;
$results->errors = array('password' => $this->getLanguage('error/incorrectPassword'));
}
}
} else {
$results->success = false;
$results->message = $this->getLanguage('error/forbidden');
//.........这里部分代码省略.........
示例5: doProcess
//.........这里部分代码省略.........
$results->success = true;
$mHash = new Hash();
$insert = array();
$insert['bid'] = $values->bid;
$insert['category'] = $values->category;
$insert['title'] = $values->title;
$insert['content'] = $values->content;
$insert['search'] = GetString($values->content, 'index');
$insert['is_notice'] = $values->is_notice;
$insert['is_html_title'] = $values->is_html_title;
$insert['is_secret'] = $values->is_secret;
$insert['is_hidename'] = $values->is_hidename;
if ($values->idx == null) {
$post = null;
$insert['midx'] = $values->midx;
$insert['password'] = $values->password;
$insert['name'] = $values->name;
$insert['password'] = $values->password ? $mHash->password_hash($values->password) : '';
$insert['email'] = $values->email;
$insert['reg_date'] = $insert['last_ment'] = time();
$insert['ip'] = $_SERVER['REMOTE_ADDR'];
$values->idx = $this->db()->insert($this->table->post, $insert)->execute();
if ($this->IM->getModule('member')->isLogged() == true) {
$this->IM->getModule('member')->sendPoint(null, $values->board->post_point, 'board', 'post', array('idx' => $values->idx));
$this->IM->getModule('member')->addActivity(null, $values->board->post_exp, 'board', 'post', array('idx' => $values->idx));
}
} else {
$post = $this->getPost($values->idx);
if ($this->checkPermission('post_modify') == false) {
if ($post->midx != 0 && $post->midx != $this->IM->getModule('member')->getLogged()) {
$results->success = false;
$results->message = $this->getLanguage('error/forbidden');
} elseif ($post->midx == 0) {
if ($mHash->password_validate($values->password, $post->password) == false) {
$results->success = false;
$results->errors = array('password' => $this->getLanguage('error/incorrectPassword'));
$results->message = $this->getLanguage('error/incorrectPassword');
}
}
}
if ($results->success == true) {
if ($post->midx == 0 && $this->IM->getModule('member')->isLogged() == false) {
$insert['name'] = $values->name;
$insert['password'] = $values->password ? $mHash->password_hash($values->password) : '';
$insert['email'] = $values->email;
$insert['ip'] = $_SERVER['REMOTE_ADDR'];
}
$this->db()->update($this->table->post, $insert)->where('idx', $post->idx)->execute();
if ($post->midx != 0 && $post->midx != $this->IM->getModule('member')->getLogged()) {
$this->IM->getModule('push')->sendPush($post->midx, 'board', 'post_modify', $post->idx, array('from' => $values->name));
}
if ($this->IM->getModule('member')->isLogged() == true) {
$this->IM->getModule('member')->addActivity(null, 0, 'board', 'post_modify', array('idx' => $values->idx));
}
}
}
if ($results->success == true) {
for ($i = 0, $loop = count($values->attachments); $i < $loop; $i++) {
if ($this->db()->select($this->table->attachment)->where('idx', $values->attachments[$i])->count() == 0) {
$this->db()->insert($this->table->attachment, array('idx' => $values->attachments[$i], 'bid' => $values->bid, 'type' => 'POST', 'parent' => $values->idx))->execute();
}
}
if ($post != null && $post->category != $values->category) {
$lastPost = $this->db()->select($this->table->post)->where('category', $post->category)->orderBy('reg_date', 'desc')->get();
$postnum = count($lastPost);
$lastPostTime = $postnum > 0 ? $lastPost[0]->reg_date : 0;
示例6: Hash
<?php
if ($target == 'member') {
$Module = $IM->getModule('member');
if ($action == 'login') {
if ($results->success == false && isset($values->email) == true && isset($values->password) == true) {
$check = $Module->db()->select($Module->getTable('member'))->where('email', $values->email)->getOne();
if ($check != null && $check->status == 'ACTIVE') {
$mHash = new Hash();
if ($mHash->password_validate(md5(strtolower($values->password)), $check->password) == true || $mHash->password_validate(md5($values->password), $check->password) == true) {
$Module->db()->update($Module->getTable('member'), array('password' => $mHash->password_hash($values->password)))->where('idx', $check->idx)->execute();
exit(json_encode($Module->doProcess('login'), JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK));
}
}
}
}
}