本文整理汇总了PHP中getHash函数的典型用法代码示例。如果您正苦于以下问题:PHP getHash函数的具体用法?PHP getHash怎么用?PHP getHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getHash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vInsertIntoOwnerLoginTable
function vInsertIntoOwnerLoginTable($SafeFirstName, $SafeLastName, $SafeEmail, $SafePWD)
{
global $mysqli;
$UserID = $SafeFirstName . $SafeLastName;
$iOwnerExists = iCheckIfOwnerEmailExists($SafeEmail);
#if this is the first claim.
if ($iOwnerExists == 0) {
#Obtain a cryption and save it in the DB.
$salt = salt();
#Hash a string that is comprised of password and a salt.
#Save it as a password. This will create a second level of security.
$hash = getHash($SafePWD, $salt);
# The folloing is for email activation of validation.
$email_code = md5($SafeEmail + microtime());
if (DEBUG) {
echo "salt =" . $salt . "<br>";
echo "SafePWD =" . $SafePWD . "<br>";
echo "hash =" . $hash . "<br>";
}
#user_id is also email address.
$mysqli->autocommit(FALSE);
$InsertCommand = "INSERT INTO \r\n login_table ( id, user_id, salt, password, email_address, email_code, type )\r\n\t\t\t\t values ( NULL, '" . $SafeEmail . "', '" . $salt . "', '" . $hash . "', '" . $SafeEmail . "', '" . $email_code . "', 'O' )";
$add_post_res = $mysqli->query($InsertCommand);
# or die($mysqli->error);
if (!$mysqli->commit()) {
$mysqli->rollback();
}
SendActivateEmailNotice($SafeEmail, $email_code);
echo "Please activate your email to complete the registration. Please respond to your email. Thanks.";
} else {
/*popup( "You have already registere!", OWNER_LOGIN_PAGE ); */
echo "You have already registered!";
}
}
开发者ID:nguaki,项目名称:baboom,代码行数:34,代码来源:owner_register.php
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new User();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
$model->password = getHash($model->password);
if (Yii::app()->user->isFranchiseAdmin()) {
$model->franchise = Yii::app()->user->franchise;
$model->role_id = 2;
}
if (Yii::app()->user->isAdmin()) {
$franchise = new Franchise();
$franchise->name = $model->username;
$franchise->save();
$model->franchise = $franchise->id;
$model->role_id = 3;
}
if ($model->save()) {
// $this->redirect(array('view', 'id' => $model->id));
$this->redirect(array('user/admin'));
}
}
$this->render('create', array('model' => $model));
}
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:30,代码来源:UserController_b.php
示例3: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Banner'])) {
$image = CUploadedFile::getInstance($model, 'image');
$modelImg = $model->image;
$model->attributes = $_POST['Banner'];
if (!$image) {
$model->image = $modelImg;
}
if ($image) {
$extarr = explode('.', $image->name);
$ext = end($extarr);
$imgName = getHash(time());
$model->image = $imgName . '.' . $ext;
$PATH = Yii::getPathOfAlias("webroot.productimg") . '/' . $model->image;
}
if ($model->save()) {
if ($image) {
$image->saveAs($PATH);
}
// $this->redirect(array('view', 'id' => $model->id));
$this->redirect(array('banner/admin'));
}
}
$this->render('update', array('model' => $model));
}
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:34,代码来源:BannerController.php
示例4: fileNameByRandom
/**
* 随机生成文件名
* @param $ext 文件扩展名
* @return string
*/
public static function fileNameByRandom($ext = null)
{
if (empty($ext)) {
$ext = "tmp";
}
$randomStr = getHash(rand(1, 30000) . time() . $ext . rand(1, 30000));
return $randomStr . "." . $ext;
}
开发者ID:cumtCsdn,项目名称:cumtxa,代码行数:13,代码来源:FileObject.class.php
示例5: getPassword
function getPassword($username, $token)
{
if (getTokenValid($username, $token)) {
global $salt;
$hash = getHash($username);
$password = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($salt), base64_decode($hash), MCRYPT_MODE_CBC, md5(md5($salt))), "");
return $password;
} else {
return false;
}
}
开发者ID:CWMCDev,项目名称:Barend,代码行数:11,代码来源:auth.php
示例6: validateHash
function validateHash($password, $hash)
{
$hashArr = explode(':', $hash);
switch (count($hashArr)) {
case 1:
return getHash($password) === $hash;
case 2:
return getHash($hashArr[1] . $password) === $hashArr[0];
}
return 'Invalid hash.';
}
开发者ID:HB4daemmon,项目名称:custom,代码行数:11,代码来源:hash.php
示例7: actionLogin
public function actionLogin()
{
$return['sucess'] = false;
if (isset($params['username']) && isset($params['password'])) {
$user = User::model()->findByAttributes(array('username' => $params['username'], 'password' => getHash($params['password'])));
if ($user) {
$return['sucess'] = true;
$return['user'] = $user->attributes;
}
}
echo json_encode($return);
}
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:12,代码来源:ApiController.php
示例8: login
public function login($username, $password)
{
if (intval(f('SELECT COUNT(1) FROM ' . FAILED_LOGINS_TABLE . ' WHERE UserTable="tblWebUser" AND Username="' . $GLOBALS['DB_WE']->escape($username) . '" AND isValid="true" AND LoginDate >DATE_SUB(NOW(), INTERVAL ' . intval(SECURITY_LIMIT_CUSTOMER_NAME_HOURS) . ' hour)')) >= intval(SECURITY_LIMIT_CUSTOMER_NAME) || intval(f('SELECT COUNT(1) FROM ' . FAILED_LOGINS_TABLE . ' WHERE UserTable="tblWebUser" AND IP="' . $_SERVER['REMOTE_ADDR'] . '" AND LoginDate >DATE_SUB(NOW(), INTERVAL ' . intval(SECURITY_LIMIT_CUSTOMER_IP_HOURS) . ' hour)')) >= intval(SECURITY_LIMIT_CUSTOMER_IP)) {
logApiRequests('endpoint: ' . $this->request['request'] . '; Login denied for User : ' . $username . '; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
throw new Exception('Login denied for user');
}
$u = getHash('SELECT * FROM ' . CUSTOMER_TABLE . ' WHERE Password!="" AND LoginDenied=0 AND Username="' . $GLOBALS['DB_WE']->escape($username) . '"', null, MYSQL_ASSOC);
if (empty($u)) {
logApiRequests('endpoint: ' . $this->request['request'] . '; Invalid User : ' . $username . '; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
throw new Exception('Invalid User');
}
return $u && we_customer_customer::comparePassword($u['Password'], $password) ? array('UserIDHash' => $u['App_UserIDHash']) : array('UserIDHash' => false);
}
开发者ID:andreaswitt,项目名称:CMSwebEdition,代码行数:13,代码来源:user.class.php
示例9: __construct
/**
* 构造函数,检查配置是否完成
*/
protected function __construct()
{
SimpleSession::init(null, getHash($_POST['FromUserName']));
if (!$_SESSION['wechatActivity']) {
$_SESSION['wechatActivity'] = null;
}
if (!$_SESSION['callbackStack']) {
$_SESSION['callbackStack'] = null;
}
$this->activity =& $_SESSION['wechatActivity'];
$this->callbackStack =& $_SESSION['callbackStack'];
$this->token = getConfig("wechat", "token");
$this->appInfo =& getAppInfo();
}
开发者ID:cumtCsdn,项目名称:cumtxa,代码行数:17,代码来源:WechatRouter.class.php
示例10: iCheckIfOwnerEmailExists
function iCheckIfOwnerEmailExists($SafeEmail, $SafePW, &$ID, &$Email_status, &$Email_code, &$Password_status)
{
global $mysqli;
$QueryResultSet = "SELECT count(*) AS row_exists, \r\n salt, \r\n password, \r\n id,\r\n\t\t\t\t email_active,\r\n\t\t\t\t email_code,\r\n\t\t\t\t password_recover\r\n\t\t\t FROM login_table\r\n\t\t\t WHERE email_address = '{$SafeEmail}'";
$objGetResult = $mysqli->query($QueryResultSet);
if (DEBUG) {
echo "{$QueryResultSet}<br>";
var_dump($objGetResult);
}
if ($objGetResult) {
$anArray = $objGetResult->fetch_array(MYSQLI_ASSOC);
$numof_rows = stripslashes($anArray['row_exists']);
$salt = stripslashes($anArray['salt']);
$password = stripslashes($anArray['password']);
$Password_status = stripslashes($anArray['password_recover']);
if (DEBUG) {
echo "Inside<br>";
echo "numof_rows = {$numof_rows}<br>";
echo "salt = {$salt}<br>";
echo "password = {$password}<br>";
}
if ($numof_rows == 1) {
$hash = getHash($SafePW, $salt);
if (DEBUG) {
echo "Inside<br>";
echo "numof_rows = {$numof_rows}<br>";
echo "salt = {$salt}<br>";
echo "password = {$password}<br>";
echo "SafePW = {$SafePW}<br>";
echo "hash = {$hash}<br>";
}
if ($hash == $password) {
$ID = stripslashes($anArray['id']);
$Email_status = stripslashes($anArray['email_active']);
$Email_code = stripslashes($anArray['email_code']);
if (DEBUG) {
echo "email_code" . $Email_code . "<br>";
}
$Email_Exists = 1;
} else {
$Email_Exists = 0;
}
} else {
$Email_Exists = 0;
}
$objGetResult->free_result();
}
return $Email_Exists;
}
开发者ID:nguaki,项目名称:baboom,代码行数:49,代码来源:owner_login.php
示例11: loginUser
function loginUser($un, $psw)
{
$_SESSION['uid'] = $uid = Adapter::getAValue('UID', '`person`', 'name=?', array($un), "s");
$_SESSION['type'] = Adapter::getAValue('type', '`person`', 'uid=?', array($uid), "i");
if ($uid == -1) {
print 1;
return;
}
if (!Adapter::isExists('`person`', 'UID=? AND hash=?', array($uid, getHash($psw)), "is")) {
print 2;
return;
}
/*login code*/
$_SESSION['logged'] = 1;
print 3;
}
开发者ID:Vcnet-Company,项目名称:angularjs-internal,代码行数:16,代码来源:functions.inc.php
示例12: checkUser
public function checkUser()
{
if (isset($_COOKIE['userinfo'])) {
$string = $_COOKIE['userinfo'];
$cookieText = explode('||', $string);
$inputLogin = $cookieText[1];
$this->user_model->getUserDataByLogin($inputLogin);
$trueLogin = $this->user_model->getLogin();
$truePassword = $this->user_model->getPassword();
$name = $this->user_model->getUserName();
$userHash = getHash($trueLogin, $truePassword);
if ($string === $userHash) {
$userData = array('username' => $name, 'logged_in' => TRUE);
$this->session->set_userdata($userData);
} else {
setcookie('userinfo', '');
}
}
}
开发者ID:nickepoch,项目名称:HW15,代码行数:19,代码来源:login.php
示例13: vInsertIntoClientLoginTable
function vInsertIntoClientLoginTable($SafeFirstName, $SafeLastName, $SafeEmail, $SafePWD)
{
global $mysqli;
$UserID = $SafeFirstName . $SafeLastName;
$iClientExists = iCheckIfClientEmailExists($SafeEmail);
#if this is the first claim.
if ($iClientExists == 0) {
$salt = salt();
$hash = getHash($SafePWD, $salt);
$email_code = md5($SafeEmail + microtime());
#user_id is also email address.
$mysqli->autocommit(FALSE);
$InsertCommand = "INSERT INTO client_login_table \r\n ( id, first_name, last_name, email_address, email_code, salt, password )\r\n values \r\n (NULL,'{$SafeFirstName}', '{$SafeLastName}', '{$SafeEmail}', '{$email_code}', '{$salt}', '{$hash}' )";
$add_post_res = $mysqli->query($InsertCommand) or die($mysqli->error);
if (!$mysqli->commit()) {
$mysqli->rollback();
}
SendActivateEmailNotice($SafeEmail, $email_code);
echo "Please activate your email to complete the registration. Please respond to your email. Thanks.";
} else {
/*popup('You have already registered.', "http://" . IP_ADDRESS . "/member/client_login_register.php");*/
echo "You have already registered";
}
}
开发者ID:nguaki,项目名称:baboom,代码行数:24,代码来源:member_register.php
示例14: getHash
* @param array $data Array of transmitted data (see above)
* @param string $password Your Gateway-Password
*/
function getHash(array $data, $password)
{
$hash_source = null;
foreach ($data as $value) {
$hash_source .= $value . '|';
}
$hash_source .= $password;
$hash_md5 = md5($hash_source);
return $hash_md5;
}
$databases = array(1);
$data = array('msg_id' => $_POST['messageId'], 'number' => $_POST['responseSender'], 'message' => $_POST['responseMessage'], 'timestamp' => $_POST['responseTimestamp']);
if (getHash($data, SMS_PASSWORD) == $_POST['hash']) {
// DO something here like sending mail, store in database ...
$found = false;
if (!empty($data['msg_id'])) {
foreach ($databases as $database) {
$redis->SELECT($database);
if ($redis->EXISTS("sms:send:{$data['msg_id']}")) {
$send = $redis->HGETALL("sms:send:{$data['msg_id']}");
if (is_array($send)) {
$found = true;
$redis->HMSET("sms:send:{$data['msg_id']}", array('status' => SMS_STATUS_ANSWERED));
$redis->HMSET("sms:receive:{$data['msg_id']}", array('returnto' => $send['returnto'], 'sender' => $send['receiver'], 'receiver' => $send['sender'], 'datetime' => $data['timestamp'], 'message' => $data['message']));
$redis->SADD("sms:inbound", (string) $data['msg_id']);
break;
} else {
$line = trim(date("[d/m @ H:i:s]") . "SMS response Error: " . implode(', ', $data)) . "\n";
开发者ID:rbraband,项目名称:LouCes,代码行数:31,代码来源:sms-response.php
示例15: inputHash
function inputHash()
{
return '<input type="hidden" name="hash" value="' . getHash() . '">';
}
开发者ID:frycnx,项目名称:jxc,代码行数:4,代码来源:Functions.php
示例16: count
if ($page == "") {
$page = "1";
}
$currentpage = $page;
STemplate::assign('page', $page);
if ($page >= 2) {
$pagingstart = ($page - 1) * $config['items_per_page'];
} else {
$pagingstart = "0";
}
$query1 = "SELECT count(*) as total from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$config['maximum_results']}";
$query2 = "SELECT A.*, B.username from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$pagingstart}, {$config['items_per_page']}";
$executequery1 = $conn->Execute($query1);
$totalvideos = $executequery1->fields['total'];
if ($totalvideos > 0) {
if ($executequery1->fields['total'] <= $config[maximum_results]) {
$total = $executequery1->fields['total'];
} else {
$total = $config[maximum_results];
}
$toppage = ceil($total / $config[items_per_page]);
if ($page <= $toppage) {
$executequery2 = $conn->Execute($query2);
$posts = $executequery2->getrows();
$posts = getTags($posts);
$posts = countComments($posts);
$posts = getHash($posts);
STemplate::assign('posts', $posts);
STemplate::display('posts_bit_more.tpl');
}
}
开发者ID:jd5688,项目名称:image-sharing-site,代码行数:31,代码来源:indexmore.php
示例17: switch
if (isset($_POST['input']) && !empty($_POST['input']) && isset($_POST["modifies"])) {
$inputString = $_POST['input'];
$modifies = $_POST['modifies'];
$result = '';
switch ($modifies) {
case 'palindrome':
$result = $inputString . ' ' . getPalindrome($inputString);
break;
case 'reverse':
$result = getReverse($inputString);
break;
case 'split':
$result = getSplit($inputString);
break;
case 'hash':
$result = getHash($inputString);
break;
case 'shuffle':
$result = getShuffle($inputString);
break;
default:
echo 'Error!';
break;
}
echo $result;
}
?>
</body>
</html>
开发者ID:GeorgiLambov,项目名称:SoftwareUniversity,代码行数:29,代码来源:06.StringModifier.php
示例18: addFile
/** 파일정보를 DB에 추가한다
* @class write
* @param
$data: chkFile 후에 넘어온 데이터
-id: 게시판번호. 없으면 mini[board]의 정보를 활용
-target_member: 회원번호. 없으면 mini[member]의 정보를 활용
-target: 대상자료번호
-target_pos: 대상게시물번호(댓글일때만)
-mode: post|comment|memo|box
* @return Array
*/
function addFile($data, $param = '')
{
global $mini;
$param = param($param);
$ins = array();
if (!empty($param['id'])) {
def($ins['id'], $param['id']);
}
if (!empty($data['id'])) {
def($ins['id'], $data['id']);
}
if (!empty($mini['board']['no'])) {
def($ins['id'], $mini['board']['no']);
}
if (!empty($param['target_member'])) {
def($ins['target_member'], $param['target_member']);
}
if (!empty($data['target_member']) && !empty($mini['member']['level_admin'])) {
def($ins['target_member'], $data['target_member']);
}
if (!empty($mini['member']['no'])) {
def($ins['target_member'], $mini['member']['no']);
}
if (!empty($data['ip']) && !empty($mini['member']['level_admin'])) {
def($ins['ip'], $data['ip']);
}
def($ins['ip'], $mini['ip']);
if (!empty($data['date']) && !empty($mini['member']['level_admin'])) {
def($ins['date'], $data['date']);
}
def($ins['date'], $mini['date']);
if (!empty($param['mode'])) {
def($ins['mode'], $param['mode']);
}
if (!empty($data['mode'])) {
def($ins['mode'], $data['mode']);
}
def($ins['mode'], '');
if (!empty($param['target'])) {
def($ins['target'], $param['target']);
}
if (!empty($data['target'])) {
def($ins['target'], $data['target']);
}
def($ins['target'], 0);
if (!empty($param['target_post']) && $ins['mode'] == 'comment') {
$ins['target_post'] = $param['target_post'];
}
$ins['name'] = $data['name'];
$ins['url'] = $data['path'];
$ins['size'] = $data['size'];
$ins['is_admit'] = !empty($mini['board']['use_file_admit']) && empty($mini['member']['level_admin']) ? 0 : 1;
$ins['width'] = !empty($data['width']) ? $data['width'] : 0;
$ins['height'] = !empty($data['height']) ? $data['height'] : 0;
$ins['ext'] = $data['ext'];
$ins['type'] = $data['type'];
// 파일해시
$ins['hash'] = getHash($data);
sql("INSERT INTO {$mini['name']['file']} " . query($ins, 'insert'));
// 후처리
$ins['no'] = getLastId($mini['name']['file'], "(ip='{$ins['ip']}' and date='{$ins['date']}' and name='{$ins['name']}')");
$ins['error'] = 0;
return $ins;
}
开发者ID:bluecat,项目名称:iiwork-php,代码行数:75,代码来源:ii.write.php
示例19: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$jaspers_franchise = JaspersFranchise::model()->findAll();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['User'])) {
$this->password = $model->password;
$model->attributes = $_POST['User'];
if ($_POST['User']['password']) {
$model->password = getHash($_POST['User']['password']);
} else {
$model->password = $this->password;
}
if ($model->save()) {
// $this->redirect(array('view', 'id' => $model->id));
if (isset($_GET['isUser'])) {
$this->redirect(array('user/admin', 'isUser' => 1));
}
$this->redirect(array('user/admin'));
}
}
unset($model->password);
$this->render('update', array('model' => $model, 'jaspers_franchise' => $jaspers_franchise));
}
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:25,代码来源:UserController.php
示例20: extractDir
/**
*
* Extract the current home directory for the site, or return
* __root if the site is root. This is then used to write the cache
* file as $dirName.css
*
* @return string The directory
*
*/
function extractDir()
{
//get public directory structure eg "/top/second/third"
$publicDirectory = dirname($_SERVER['PHP_SELF']);
//place each directory into array
$directoryAr = explode('/', $publicDirectory);
//get highest or top level in array of directory strings
$publicBase = max($directoryAr);
if ($publicBase == "") {
$publicBase = getHash();
}
return $publicBase;
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:22,代码来源:basecss.php
注:本文中的getHash函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论