asp注册代码

用户注册是很多网站都必须用的功能,实现注册方法很多,今天我就把我方法拿出来共享一下吧,我把注册填表文件,与判断保存数据文件分开,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 >&nbsp;</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">&nbsp;</td>
      <td height="50"><div align="center"><font color="#B4CFED" size="3"><b>用户注册</b></font></div></td>
      <td height="50">&nbsp;</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"><img src="skins/input1.png" width="5" height="25" /></td>
          <td background="skins/input3.png"><input name="myname" type="text" id="myname" style="border:solid 0px;" /></td>
          <td width="6"><img src="skins/input2.png" width="6" height="25" /></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"><img src="skins/input1.png" width="5" height="25" /></td>
          <td background="skins/input3.png"><input name="mypass" type="password" id="mypass" style="border:solid 0px;" /></td>
          <td width="6"><img src="skins/input2.png" width="6" height="25" /></td>
        </tr>
      </table></td>
      <td align="left">&nbsp;</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"><img src="skins/input1.png" width="5" height="25" /></td>
          <td background="skins/input3.png"><input name="mypass2" type="password" id="mypass2" style="border:solid 0px;" /></td>
          <td width="6"><img src="skins/input2.png" width="6" height="25" /></td>
        </tr>
      </table></td>
      <td>&nbsp;</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"><img src="skins/input1.png" width="5" height="25" /></td>
          <td background="skins/input3.png"><input name="stuname" type="text" id="stuname" style="border:solid 0px;" /></td>
          <td width="6"><img src="skins/input2.png" width="6" height="25" /></td>
        </tr>
      </table></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="40">&nbsp;</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>&nbsp;</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
 
%>

 简单吧,

 

注明:转载请注明原处www.111cn.net

时间: 2024-08-30 22:30:13

asp注册代码的相关文章

网站的ASP注册代码出错,谁能帮看看是哪里出错?

问题描述 <!--#includefile="conn.asp"--><%uid=request("uid")pwd=REQUEST("pwd")uname=REQUEST("uname")xb=REQUEST("xb")sfz=REQUEST("sfz")email=REQUEST("email")tel=REQUEST("tel&quo

asp 检测域名是否注册代码

asp 检测域名是否注册代码 <% On Error Resume Next Server.ScriptTimeOut=9999999 Function getHTTPPage(Path)         t = GetBody(Path)   getHTTPPage=BytesToBstr(t,"GB2312") End function Function GetBody(url)         on error resume next         Set Retriev

ASP注册登陆实例代码_应用技巧

数据库位置:data/data.mdb 数据库表:user  id name pwd wenti daan  conn.asp <% db="data/data.mdb" '数据库存放目录 on error resume next set conn=server.createobject("adodb.connection") conn.open "driver={microsoft access driver (*.mdb)};dbq="

PHP和ASP.NET代码哪个运行速度更快?

刚刚在9月编程语言排行榜上取得历史性突破的PHP在Web开发领域最到的对手可能就是基于微软.NET技术的ASP.NET.近日,微软的Joe Stagner在博客上发表了一系列文章比较了PHP和ASP.NET性能方面的文章,引起了来自双方程序员的大量回应.Joe表示,他会将这样的测试持续下去,并寻求更为合适的方式,以获得对实际项目来说尽可能有参考价值的结论. Joe在博客中称,一般来说,作性能测试的目的是要尝试证明一方比令一方要快.我受雇于微软,同时编写PHP和ASP.NET代码.我在.NET出现

asp采集代码示例

下面是一侧ASP采集页面内容最基础的必备源代码,修改以下的代码需要有一定的ASP基础. 以下是引用片段:< %  '功能:asp采集代码  '作者:wangsdong  '备注:支持原创程序,请保留此信息,谢谢  url="http://sports.sina.com.cn/k/2008-09-15/04593948756.shtml"  str=getHTTPPage(url)  title=strcut(str,"<h1 id=""arti

ASP程序代码执行时间统计类

程序|统计|执行 ASP程序代码执行时间统计类 第一次写ASP类,实现功能:分段统计程序执行时间,输出统计表等. 程序代码: Class ccClsProcessTimeRecorder''ASP程序代码执行时间统计类  Private ccInti,ccIntNonceTime,ccIntDecimal Private ccIntStartTime,ccIntEndTime,ccIntNow,ccIntNonce Private ccStrInterval,ccStrEvent,ccStrTi

简易ASP+注册系统

asp+ <%@ Page Language="C#" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SQL" %><html><head><title>ASP+注册</title><link rel="stylesheet" type=&

ASP获得代码中第一张图片地址

<%'把pattern 又修改了下'code要检测的代码'www.nml78z.cn/article.asp?id=29'leixing html 或者ubb'nopic 代码没有图片时默认值function toppic(code,leixing,nopic) set regex = new regexp regex.ignorecase = true regex.global = true if leixing = "html" then regex.pattern = &q

php-PHP新手求助这段注册代码的各种问题

问题描述 PHP新手求助这段注册代码的各种问题 这是个注册代码,我需要在注册的时候能够判断有没有输入账号密码什么的,然后密码要验证两次是否相等,然后注册成功要上传到数据库,可是什么功能都不成功,搞了好久好麻烦,我的localhost没有账号密码 <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/