登陆页面:Login.php页面
-------------------------------------------------
<script language="javascript"> function RefreshImage(id){ document.getElementById(id).src ='im.php?'+Math.random(1); } function ver(){ var yan=document.getElementById("verification").value; if(yan==""){ alert("请输入验证码。。。"); return false; } return true; }</script><body><div id="Login_index"> <div id="Login_main"> <form action="Login_check.php" method="post" onsubmit="return ver()" > <div id="Login_mian2"> <div id="Login_name"> <div id="laogin_name2"><img src="image/Login_name.png" width="30" height="33" /></div> <div id="name"> <input name="username" type="text" width="150px" height="33px" /> </div> </div> <div id="Login_name"> <div id="laogin_name2"><img src="image/mima.png" width="30" height="33" /></div> <div id="name"> <input name="pwd" type="password" id="pwd" width="150px" height="33px" /> </div> </div> <div id="Login_name"> <div id="laogin_name2"><img src="image/mima.png" width="30" height="33" /></div> <div id="name3"> <input type="text" id="verification" size="8" width="100px" height="33px" name="we"/> </div> <div id="name4"> <img src="im.php" id="con" /><br /> <a href="#" onclick="RefreshImage('con')">看不清,换一张</a> </div> </div> <div id="Login_name"> <div id="Login_denglu"> <input name="Submit" type="image" value="提交" src="image/denglu.png" /> </div> </div> </div></form> </div></div> <div id="L_xia"></div></body>
---------------------------------------------------------------------
验证用户名和密码登陆页面:Login_check.php页面
<script language="javascript">
function setSB(v, el) {
var ie5 = (document.all && document.getElementsByTagName);
if (ie5 || document.readyState == "complete") {
filterEl = el.children[0];
valueEl = el.children[1];
filterEl.style.width = v + "%";
valueEl.innerText = v + "%";
}
}
function fakeProgress(v, el) {
if (v >100){
location.href = "Frameset.php";
}
else {
setSB(v, el);
window.setTimeout("fakeProgress(" + (++v) + ", document.all['" + el.id + "'])", 20);
}
}
function fakeProgress1(v, el) {
if (v >50){
alert("登陆失败,请检查用户名或密码是否正确。。。。。");
history.go(-1);
}
else {
setSB(v, el);
window.setTimeout("fakeProgress1(" + (++v) + ", document.all['" + el.id + "'])", 20);
}
}
</script>
<?php
include_once"config.php"; //引入连接数据库的页面
$ver=$_SESSION['str'];
$name=$_POST['username'];
$pwd= $_POST['pwd'];
$verText=$_POST['we'];
$num=mysql_num_rows(mysql_query("select * from user where userName='$name' and userPwd='$pwd'"));
if(strtolower($ver)!=strtolower($verText)){
echo "<script>alert(\"验证码输入不正确。。。。。。。。\");</script>";
echo "<script>history.go(-1);</script>";
exit();
}
if($num>0){
$_SESSION["name1"]=$name;
echo"<body onLoad=\"fakeProgress(0, sb)\" topmargin=180 bgcolor=#CCCCCC>";
echo "<center> ";
echo " <p align=center style=\"font-szie:9pt; line-height: 100%\">登陆中 </p>";
echo "<span id=sb style=\"width: 500px\">";
echo " <div style=\"filter: Alpha(Opacity=0, FinishOpacity=60, style=1, StartX=0, StartY=0, FinishX=100, FinishY=0); width: 0%; height: 12px; position: absolute; background: #9999ff\"></div>";
echo "<div style=\"font-size: 12px; width: 100%; color: #ff3333; font-family: arial; text-align: center\"></div>";
echo "</span>";
echo"</center>";
echo" </body>";
exit();
}else{
echo "<body onLoad=\"fakeProgress1(0, sb)\" topmargin=180 bgcolor=#CCCCCC>";
echo "<center> ";
echo "<p align=center style=\"font-szie:9pt; line-height: 100%\">登陆中 </p>";
echo "<span id=sb style=\"width: 500px\">";
echo "<div style=\"filter: Alpha(Opacity=0, FinishOpacity=60, style=1, StartX=0, StartY=0, FinishX=100, FinishY=0); width: 0%; height: 12px; position: absolute; background: #9999ff\"></div>";
echo "<div style=\"font-size: 12px; width: 100%; color: #ff3333; font-family: arial; text-align: center\"></div>";
echo "</span>";
echo " </center>";
echo " </body> ";
exit();
}
?>