本文整理汇总了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;
}