本文整理匯總了PHP中Value::SetAndEqualTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Value::SetAndEqualTo方法的具體用法?PHP Value::SetAndEqualTo怎麽用?PHP Value::SetAndEqualTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Value
的用法示例。
在下文中一共展示了Value::SetAndEqualTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CheckSecurityToken
/**
* Checks a Security token against the token stored in the users session.
*/
public static function CheckSecurityToken($token = null)
{
if ($token == null && Value::SetAndNotNull($_POST, 'securitytoken')) {
$token = $_POST['securitytoken'];
}
return Value::SetAndEqualTo($token, $_SESSION, SECURITY_TOKEN);
}
示例2: FetchUserId
/**
* Get the userid from a given username and password hash.
* @param string $username The username hash.
* @param string $password (optional) The password hash
* @return integer The ID for the requested username hash (or 0 if not found)
**/
private static function FetchUserId($username, $password = EMPTYSTRING)
{
$result = 0;
$sql = EMPTYSTRING;
if (Value::SetAndEqualTo(EMPTYSTRING, $password)) {
if ($stmt = Database::GetLink()->prepare('SELECT user_id FROM Login WHERE username_hash=?;')) {
$stmt->bindParam(1, $username, PDO::PARAM_STR, 255);
$stmt->execute();
$stmt->bindColumn(1, $id);
$stmt->fetch();
$stmt->closeCursor();
if ($id != null) {
$result = $id;
}
}
} else {
if ($stmt = Database::GetLink()->prepare('SELECT user_id FROM Login WHERE username_hash=? AND password_hash=?;')) {
$stmt->bindParam(1, $username, PDO::PARAM_STR, 255);
$stmt->bindParam(2, $password, PDO::PARAM_STR, 255);
$stmt->execute();
$stmt->bindColumn(1, $id);
$stmt->fetch();
$stmt->closeCursor();
if ($id != null) {
$result = $id;
}
}
}
return $result;
}