PHP? ??? ???? ???? ?? ??? ???
? ????? jquery? ?????. ?? ??? ?? jquery ?????? ???? ???.
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> 寫入代碼 </script>
??? jquery ?????? ?????. "http://libs.baidu.com/jquery/1.7.2/jquery .min.js”
??? ???? <input> ??? ???? ??? ?? ????? ????.
jquery ??() ???? ???? ??? ?? ??? ?????.
??? ??? ???? ?? ??? ????. ??? ??? ??? ??? ?? ??? ?????.
??? ??? ??? <a> ??? id="login_show_button
<div class="login_button"><a href="#" id="login_show_button">管理員登錄</a></div>
? ?????
<script type="text/javascript"> $(document).ready(function() { $("#login_show_button").toggle(function(){ $("#login_form").show(100); return false; },function(){ $("#login_form").hide(100); return false; }); </script>
?? ?? ?? jquery ??? ???? ??? ????
<?php class User{ static public function validate($username,$password){ // static public 聲明公共變量 if("admin"==$username && "12345"==$password){ return true; } else return false; } } ?>
show()? ??? ???? hide()? ???? ?????. .
??? ?????? ??? ???? ?? ??? ?????.
<?php class Authority{ static public function check_insert(){ //聲明公共變量 //檢查是否具有添加留言權(quán)限 return true; } static public function check_delete(){ //檢查是否具有delete權(quán)限 if(isset($_SESSION["username"]) && $_SESSION["username"]=="admin") return true; else return false; } } ?>
??? ??? ??? admin?? ???? ????? 12345? ?????.
??? ??? ????? ???? ???? ??? ?? ???? ??? ? ????
??? ??? ??? ????? ??? ??? ??? ??? ????? ????? ?????
rrreee?? ?? ? ???? Authority.class.php ??? ????? ??? ??? ??? ? ???????.