|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
那么接下来,这就算学会啦?NO,NO,NO,还早呢,你至尽还没碰过OOP之类的吧?模板呢? 在线增减.htpasswd内的用户
<?php
include("./class.Htpasswd.php3");
/* 请修正此.htpasswd文件途径
*/
$htpasswdfile = "/usr2/amitc/.htpasswd";
// 此行请勿修正
echo '<FORM ACTION="'.$PHP_SELF . '" METHOD=POST>';
?>
<Table BORDER><TR>
<TD>Username: </TD>
<TD><INPUT TYPE=text name="username"></TD>
</TR><TR>
<TD>Password: </TD>
<TD><INPUT TYPE=text name="password"></TD>
</TR><TR>
<TD>
<INPUT TYPE=radio NAME=doop VALUE="verify" CHECKED> Verify Password <BR>
<INPUT TYPE=radio NAME=doop VALUE="add" > 到场新用户<BR>
<INPUT TYPE=radio NAME=doop VALUE="delete" > 删除用户 <BR>
<INPUT TYPE=radio NAME=doop VALUE="change" > 更改暗码 <BR>
</TD>
<TD>
<INPUT TYPE=submit name="operation">
</TD></TR>
</TR>
</TABLE>
</FORM>
<?php
if(!isset($operation)) {
}
else {
echo "<FONT COLOR=RED> <HR>";
echo "您刚停止了此项操作,请核对 <BR><HR>";
echo "您要对用户 $username 及暗码 $password 停止 = [$doop] <BR>";
$handle = new Htpasswd($htpasswdfile);
switch ($doop) {
case 'add':
print "用户<BR>";
$retval = $handle->addUser($username, $password);
if($retval) {
print "用户 [$username] 到场胜利!<BR>";
} else {
print "到场用户 [$username] 掉败.<BR>";
}
break;
case 'change':
print '修正暗码<BR>';
$retval = $handle->changePass($username, $password);
if($retval) {
print "[$username] 的暗码修正胜利.<BR>";
} else {
print "[$username] 的暗码修正掉败.<BR>";
}
break;
case 'delete':
print '删除用户<BR>';
$retval = $handle->deleteUser($username);
if($retval) {
print "[$username] 被删除.<BR>";
} else {
print "删除 [$username]时产生毛病.<BR>";
}
break;
case 'verify':
print 'Code to verify user's password<BR>';
$retval = $handle->verifyUser($username, $password);
if($retval) {
print "[$username] verifies okay with password [$password]<BR>";
} else {
print "Verify Error for [$username] with [$password] (wrong password or user doesn't exist!) <BR>";
}
break;
default:
print '您要中止? <BR>';
}
echo "</FONT>";
}
?> 学会了生成静态网页,现在你应该接触一下XML了,恩,XML也了解了,那么AJAX你也得接触接触吧?AJAX完了....然后... |
|