没人回答,登陆的全部代码: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>[ 办公系统 ]</title> <style type="text/css"> <!-- body { font-size: 12px; cursor: default} td { font-size: 12px; cursor: default} input { font-size: 12px} a:link { color: #000099; text-decoration: none} a:visited { color: #000099; text-decoration: none} a:hover { text-decoration: underline; color: #0000FF} .Input { font-size: 12px; background-color: #FFFFFF; height: 20px;BORDER: #333333 solid 1px} .radio { height: 13px} --> </style> <SCRIPT language="javascript"> var doc = document; function init() { self.focus(); if( top.name != self.name && self.name != "main" && self.name != "viewFrame" && self.name != "mailMain") //在窗口中显示不出,则全屏 { top.close; top.opener=self; top.location.href="login.php"; return; } } </SCRIPT> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#4255BD" onload="javascript:init();"> <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript> <!-- //去掉字符串的首尾空格 function ThrowBlank(string) { var msg=""; msg=string; while(msg.substring(0,1)==" ") { msg=msg.substring(1,msg.length); } return msg; } function CheckPages() { if (ThrowBlank(document.LoginForm.loginuser.value) == "") { alert("请输入登录名"); //document.LoginForm.loginuser.value =""; document.LoginForm.loginuser.focus(); return false; } if ( ThrowBlank(document.LoginForm.loginpass.value)=="" ) { alert("请输入密码"); //document.LoginForm.loginpass.value=""; document.LoginForm.loginpass.focus(); return false; } return true; } function datacheck() { if (CheckPages()) { LoginForm.action = "login.php?action=login"; //login.submit(); return true; } return false; } //--> </SCRIPT> <Form id="LoginForm" name="LoginForm" method=post> <input type=hidden name='cur_' value=''> <input type=hidden name='act_' value=''> <input type=hidden name='sact_' value=''> <div align="center"><img src="images/shim.gif" width="504" height="30"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" height="90%"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td background="images/bgImage.gif" align="center"> <table width="504" cellspacing="0" cellpadding="0" border="0"> <tr> <td height="82"><font color="#FF3300"><img src="images/shim.gif" width="5" height="82"></font></td> </tr> <tr> <td height="177" background="images/homeImage.gif"><img src="images/shim.gif" width="5" height="177" align="top"></td> </tr> <tr> <td height="81" background="images/homeBottom.gif" valign="bottom" align="center"> <table height="73"> <tr> <td width="210"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td width="60">用户名称:</td> <td> <input name="loginuser" style="width:120px" class="Input" value=""> </td> </tr> <tr> <td>口 令:</td> <td> <input name="loginpass" type="password" style="width:120px" class="Input" maxlength=16> </td> </tr> </table> </td> <td width="100"> <input type="hidden" name="fromURL" value="maximize.asp"> <input type="image" name="login" src="images/loginButton.gif" width="73" height="60" border="0" alt="登 录" onclick="javascript:return datacheck();"> </td> <td> <table cellpadding="3"> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <img src="images/shim.gif" width="504" height="65"></td> </tr> </table> </Form> <? if($action == 'login') {//echo $loginuser;exit; $connect = mysql_pconnect("localhost","root","hcedagb"); mysql_select_db("icbcoa",$connect); if ($loginuser) { $query = "select * from oa_user where username='".$loginuser."'"; $query.=" and password ='" . $loginpass ."'"; $result = mysql_query($query); if(@mysql_num_rows($result)>0) { @mysql_data_seek($result,0); $data = @mysql_fetch_array($result); session_start(); // 注册登陆成功的 admin 变量,并赋值 true $_SESSION["admin"] = true; $_SESSION["susername"] = $data[username]; $_SESSION["susername"] = $data[username]; $_SESSION["shangming"] = $data[hangming]; $_SESSION["sbumen"] = $data[bumen]; $_SESSION["sjibie"] = $data[jibie]; $_SESSION["sgangwei"] = $data[jibie]; $url = "index.php"; $show_message .= "<meta http-equiv=\"refresh\" content=\"0;url=$url\">"; echo $show_message; exit; } else { ?> <SCRIPT language="javascript"> alert("对不起,您的登陆信息错误,请重新登陆"); </script> <? } } mysql_close($connect); } ?> </body> </html>