| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 725 人关注过本帖
标题:看一下 这段 代码
只看楼主 加入收藏
zdloveday
Rank: 2
等 级:论坛游民
帖 子:221
专家分:96
注 册:2008-9-5
结帖率:68.89%
收藏
 问题点数:0 回复次数:1 
看一下 这段 代码
<body>
<!-- #include file="../info/md5.asp" -->
<!-- #include file="../info/conn.asp" -->
<%
if request.Form("username")="" or request.Form("pwd")="" or request.Form("code")="" then
   response.write "<script language=JavaScript>" & chr(13) & "alert('请确认所有信息已经填写!');" & "history.back()" & "</script>"
Response.End
Else


if request.Form("PP")="person" then
  user_type=1
  call codeistrue("../UserLogin.asp")
End if
if Request.Form("company")="ee" then
   user_type=2
   call codeistrue("../Eelogin.asp")
End if

If Request.Form("login")="index" then
verifycode=trim(request("code"))
If cstr(session("Num"))<>cstr(trim(verifycode)) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
Else
  user_type=1
End if
End if


username=request.form("username")
pwd=md5(request.form("pwd"))

   Set Yrs=Server.CreateObject("ADODB.RecordSet")
   Sql="select * from login where user_name='"&username&"' and pwd='"&pwd&"' and user_type="&user_type
   Yrs.Open Sql,Conn,1,3
   IF Yrs.EOF or Yrs.Bof Then
      Response.write "<script language=JavaScript>" & chr(13) & "alert('此用户名或密码有误!');" &     "history.back()" & "</script>"
   Response.End
   else  
     
    
    
    conn.execute("update login set login_time=login_time+1 where user_name='"&username&"'")
    session("username")=username
    session("usertype")=Yrs("user_type")
    session("user_id")=Yrs("user_id")
      if user_type=1 then
             If IsNull(session("user_id")) then
                response.Write "<script language=JavaScript>alert('你的个人简历还未填写,马上填写!');window.location.href='PersonReg2.asp';</script>"
             Else
            Response.Redirect "Personmanger.asp"
             End if
      else
       Response.Redirect("../Company/Companymanger.asp")
      End if
   Yrs.close()
   set Yrs=nothing
   Closeconn()
  End if
End if  
%>
</body>
</html>
当注册 完 时。
跳转 到  下 一页面  填写 详细 信息 时 ,就把 页面 关了
在去 登陆
为什么 他不能运行 else 下面空白处后面的代码。

[[it] 本帖最后由 zdloveday 于 2008-9-11 14:50 编辑 [/it]]
搜索更多相关主题的帖子: else 的问题 
2008-09-11 14:47
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<body>
<!-- #include file="../info/md5.asp" -->
<!-- #include file="../info/conn.asp" -->
<%
if request.Form("username")="" or request.Form("pwd")="" or request.Form("code")="" then
   response.write "<script language=JavaScript>" & chr(13) & "alert('请确认所有信息已经填写!');" & "history.back()" & "</script>"
   Response.End
Else
  if request.Form("PP")="person" then
     user_type=1
     call codeistrue("../UserLogin.asp")
  End if
  if Request.Form("company")="ee" then
     user_type=2
     call codeistrue("../Eelogin.asp")
  End if
  If Request.Form("login")="index" then
     verifycode=trim(request("code"))
     If cstr(session("Num"))<>cstr(trim(verifycode)) then
        response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
        response.end
     Else
        user_type=1
     End if
  End if
  username=request.form("username")
  pwd=md5(request.form("pwd"))
  Set Yrs=Server.CreateObject("ADODB.RecordSet")
  Sql="select * from login where user_name='"&username&"' and       pwd='"&pwd&"' and user_type="&user_type
  Yrs.Open Sql,Conn,1,3
  IF Yrs.EOF or Yrs.Bof Then
     Response.write "<script language=JavaScript>" & chr(13) & "alert('此用户名或密码有误!');" &     "history.back()" & "</script>"
     Response.End
  else  
     conn.execute("update login set login_time=login_time+1 where user_name='"&username&"'")
     session("username")=username
     session("usertype")=Yrs("user_type")
     session("user_id")=Yrs("user_id")
     if user_type=1 then
        If IsNull(session("user_id")) then
           response.Write "<script language=JavaScript>alert('你的个人简历还未填写,马上填写!');window.location.href='PersonReg2.asp';</script>"
        Else
           Response.Redirect "Personmanger.asp"
        End if
     else
        Response.Redirect("../Company/Companymanger.asp")
     End if
     Yrs.close()
     set Yrs=nothing
     Closeconn()
  End if
End if  
%>
</body>
</html>
IF Yrs.EOF or Yrs.Bof Then不执行空白代码就很可能和这个IF有关,因为这是和else匹配的IF判断,只有不符合Yrs.EOF or Yrs.Bof这个条件才执行else
2008-09-11 20:37
快速回复:看一下 这段 代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016771 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved