Share examples of asp registration code

零下一度
Release: 2017-06-17 16:54:13
Original
1397 people have browsed it

User registration is a function that many websites must use. There are many ways to achieve registration. Today I will share my method. I separate the registration form file from the judgment and save data file. , reg.htm and reg.asp, there are many benefits of doing this. I don’t think I need to say more about this. You should know it after reading my previous articles. There are many of my articles in www.111cn.net. Below Look at the code.reg.htm, I won’t post the renderings,

<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"><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"> </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> </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> </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>
Copy after login

This is the code of reg.htm, all of which are htm. I won’t go into detail, but I want to remind you. , it is best to judge the legality of the data entered by the user on the client side, which is beneficial to the user experience. I will not write it here. I wrote it in detail in PHP Implementation·php User Login,

Next Look at the code of 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(&#39;请认真填写你的信息!&#39;);history.back();</script>")
 Elseif len(myanme)>15 or len(mypass)>15 or len(stuname)>5 or len(stuname)<2Then
  Response.Write("<script>alert(&#39;你输入信息的长度不对,用户名密码长度1-15位,姓名长度2-5位&#39;);history.back();</script>")
 Else
  Sql="select * from stu_user where user_id=&#39;"&myname&"&#39;"
  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(&#39;你的学号己被注册,请联系管理员再试!&#39;);history.back();</script>")
  End if
 End If
 
%>
Copy after login

Keep it simple,

The above is the detailed content of Share examples of asp registration code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!