緊急!セッションの問題
RewriteRule ^index.html&fun=000$ gyjw/check.php が URL を書き換えます
ホームページ
<?php<br /> session_start(); //使用session存储用户信息<br /> <br /> if(isset($_POST["username"]))<br /> {<br /> $ss_user_id="";<br /> <br /> //利用User累的IsValid()方法判断所输入的用户名和口令是否正确<br /> require_once("user/UserClass.php");<br /> $user=new User();<br /> //如果正确,转到系统首页<br /> if($user->IsValid($_POST["username"],$_POST["password"],$ss_user_id))<br /> {<br /> $_SESSION["ss_user_id"]=$ss_user_id;<br /> echo "<script language='javascript'>";<br /> echo " location='index.html';";<br /> echo "</script>";<br /> }<br /> //如果不正确,转到登陆页面<br /> else<br /> {<br /> echo "<script language='javascript'>";<br /> echo " alert('用户名或密码错误');";<br /> echo "</script>";<br /> }<br /> }<br /> <br /> ?><br />
<?php<br /> include 'http://localhost/gyjw/index.html&fun=000';<br /> ?><br /> //省略html部分<br />
<?php <br /> if(! isset($_SESSION['ss_user_id']))<br /> { <br /> echo "<script language='javascript'>";<br /> echo "alert('您的用户无权进行此操作!');";<br /> echo "top.location='login.html';";<br /> echo "</script>"; <br /> exit; <br /> }<br /> ?>
<?php<br /> include ("check.php");<br /> ?>