日期:2014-05-17 浏览次数:20587 次
<?php session_start(); $width=50; $height=20; header("Content-type:image/gif"); $randval=randStr(4); $im=imagecreatetruecolor($width,$height); $r=array(255,215,235,195,175); $g=array(255,215,235,195,175); $b=array(255,215,235,195,175); $key=rand(0,4); $backColor=imagecolorallocate($im,$r[$key],$g[$key],$b[$key]); $pointColor=imagecolorallocate($im,255,170,255); imagefill($im,0,0,$backColor); $stringColor=imagecolorallocate($im,0,0,0); for($i=0;$i<=100;$i++){ $pointX=rand(2,$width-2); $pointY=rand(2,$height-2); imagesetpixel($im,$pointX,$pointY,$pointColor); } imagestring($im,3,5,1,$randval,$stringColor); $ImageFun='Imagegif'; $ImageFun($im); imagedestroy($im); function randStr($len=10){ $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $string=""; while(strlen($string)<$len){ $string.=substr($char,(rand()%strlen($chars)),1); } return $string; } $_SESSION['identifying']=$randval; ?>
?<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>登录</TITLE> <META http-equiv=Content-Type content="text/html; charset=utf-8"> <LINK href="images/public.css" type=text/css rel=stylesheet> <LINK href="images/login.css" type=text/css rel=stylesheet> <STYLE type=text/css> </STYLE> <META content="MSHTML 6.00.2900.5848" name=GENERATOR> <script language='javascript'> function check(){ if(docnument.getElementByID("txtUserName").value==''){ alert("用户名不允许为空"); docnument.getElementById("txtUserName").focus(); return false; } if(docnument.getElementById("txtUserPassword").value==''){ alert("密码不能为空"); docnument.getElementById("txtUserPassword").focus(); return false; } return true; } </script> </HEAD> <BODY> <form name="loginfrom" action="php/userController.php?flag=login"method="POST"> <DIV id=div1> <TABLE id=login height="100%" cellSpacing=0 cellPadding=0 width=800 align=center> <TBODY> <TR id=main> <TD> <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"> <TBODY> <TR> <TD colSpan=5> </TD> <TR height=30> <TD width=380> </TD> <TD> </TD> <TD> </TD> <TD> </TD> <TD> </TD> </TR> </TR> <TR height=20> <TD width> </TD> <TD><font size="3"><b>登录<b></font></TD> <td> <input type="radio" name="account" value="student"checked>学生 <input type="radio" name="account" value="teacher">教师 <td></TR> </TR><TR height=20> <TR height=40> <TD rowSpan=4> </TD> <TD>用户名:</TD> <TD> <INPUT class=textbox id="user_name" name=