分享关于asp注册代码实例

零下一度
发布: 2017-06-17 16:54:13
原创
1659人浏览过

用户注册是很多网站都必须用的功能,实现注册方法很多,今天我就把我方法拿出来共享一下吧,我把注册填表文件,与判断保存数据文件分开,reg.htm 与reg.asp,这样做的好处很多,我想这个不用我多说了吧,看了我以前的文章都应该知道了,我的文章在www.111cn.net里面有很多,下面看代码.reg.htm,效果图我就不贴了,

<table width="100%"border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="250" height="77" ><div align="center"></div></td>
    <td > </td>
    <td width="300"><div align="right"><a href="x_wai_chuli.asp?xlei=newman"></a></div></td>
  </tr>
</table>
<div  style="position: relative; top:80px; width:400px; height:300px; left:30%">
  
  
  <table width="600" border="0" cellpadding="0" cellspacing="0">
   <form id="form1" name="form1" method="post" action="singin.asp"> 
     <tr>
      <td height="50"> </td>
      <td height="50"><div align="center"><font color="#B4CFED" size="3"><b>用户注册</b></font></div></td>
      <td height="50"> </td>
    </tr>
    <tr>
      <td width="118" height="40"><div align="right"><b><font color="#FFFFFF">学号:</font></b></div></td>
      <td width="210"><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="5">@@##@@</td>
          <td background="skins/input3.png"><input name="myname" type="text" id="myname" style="border:solid 0px;" /></td>
          <td width="6">@@##@@</td>
        </tr>
      </table></td>
      <td width="272"><a href="index.asp">我有帐号了,登录?</a></td>
    </tr>
    <tr>
      <td height="40"><div align="right"><b><font color="#FFFFFF">密 码:</font></b></div></td>
      <td><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="5">@@##@@</td>
          <td background="skins/input3.png"><input name="mypass" type="password" id="mypass" style="border:solid 0px;" /></td>
          <td width="6">@@##@@</td>
        </tr>
      </table></td>
      <td align="left"> </td>
    </tr>
    <tr>
      <td height="40"><div align="right"><b><font color="#FFFFFF">确认密码:</font></b></div></td>
      <td><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="5">@@##@@</td>
          <td background="skins/input3.png"><input name="mypass2" type="password" id="mypass2" style="border:solid 0px;" /></td>
          <td width="6">@@##@@</td>
        </tr>
      </table></td>
      <td> </td>
    </tr>
    <tr>
      <td height="40"><div align="right"><b><font color="#FFFFFF">学生名称:</font></b></div></td>
      <td><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="5">@@##@@</td>
          <td background="skins/input3.png"><input name="stuname" type="text" id="stuname" style="border:solid 0px;" /></td>
          <td width="6">@@##@@</td>
        </tr>
      </table></td>
      <td> </td>
    </tr>
    <tr>
      <td height="40"> </td>
      <td><label>
        <input name="button" type="submit" class="nnt_submit" id="button" value="注册" />
      </label>
        <a href="x_reg.asp">
        <label>
        <input name="button2" type="reset" class="nnt_submit" id="button2" value="重置" />
        </label>
        </a></td>
      <td> </td>
    </tr></form>
  </table>
登录后复制

 

这是reg.htm的代码全是htm的不讲了,不过要提示一下,最好在客户端进行判断,用户输入数据的合法性,这样有利于用户体验,这里我不写了,我在php实现·php 用户登陆里面详细的写了,

下面来看reg.asp的代码

<!--#include file="inc/cn.asp" -->
<!--#include file="inc/function.asp" -->
<%
 myname =Html_encode(Request.Form("myname"))
 mypass =Html_encode(Request.Form("mypass"))
 mypass2 =Html_encode(Request.Form("mypass2"))
 stuname =Html_encode(Request.Form("stuname"))
 
 If myname="" or mypass="" or mypass<>mypass2 or stuname="" Then
  Response.Write("<script>alert('请认真填写你的信息!');history.back();</script>")
 Elseif len(myanme)>15 or len(mypass)>15 or len(stuname)>5 or len(stuname)<2Then
  Response.Write("<script>alert('你输入信息的长度不对,用户名密码长度1-15位,姓名长度2-5位');history.back();</script>")
 Else
  Sql="select * from stu_user where user_id='"&myname&"'"
  Call Db_connect()
  Rs.open Sql,conn,1,3
  If  Rs.eof Then
   Rs.addnew
   Rs("user_id")=myname
   Rs("user_dj")="0"
   Rs("User_name")=stuname
   Rs("user_pwd")=mypass2
   Rs.update
   Session("Uid")=myname
   Session("Udj")="0"
   Session("Stuname")=stuname
   Response.Redirect("iframe.asp")
  
  Else
   Response.Write("<script>alert('你的学号己被注册,请联系管理员再试!');history.back();</script>")
  End if
 End If
 
%>
登录后复制

 简单吧,

分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例分享关于asp注册代码实例

以上就是分享关于asp注册代码实例的详细内容,更多请关注php中文网其它相关文章!

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号