当前位置: 首页>>代码示例>>PHP>>正文


PHP Engine::protect方法代码示例

本文整理汇总了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!';
        }
    }
开发者ID:39845987559038,项目名称:haXMS,代码行数:24,代码来源:news.class.php

示例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.");
     }
 }
开发者ID:39845987559038,项目名称:haXMS,代码行数:39,代码来源:register.class.php

示例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);
     }
 }
开发者ID:39845987559038,项目名称:haXMS,代码行数:32,代码来源:login.class.php


注:本文中的Engine::protect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。