|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
不懂的问题有很多高手帮你解决。但不要认为你是新手,就不能帮助别人,比如今天你学会了怎样安装PHP,明天还可能有朋友会问这个问题,你就可以给他解答,不要认为这是浪费时间,忙别人其实就是帮助自己。 第一步:起首做一个以下页面。
<html>
<head>
<title>请求帐号</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/CSS">
<!--
.p11 { font-size: 10pt; color: #000000; text-decoration: none}
.c3a {font-size: 9pt; color: #000000; background-color: #ffffff; border: 1 solid #ff9900}
-->
</style>
</head>
<body bgcolor="#FFFFFF" topmargin="0">
<table width="440" border="0" cellspacing="0" cellpadding="0" align="center">
<form method="post" action="zc.php">
<tr>
<td width="230"><img src="http://edu.cnzz.cn/images/login.gif" width="200" height="30"></td>
<td width="210" class="p11" valign="bottom"><font color="#FF6699">*</font>为必填项</td>
</tr>
</table>
<table width="440" border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#eeeeee" bordercolordark="#eeeeee" bordercolorlight="#ffcf60">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="56%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="170">
<tr>
<td width="111" class="p11">
<div align="right">用户名:</div>
</td>
<td width="207" class="p11">
<input type="text" name="name" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font></span> </td>
</tr>
<tr>
<td width="111" class="p11">
<div align="right">暗码:</div>
</td>
<td width="207" class="p11">
<input type="password" name="word" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font></span> </td>
</tr>
<tr>
<td width="111" class="p11">
<div align="right">确认暗码:</div>
</td>
<td width="207" class="p11">
<input type="password" name="pass" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font> </span></td>
</tr>
<tr>
<td width="111" height="29" class="p11">
<div align="right">提醒成绩:</div>
</td>
<td width="207" height="29" class="p11">
<input type="text" name="ask" size="20" class="c3a">
</td>
</tr>
<tr>
<td width="111" height="28" class="p11">
<div align="right">谜底提醒:</div>
</td>
<td width="207" height="28" class="p11">
<input type="text" name="answer" size="20" class="c3a">
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="下一步" style="font-size: 10pt;color: #EFFB00; background-color: rgb(225,153,0)">
<input type="reset" name="Submit2" value="重来" style="font-size: 10pt;color: #EFFB00; background-color: rgb(225,153,0)">
</div>
</td>
</tr>
</table>
</td>
<td width="44%">
<div align="center"><img src="http://edu.cnzz.cn/images/login1.gif" width="120" height="90"></div>
</td>
</tr>
</table>
</td>
</tr></form>
</table>
</body>
</html>
第二步:注册履行法式。
<?
mysql_connect("localhost","username","password") /*请修正用户名和暗码*/
or die("没法毗连数据库,请重来");
mysql_select_db("数据库名")
or die("没法选择数据库,请重来");
$query="select id from 数据库表名 where username='$name'";
/*从数据库中寻觅不异名字的用户*/
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
if($numrows !=0)
/*假如找到了不异的用户的话,呈现以下提醒。*/
{
$temp='已有人注册此名,请从头选择名字!';
}
else
{
if ($word != $pass)
{
$temp = "暗码输出纷歧致!";
}
else
{
if (!eregi("^[a-z][a-z0-9_.]{3,19}$",$name))
{
$temp = "用户名不法.";
}
else
{
$query="insert into MemberAuth values('0','$name','$word','1','$ask','$answer')"; /*找不到不异的就输出新的用户材料*/
mysql_query($query);
$temp = "<img src=http://edu.cnzz.cn/NewsInfo/imagessuee.gif><br><a href='javascript:window.close()'>封闭窗口</a>";
}
}
}
?>
<html>
<head>
<title>请求帐号</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.p11 { font-size: 10pt; color: #000000; text-decoration: none}
.c3a {font-size: 9pt; color: #000000; background-color: #ffffff; border: 1 solid #ff9900}
-->
</style>
</head>
<body bgcolor="#FFFFFF" topmargin="0">
<table width="440" border="0" cellspacing="0" cellpadding="0" align="center">
<form method="post" action="zc.php">
<tr>
<td width="230"><img src="http://edu.cnzz.cn/images/login.gif" width="200" height="30"></td>
<td width="210" class="p11" valign="bottom"><font color="#FF6699">*</font>为必填项</td>
</tr>
</table>
<table width="440" border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#eeeeee" bordercolordark="#eeeeee" bordercolorlight="#ffcf60">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="56%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="170">
<tr>
<td width="111" class="p11">
<div align="right">用户名:</div>
</td>
<td width="207" class="p11">
<input type="text" name="name" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font></span> </td>
</tr>
<tr>
<td width="111" class="p11">
<div align="right">暗码:</div>
</td>
<td width="207" class="p11">
<input type="password" name="word" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font></span> </td>
</tr>
<tr>
<td width="111" class="p11">
<div align="right">确认暗码:</div>
</td>
<td width="207" class="p11">
<input type="password" name="pass" size="20" class="c3a">
<span class="p11"><font color="#FF6699">*</font> </span></td>
</tr>
<tr>
<td width="111" height="29" class="p11">
<div align="right">提醒成绩:</div>
</td>
<td width="207" height="29" class="p11">
<input type="text" name="ask" size="20" class="c3a">
</td>
</tr>
<tr>
<td width="111" height="28" class="p11">
<div align="right">谜底提醒:</div>
</td>
<td width="207" height="28" class="p11">
<input type="text" name="answer" size="20" class="c3a">
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="下一步" style="font-size: 10pt;color: #EFFB00; background-color: rgb(225,153,0)">
<input type="reset" name="Submit2" value="重来" style="font-size: 10pt;color: #EFFB00; background-color: rgb(225,153,0)">
</div>
</td>
</tr>
</table>
</td>
<td width="44%" class=p11 align=center>
<? echo $temp; ?>
</td>
</tr>
</table>
</td>
</tr></form>
</table>
</body>
</html>
怎么配置呢 ,问最好的老实百度,问啥都有答案。所以用好搜索引擎是学好的令1个关键,程序会出各样的问题,没有1个人可能会碰到所有的问题,所有就可以问百度这个大家精华的集合了。 |
|