ASP Registration Code

Source: Internet
Author: User
Tags reset

User registration is a feature that many websites have to use, implementation of the registration method a lot, today I will take out my method to share it, I put the registration document, and judge to save the data file separate, reg.htm and reg.asp, this do a lot of benefits, I think this need not I said more, Read my previous articles should know, I have a lot of articles in the www.111cn.net, the following look at the code. Reg.htm, I'm not going to post the picture,

<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
&LT;TD width= "height=" ><div align= "center" ></div></td>
&LT;TD >&nbsp;</td>
&LT;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>
&LT;TD height= ">&nbsp;</td>"
&LT;TD height= "><div" align= "center" ><font color= "#B4CFED" size= "3" ><b> user registration </b></ Font></div></td>
&LT;TD height= ">&nbsp;</td>"
</tr>
<tr>
&LT;TD width= "118" height= "><div align=" right "><b><font color=" #FFFFFF "> School No.:</font> </b></div></td>
&LT;TD width= "210" ><table width= "0" border= "0" cellspacing= "0" >
<tr>
&LT;TD width= "5" ></td>
&LT;TD background= "Skins/input3.png" ><input name= "myname" type= "text" id= "myname" "style=" border:solid 0px; " ></td>
&LT;TD width= "6" ></td>
</tr>
</table></td>
&LT;TD width= "272" ><a href= "index.asp" > I have the account number, login? </a></td>
</tr>
<tr>
&LT;TD height= "><div" align= "right" ><b><font color= "#FFFFFF" > Password:</font></b> </div></td>
<td><table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 ">
<tr>
&LT;TD width= "5" ></td>
&LT;TD background= "Skins/input3.png" ><input name= "Mypass" "type=" password "id=" Mypass "style=" border:solid "0px;" /></td>
&LT;TD width= "6" ></td>
</tr>
</table></td>
&LT;TD align= "left" >&nbsp;</td>
</tr>
<tr>
&LT;TD height= "><div" align= "right" ><b><font color= "#FFFFFF" > Confirm password:</font></b> </div></td>
<td><table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 ">
<tr>
&LT;TD width= "5" ></td>
&LT;TD background= "Skins/input3.png" ><input name= "mypass2" type= "password" id= "Mypass2" style= "Border:solid" 0px; "/></td>
&LT;TD width= "6" ></td>
</tr>
</table></td>
<td>&nbsp;</td>
</tr>
<tr>
&LT;TD height= "><div" align= "right" ><b><font color= "#FFFFFF" > Student name:</font></b> </div></td>
<td><table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 ">
<tr>
&LT;TD width= "5" ></td>
&LT;TD background= "Skins/input3.png" ><input name= "Stuname" type= "text" id= "Stuname" "style=" border:solid 0px; " ></td>
&LT;TD width= "6" ></td>
</tr>
</table></td>
<td>&nbsp;</td>
</tr>
<tr>
&LT;TD height= ">&nbsp;</td>"
<td><label>
<input name= "button" type= "Submit" class= "Nnt_submit" id= "button" value= "register"/>
</label>
<a href= "x_reg.asp" >
<label>
<input name= "Button2" type= "reset" class= "Nnt_submit" id= "Button2" value= "reset"/>
</label>
</a></td>
<td>&nbsp;</td>
</tr></form>
</table>

This is the reg.htm code is all HTM not speak, but to prompt, it is best to judge on the client, the user input data legality, so conducive to user experience, here I do not write, I in the PHP implementation 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
Response.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 '); 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" Your number has been registered, please contact the administrator to try again!) '); History.back ();</script> ")
End If
End If

%>

It's easy,

NOTE: Reprint please indicate the original www.111cn.net

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.