Share an example of ASP registration code

Source: Internet
Author: User
User registration is a lot of Web sites must use the function, the implementation of many methods of registration, today I took my method to share it, I put the registration form file, and judge to save the data file separate, reg.htm and reg.asp, so the benefits of a lot, I think this need not I say more, Read my previous articles should know, my article in the www.111cn.net there are many, the following look at the code. Reg.htm, I won't post it,

<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" > <tr> <td width= "$" height= "the" >&lt ;d IV align= "center" ></div></td> <td >&nbsp;</td> <td width= "><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=" "border=" 0 "cellpadding=" 0 "cellspacing=" 0 "> <form id=" Form1 "Name=" Form1 " Method= "POST" action= "singin.asp" > <tr> <td height= "Up" >&nbsp;</td> <td height = "><div" align= "center" ><font color= "#B4CFED" size= "3" ><b> user registration </b></font></ div></td> <td height= ">&nbsp;</td> </tr> <tr> <td width=" 118 "H eight= "><div" align= "right" ><b><font color= "#FFFFFF" > No.: </font></b></div></td> <td width= "><table width=" border= "0" cellspacing= "0" Cellpadd ing= "0" > <tr> <td width= "5" ></" td> <td background= "skins/input3.png" ><input name= "myname" type= "text" id= "myname" style= "Border:soli D 0px; "/></td> <td width=" 6 "></td&gt "        ; </tr> </table></td> <td width= "272" ><a href= "index.asp" > I have an account, log in? </a></td> </tr> <tr> <td height= "><div" align= "right" ><b><font C Olor= "#FFFFFF" > Password:</font></b></div></td> <td><table width= "$" border= "0" cellspacing= "0" cellpadding= "0" > <tr> <td width= "5" ></td>  &LT;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" >&nbsp;</td> </tr> <tr> &LT;TD height= "><div" align= "right" ><b><font color= "#FFFFFF" > Confirm password: </font></b>& lt;/div></td> <td><table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 "> &LT;TR&G          T &LT;TD width= "5" ></td> <td background=" skin          S/input3.png "><input name=" mypass2 "type=" password "id=" Mypass2 "style=" border:solid 0px; "/></td> &LT;TD width= "6" ></td> </tr> </ta" Ble></td> <td>&nbsp;</td> </tr> <tr> <td height= "><div" align= "right" ><b> <font color= "#FFFFFF" > Student name:</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>&nbsp;</td&    Gt </tr> <tr> <td height= "Max" >&nbsp;</td> <td><label> <input N Ame= "button" type= "Submit" class= "Nnt_submit" id= "button" value= "register"/> </label> <a href= "x_reg.as P "> <label> <input name= "button2" type= "reset" class= "Nnt_submit" id= "Button2" value= "reset"/> </lab el> </a></td> <td>&nbsp;</td> </tr></form> </table>

This is reg.htm code is all HTM does not speak, but to hint, it is best to judge in the client, the legality of user input data, so as to facilitate user experience, here I do not write, I in the implementation of PHP PHP user Login Inside the detailed written,

Here's a look at Reg.asp's code.

<!--#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 Resp Onse. Write ("<script>alert" please fill in your information carefully! History.back ();</script> ") Elseif len (myanme) >15 or Len (mypass) >15 or Len (stuname) >5 or Len (stuname) <2then Response.Write ("<script>alert (' the length of your input information is not correct, username password length 1-15 bits, name length 2-5 bits '); 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 R S.update session ("Uid") =myname session ("UDJ") = "0" session ("Stuname") =stuname Response.Redirect ("iframe.asp") El Se response.wrIte ("<script>alert (' Your study number has been registered, please contact the administrator to try again!") '); History.back ();</script> ") End If End If%>

Simple,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.