当前位置: 代码迷 >> ASP >> 如何样才能使err1异常提示和提交表单在一个页面显示
  详细解决方案

如何样才能使err1异常提示和提交表单在一个页面显示

热度:467   发布时间:2012-02-03 22:02:47.0
怎么样才能使err1错误提示和提交表单在一个页面显示
下面的代码文件名称是adminlogin.asp

<!--#include   file   =   '../includefile/include.asp '-->
<!--#include   file   =   '../includefile/judge.asp '-->
<%  
      dim   names
      dim   pass
      dim   err1
'if   Request.ServerVariables( "REQUEST_METHOD ")   =   "POST "   then  
      names   =   trim(Cstr(Request.Form( "username ")))
      pass   =   trim(Cstr(Request.Form( "password ")))
          if   names   =   Empty   or   pass   =   empty   then
                                err1   =   "错误:用户名和密码不能为空! "
                        response.write   err1
  end   if
          if   dx(names)   =   "true "   or   dx(pass)   =   "true "   then
              err1   =   "错误:用户名和密码只能在5-16个字符之间! "
                          response.write   err1
  end   if
          if   nochar(names)   =   "false "   or   nochar(pass)   =   "false "   then
              err1   =   "错误:用户名和密码只能在A-Z,a-z,0-9之间! "
                            response.write   err1
  end   if  
 
    if   len(err1)   =   0   then
  dim   sql1
Sql1   =   "SELECT   *   FROM   administrator   WHERE   username= ' "&names& " '   and   password= ' "&pass& " ' "
rs.open   sql1,con,1,1
  if   not   rs.eof   then
                Session( "username ")   =   names
        Session( "password ")   =   pass
                response.Redirect   "manage.asp "
rs.close()
set   rs   =   Nothing
con.close()
set   con   =   Nothing

response.Flush()
response.End()
else
response.write   " <font   color=red> <strong> 错误: </strong> </font> 用户名或密码错误! "
    response.end
end   if
end   if  
'end   if
%>  
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 登录 </title>
<style>
<!--
.INPUT.buttonface{BACKGROUND:   #DDDDFF;   border:1   solid   #183ead;   COLOR:   #000000;   FONT-SIZE:   9pt;   FONT-STYLE:   normal;   FONT-VARIANT:   normal;   FONT-WEIGHT:   normal;   HEIGHT:   18px;   LINE-HEIGHT:   normal}
.snow1{   font-size:12px;   font-family: "宋体 ";   color:#000000}
  相关解决方案