资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

大家帮我看看,我这几个地方用session错在什么地方(我是菜鸟^_^)

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

大家帮我看看把,程序原来是对的,加了session得语句就错了,我今天刚学session,所以希望大家当我是个菜鸟不要笑我。session得语句前我打了*******,希望大家指正,还有那个global.asa里面得设置也请大家教我下。  
  <!--#include   file="conn.asp"-->  
  <!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN">  
  <html>  
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>输入密码界面</title>  
  </head>  
  <body   bgcolor="#008000"   text="#000000">  
   
  <%  
  dim   temp1  
  dim   temp2  
  temp1=trim(Request.Form("textfield"))  
  temp2=request.form("textfield2")  
  ****************session("username")=temp1  
  ****************session("flag")=False  
  %>  
   
  <script   language="VBScript">  
  sub   check()  
  if   form1.textfield.value=""     then  
  msgbox"请填写姓名!"  
  exit   sub  
  end   if  
  if   form1.textfield2.value=""     then  
  msgbox"请填写密码!"  
  exit   sub  
  from1.action("index.asp")  
  end   if  
  end   sub  
  </script>  
  <%  
  if   Request.Form.Count=0   then  
  %>  
  <form   action=""   method="post"   name="form1"   target="_self">  
      <p>    
          <CENTER>  
               </CENTER>  
      <p>    
          <CENTER>  
              <table   border="0"   cellpadding="0"   cellspacing="0"   style="border-collapse:   collapse"   width="49%"   id="AutoNumber1"   height="33">  
                  <tr>  
                      <td   width="66%"   height="16">  
                      <p   align="center">  
              <input   name="textfield"   size="20"   >   </td>  
                      <td   width="34%"   height="16">  
                      <p   align="center">&nbsp;   用户名   </td>  
                  </tr>  
                  <tr>  
                      <td   width="66%"   height="16">  
                      <p   align="center">  
              <input   type="password"   name="textfield2"   align=middle   style="BORDER-LEFT-WIDTH:   thin"   size="20"></td>  
                      <td   width="34%"   height="16">  
                      <p   align="center">&nbsp;密码   </td>  
                  </tr>  
              </table>  
          </CENTER>  
      <p>    
          <CENTER>  
              <input   type="submit"   name="Button"   value="提交"onclick="vbs:check()">  
              <input   type="reset"   name="Submit2"   value="重填">  
          </CENTER>  
      <P></P>  
  </form>  
  <%else%>  
  <%dim   username  
      dim   password  
      dim   act  
  username=request.form("textfield")  
  password=request.form("textfield2")  
  strSQL="select   *   from   yhzc     "_  
  &"Where       username       =     "_  
  &""_  
  &request.form("textfield")_  
  &""  
  response.Write(strSQL)  
  set   rs1=conn.execute(strSQL)  
   
   
  if       not(   rs1.BOF   and   rs1.EOF)         then      
        if         rs1("password")=password   then  
      *********************session("flag")=True  
         
   
   
      response.write   "<center><font   color=red><b><strong>"&request("textfield")&"</strong></b></font>"&"欢迎你登录~</center>"    
      response.write"<center><p><a   href=""index4.asp"">进入管理</a></p></center>"  
        else  
  Response.write   "<center>Password   was   invaild</center>"  
        end   if    
  else    
  response.write"<li><center>username   error!!!</center>"  
        End   if  
       
   
        %>  
   
  <%    
                  rs1.close  
                  set   rs1=nothing  
  conn.close  
  set   conn=nothing  
  End   if  
  %>  
  <%  
  ****************if   session("flag")     <>     true       then  
  ****************response.Redirect("error.asp")  
  %>  
  <p>  
  </body>  
  </html>

网友回答:

发表者:mouse_2004

最后没写end   if  
  程序写得规范一些,自己也容易找错


 

 
热门推荐笔记本: 惠普笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved