注册审核
登录界面
张昊哲是管理员,所以登录zhanghaozhe的时候跳到审核界面,
刚注册的用户,没有通过审核的,登录不上,还是在本页面
审核通过的用户登录另一个页面
代码:
denglu.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<h1>登录页面</h1>
<form action="dengluchuli.php" method="post">
<div>用户名:<input type="text" name="uid" /></div>
<div>密码:<input type="text" name="pwd" /></div>
<div><input type="submit" value="登录" /></div>
</form>
</body>
</html>
建一个处理页面,dengluchuli.php
当输入的是已通过审核的账号并且这个人不是管理员时,登录putong.php
当输入的是zhanghaozhe(管理员)时,登录shenhe.php
当输入的账号密码错误或注册成功但没审核时,留在denglu.php页面
<?php session_start(); $uid=$_POST["uid"]; $pwd=$_POST["pwd"]; include("DBDA.php"); $db=new DBDA(); if($uid=="zhanghaozhe") { $_SESSION["uid"]=$uid; header("location:main.php"); }else{ $sql="select count(*) from users where uid='".$uid."' and pwd='".$pwd."' and isok = true"; $attr=$db->Query($sql); if($attr[0][0] == 1) { header("location:putong.php"); }else { header("location:denglu.php"); } } ?>
建一个putong.php页面,当当输入的是已通过审核的账号并且这个人不是管理员时,
登录下面的页面
最下面是个倒计时,3秒之后跳转另一个页面,并且所有字体闪烁
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <div id="blink" style="font-size:36px; height:200px; text-align:center; line-height:200px">登录成功<br /> 张昊哲大帅哥!!!!哇哈哈哈哈哈<br /> <span >请等待!!</span> <span id="second" >3</span> </div> <!-- 跳转--> <script type="text/javascript"> var num = document.getElementById("second").innerHTML; //获取显示秒数的元素,通过定时器来更改秒数。 function count() { num--; document.getElementById("second").innerHTML=num; if(num==0) { location.assign("tiaozhuan.php"); } } setInterval("count()",1000); //通过window的location和history对象来控制网页的跳转。 function back() { window.history.back(); } </script> <!--闪烁--> <script language="javascript"> function changeColor(){ var color="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray"; color=color.split("|"); document.getElementById("blink").style.color=color[parseInt(Math.random() * color.length)]; } setInterval("changeColor()",200); </script> </body> </html>
建一个tiaozhuan.php,
三秒钟之后跳转到本页面(字体动态效果)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <marquee direction="left" scrollamount="80"><marquee id="blink" scrollamount=80 behavior="alternate" direction="up" width="100%"><marquee direction="right" style="font-size:36px;">张昊哲确实是个大帅哥!!!!!!</marquee></marquee> </marquee> <marquee scrollamount=80 direction=right behavior=alternate><b><font color=#7700bb size=5><font color=lime> <marquee direction=up behavior=alternate width=40 height=200 align="middle">祝</marquee><font color=red> <marquee direction=up behavior=alternate width=40 height=150>愿</marquee><font color=orange> <marquee direction=up behavior=alternate width=40 height=200>朋</marquee><font color=fuchsia> <marquee direction=up behavior=alternate width=40 height=150>友</marquee><font color=olive> <marquee direction=up behavior=alternate width=40 height=200>们</marquee><font color=green> <marquee direction=up behavior=alternate width=40 height=150>开</marquee><font color=red> <marquee direction=up behavior=alternate width=40 height=200>心</marquee><font color=orange> <marquee direction=up behavior=alternate width=40 height=150>!</marquee><font color=orange></font></b></marquee> <script language="javascript"> function changeColor(){ var color="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray"; color=color.split("|"); document.getElementById("blink").style.color=color[parseInt(Math.random() * color.length)]; } setInterval("changeColor()",200); </script> </body> </html>
做一个审核界面,设置一个管理员,如果登录管理员账号,跳转本页面
刚注册的用户,需要管理员审核才能通过,之后才能登录,未经过审核的账号只是注册成功,不能登录
代码
main.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <h1>审核</h1> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>用户名</td> <td>姓名</td> <td>性别</td> <td>生日</td> <td>工号</td> <td>状态</td> </tr> <?php session_start(); if(empty($_SESSION["uid"])) //如果是空的,说明没有走denglu.php,不能访问主页面 { header("location:denglu.php"); } include("DBDA.php"); $db=new DBDA(); $sql="select uid,name,sex,birthday,code,isok from users"; $attr=$db->Query($sql); for($i=0;$i<count($attr);$i++) { $sexname = $attr[$i][2]?"男":"女"; $shenhe = $attr[$i][5]?"<span style='width:80px;height:30px;background-color:green'>已通过</span>":"<a href='shenhe.php?uid={$attr[$i][0]}'>审核</a>"; echo "<tr> <td>{$attr[$i][0]}</td> <td>{$attr[$i][1]}</td> <td>{$sexname}</td> <td>{$attr[$i][3]}</td> <td>{$attr[$i][4]}</td> <td>{$shenhe}</td> </tr>"; } ?> </table> </body> </html>
点击审核跳转到shenhe.php,处理完了返回main.php页面
<?php include("DBDA.php"); $uid=$_GET["uid"]; $db=new DBDA(); $sql="update users set isok = true where uid='".$uid."'"; $attr=$db->Query($sql,$type=0,$db="mydb"); header("location:main.php"); ?>
注册页面
代码:
zhuce.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <script src="jquery-1.11.2.min.js"></script> </head> <body> <h1>注册页面</h1> <div> <div>用户名:<input type="text" id="uid" /></div> <div>密码:<input type="text" id="pwd" /></div> <div>姓名:<input type="text" id="name" /></div> <div>性别:<input type="radio" name="sex" checked="checked" value="true" id="nan"/>男 <input type="radio" name="sex" value="false"/>女</div> <div>生日:<input type="text" id="birthday" /></div> <div>代号:<input type="text" id="code" /></div> <div><input type="button" id="btn" value="注册" /></div> </div> </body> <script type="text/jscript"> $(document).ready(function(e) { $("#btn").click(function(){ var uid =$("#uid").val(); var pwd =$("#pwd").val(); var name=$("#name").val(); var sex=$("#nan")[0].checked; var birthday=$("#birthday").val(); var code =$("#code").val(); $.ajax({ url:"zhucechuli.php", data:{uid:uid,pwd:pwd,name:name,sex:sex,birthday:birthday,code:code}, type:"POST", dataType:"text", success: function(date){ if(date==true) { alert("注册成功"); } else { alert("注册失败"); } } }) }) }); </script> </html>
建一个zhucechuli.php
点击注册
代码:
zhucechuli.php
<?php $uid=$_POST["uid"]; $pwd=$_POST["pwd"]; $name=$_POST["name"]; $sex=$_POST["sex"]; $birthday=$_POST["birthday"]; $code=$_POST["code"]; include("DBDA.php"); $db=new DBDA(); $sql="insert into users values ('".$uid."','".$pwd."','".$name."',".$sex.",'".$birthday."','".$code."',false)"; $attr= $db->Query($sql,$type=0,$db="mydb"); echo $attr; ?>
用户信息添加到数据库
当isok为1的时候用户才能登录