<?
session_save_path("./");
session_start();
$wenti="班主任的名字是?";
$define_daan="設定的答案";
if($login_submit){
if($daan==$define_daan) $str="您的回答錯誤!";
else{
session_register("ses_daan");
$ses_daan="設定的答案";
header("location:index.php");
}
}
><html>
<head><title>進入驗證</title>
</head>
<style>
table{font-size:9pt;}
</style>
<body><br>
<form name="form1" method="post" action=<?echo $PHP_SELF ?> >
<table border="0" cellpadding="3" cellspacing="1" align="center" width="300" bgcolor="#3399CC">
<tr height="25" bgcolor="#E7E7E7"><td colspan="2"><b>XXXXXX--</b>進入驗證</td></tr>
<tr height="25" bgcolor="#e7f7f7" ><td align="right">問題:</td><td><?echo $wenti;?></td></tr>
<tr height="25" bgcolor="#e7f7f7" ><td align="right">答案:</td><td><input type="text" name="daan"></td></tr>
<tr height="25" bgcolor="#e7f7f7" ><td></td><td><input type="submit" name="login_submit" value="提交"><?echo "<font color=red>".$str."</font>";?></td></tr>
</table>
</form>
index.php頁面裏面加上
<?
session_save_path("./");
session_start();
if(!session_is_registered("ses_daan")) header("location:login.php");//這裏也可以判斷答案是否正確來處理
//下面是妳要加的內容
///
///
>