本文整理汇总了PHP中Engine::protect方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::protect方法的具体用法?PHP Engine::protect怎么用?PHP Engine::protect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::protect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($num)
{
$ammo = Engine::protect($num);
$query = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT {$num}");
$result = $query;
if ($result) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo stripslashes('<article class="news">
<h2 class="topic">' . $row['title'] . '</h2>
<div class="post">
' . $row['content'] . '
</div>
</article>
<hr />
');
}
echo '
</div>
</body>
</html> ';
} else {
echo 'News System is undergoing maintenance. Please check back soon!';
}
}
示例2: doValidate
/**
*
* @param string $u Username
* @param string $v Vkey
* Void
*/
public function doValidate($u, $v)
{
global $min_usr, $max_usr;
$user = $this->username = $u;
$key = $this->vkey = $v;
/*if(strlen($user) > $max_usr || strlen($user) < $min_usr)
{
exit("Unable to validate :: Invalid username!");
}*/
##<!-- Does captcha pass? -->
$privatekey = "NkxkSHZMOFNBQUFBQUNUSjFyV2tWd2FxS04wUHJXck5DYUFESHV5Qw==";
$resp = recaptcha_check_answer(base64_decode($privatekey), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
exit("The reCAPTCHA was entered incorrectly.");
}
##<!-- Sanitize Username -->##
/*$user = trim($user);
$user = htmlspecialchars($user,ENT_QUOTES);*/
$user = parent::protect($user);
##<!-- Sanitize vkey -->##
$key = strip_tags($key);
$key = parent::protect($key);
$query = mysql_query("SELECT * FROM hxm_members WHERE `username` = '{$user}' AND `key` = '{$key}'");
$result = mysql_num_rows($query);
if ($result > 0 && $result < 2) {
$update = mysql_query("UPDATE hxm_members SET `group` = '1' WHERE `username` = '{$user}' AND `key` = '{$key}'");
}
if ($update) {
header("Location: " . HOME);
} else {
exit("Invalid key or user has already validated.");
}
}
示例3: chkLogin
/**
*
* Void
* Checks if user is logged in
*/
public function chkLogin()
{
global $cookie_prefix;
if (isset($_COOKIE[$cookie_prefix . "id"]) && isset($_COOKIE[$cookie_prefix . "pass"])) {
#<!-- Sanitize ID -->
$id = $_COOKIE[$cookie_prefix . "id"];
/*$id = mysql_real_escape_string($id);
$id = strip_tags($id);*/
$id = parent::protect($id);
#<!-- Sanitize Pass -->
$pass = $_COOKIE[$cookie_prefix . "pass"];
/*$pass = mysql_real_escape_string($pass);
$pass = strip_tags($pass);*/
$pass = parent::protect($pass);
$query = mysql_query("SELECT * FROM `hxm_members` WHERE `id` = '{$id}' AND `password` = '{$pass}'");
$result = mysql_num_rows($query);
$data = mysql_fetch_array($query);
if ($result != 1) {
header("Location: " . AUTH);
}
if ($data["group"] == "0") {
header("Location: " . AUTH);
}
} else {
header("Location: " . AUTH);
}
}