注册网页代码
1. 求助:注册页面源代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="include/conn.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="include/md5.asp"-->
<!--#include file="include/wzxx.asp"-->
<%
set rs12=server.CreateObject("adodb.recordset")
sql="select top 10 uid,yhm,nicheng,sex,yhtime from userb order by uid desc"
rs12.open sql,conn,1,3
%>
<%
yhm=Str_filter(trim(request.Form("yhm")))
nicheng=Str_filter(trim(request.Form("nicheng")))
pwd=md5(Str_filter(trim(request.form("pwd"))))
sex=Str_filter(trim(request.form("sex")))
mmwt=Str_filter(trim(request.Form("mmwt")))
mmda=Str_filter(trim(request.Form("mmda")))
xingming=Str_filter(trim(request.form("xingming")))
ICO=Str_filter(trim(request.Form("ICO")))
eamil=Str_filter(trim(request.form("eamil")))
tel=Str_filter(trim(request.form("tel")))
qq=Str_filter(trim(request.form("qq")))
di=Str_filter(trim(request.form("di")))
ip=Str_filter(trim(request.form("ip")))
if yhm<>"" then
set rs1=Server.CreateObject("ADODB.Recordset")
sql="Select * from userb where yhm='"&yhm&"'"
rs1.open sql,conn,1,3
if not rs1.eof then
response.Write("<script language='javascript'>;alert('此用户名已经存在,请重新输入用户名!');history.go(-1);</script>")
else
rs1.addnew
rs1("yhm")=yhm
rs1("nicheng")=nicheng
rs1("pwd")=pwd
rs1("sex")=sex
rs1("mmwt")=mmwt
rs1("mmda")=mmda
rs1("xingming")=xingming
rs1("ICO")=ICO
rs1("eamil")=eamil
rs1("tel")=tel
rs1("qq")=qq
rs1("di")=di
rs1("ip")=ip
rs1.update
rs1.close
'修改用户登录信息!
set rs14=server.CreateObject("adodb.recordset")
sql="select * from logion"
rs14.open sql,conn,1,3
rs14.addnew
rs14("yhm")=yhm
rs14("nicheng1")=nicheng
rs14("sex4")=sex
rs14("log_tx")=ICO
rs14("log_cs")=1
rs14("gongxian")=5
rs14("log_time")=now()
rs14("log_ip")=ip
rs14.update
rs14.close
set rs14=nothing
response.Write("<script language='javascript'>;alert('恭喜您,注册成功,请登录!');location.href='zhuce2.asp';</script>")
set rs1=nothing
end if
end if
%>
2. 网页设计里的注册源代码
是jsp吗,还是asp什么的
首先数据库连接没问题,且库中有测试用户名和密码,我这里有一个拿去参考吧~
输入页面加入<from>表单,将用户输入内容提交到validation.jsp进行验证。
<form name="myform" action="validation.jsp" method="post">
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="143" id="table212">
<tr>
<td width="13%" height="38" class="top_hui_text"><span class="login_txt">用户: </span></td>
<td height="38" colspan="2" class="top_hui_text"><input name="username" class="editbox4" value="" size="20"> </td>
</tr>
<tr>
<td width="13%" height="35" class="top_hui_text"><span class="login_txt"> 密码: </span></td>
<td height="35" colspan="2" class="top_hui_text"><input name="userpass" class="editbox4" type="password" size="20" >
<img src="images/luck.gif" width="19" height="18"> </td>
</tr>
<td height="35" > </td>
<td width="10%" height="35" ><input name="Submit" type="submit" class="button" id="Submit" value="登 陆" onclick="return valid()"> </td>
<td width="80%" class="top_hui_text"><input name="cs" type="reset" class="button" id="cs" value="取 消"></td>
</tr>
</table>
<br>
</form>
然后第二个页面validation.jsp接收数据,验证通过后进入其他页面,比如'login.jsp'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>活动日志</title>
</head>
<%//接收客户端提交的数据
String username=request.getParameter("username");
String pass=request.getParameter("userpass");
try{
ResultSet rs=inBean.executeQuery("select * from employees where emp_name='"+username+"' and emp_pwd='"+pass+"'");//执行SQL语句并返回结果
if(rs.next())
{ out.print("<script>window.location='login.jsp' </script>");
}
else{
// out.print("登陆失败");
out.print("<script>alert('用户名或密码错误,请重新登录...'); window.location='index.jsp' </script>");
// response.sendRedirect("index.jsp.html");
}
//rs.close();
rs.close();
}
catch(SQLException e1){out.println("SQL异常!");}
%>
<%session.setAttribute("userinfo", username); %>
<body>
</form>
</body>
</html>
3. 我在做一个网页,需要注册和登陆的代码
注册和登录不仅是个代码 交互式网页 基于的不是html语言 要使用ASP PHP那类动态交互语内言结合数据库来实现容注册和登
另外如果不是注册本站 那可以实现from表单提交 查看对方源代码即可
最新的HTML5 也是基于上面原理
4. 注册/登陆页面HTML代码该怎么写
以下为个人原创教学例子,任何人引用需注明出自网络知道用户am7972,楼主可供参考
该例子涵盖了文本框、密码框、下拉菜单、单选框、复选框及文本区的使用
同时在数据的使用方面涵盖了文本型、数值型、日期型、布尔型的使用
也涵盖了在会员信息入数据库前,进行严格的数据检查
不足处,JS验证还不是太完善,不过有服务端认证足够了
<title>会员注册</title>
<script type="text/javascript">
<!--function CheckForm()
{
if(document.userinfo.username.value == "")
{ alert("请输入姓名,姓名不能为空!");
document.userinfo.username.focus();
return false;
}
if(document.userinfo.username.value.length > 10)
{
alert("输入的姓名长度最多为10个字符!");
document.userinfo.username.focus();
return false;
}
}
//--></script>
</head>
<body>
<table border="1" width="53%" bordercolorlight="#000000" cellspacing="0" id="table1" height="358" bordercolor="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<form method="POST" action="bb.asp" name="userinfo" onsubmit="return CheckForm();">
<tr><td colspan="2" height="37"> <p align="center">会员注员</td> </tr>
<tr> <td width="37%" align="right">姓名:</td> <td width="61%"> <input type="text" name="username" value="libin" size="13"> </td> </tr>
<tr> <td width="37%" align="right">密码:</td> <td width="61%"> <input type="password" name="userPassword" size="20" value="123"></td> </tr>
<tr> <td width="37%" align="right">性别:</td> <td width="61%"><input type="radio" value="True" checked name="Sex">男 <input type="radio" name="Sex" value="False">女</td> </tr>
<tr> <td width="37%" align="right">生日:</td> <td width="61%"> <input type="text" name="userSR" size="11" value="1985-03-12"></td> </tr>
<tr> <td width="37%" align="right">年龄:</td> <td width="61%"><input type="text" name="userNL" size="9" value="13"></td> </tr>
<tr> <td width="37%" align="right">爱好:</td> <td width="61%"> <input type="checkbox" name="ah" value="sw">上网 <input type="checkbox" name="ah" value="ds" checked>读书 <input type="checkbox" name="ah" value="ty">体育</td> </tr>
<tr> <td width="37%" align="right">上网方式:</td> <td width="61%">
<select size="1" name="swfs"> <option selected value="bhsw">拨号上网</option> <option value="wxsw">无线上网</option> <option value="gxsw">光纤上网</option> </select>
</td> </tr>
<tr> <td width="37%" align="right">个人简介:</td> <td width="61%"><textarea rows="9" name="userGrjs" cols="34"></textarea></td> </tr> <tr> <td colspan="2" height="38"> <p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
</table>
====bb.asp的会员注册非法数据监测====
<%
username = Request("username")
userPassword = Request("userPassword")
Sex = Request("Sex")
userSR = Request("userSR")
userNL = Request("userNL")
ah = Request("ah")
swfs = Request("swfs")
userGrjs = Request("userGrjs")
'判断数据合法性,绝对不能让非法数据进入系统
'判断姓名username合不合法,是否包含非法数据
username = Trim(username) '例如:" 张 三 "经过处理之后变成"张 三"
If username ="" Then
Response.write "姓名不能为空"
Response.End
End If
If Len(username)>10 Then
Response.write "姓名字数不能超过10个字" 'Len("Z")=1 Len("国")=2
Response.End
End If
For i = 1 To Len(username)
q = Mid(username,i,1)
If InStr("!@#$%^&*()_-+|<>?/"",.",q)>0 Then
Response.write "姓名不能包含特殊符号!@#$%^&*()_-+|<>?/"",."
Response.End
End If
Next
'判断密码合不合法,是否包含非法数据userPassword = Trim(userPassword)If userPassword ="" Then Response.write "密码不能为空" Response.EndEnd If
If Len(userPassword)>20 Then
Response.write "密码字数不能超过20个字"
Response.End
End If
'判断密码合不合法,是否包含非法数据
Sex = Trim(Sex)
If Sex = "" Then
Response.write "性别不能为空"
Response.End
End If
If Sex <> "True" And Sex <> "False" Then
Response.write "性别不能为不男不女"
Response.End
End If
'判断生日合不合法,是否包含非法数据
userSR = Trim(userSR)
If userSR ="" Then
Response.write "生日不能为空"
Response.End
End If
If Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23
Response.write "你输入的生日字数不对,应为2012-6-3或2012-11-23格式"
Response.End
End If
If IsDate(userSR)=False Then
Response.write "你输入的生日格式不能转化为日期,请核实"
Response.End
End If
If DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Then
Response.write "根据你输入的生日你可能小于1岁或已经超过200岁了,请核查重新输入"
Response.End
End If
'判断年龄合不合法,是否包含非法数据userNL = Trim(userNL)If userNL ="" Then
Response.write "年龄不能为空"
Response.End
End If
If IsNumeric(userNL)=False Then
Response.write "你输入的年龄不能转化为数值,请核查"
Response.End
End If
userNL = CInt(userNL)
If userNL<0 Or userNL>200 Then
Response.write "你输入的年龄不能小于0岁或者大于200岁,请核查"
Response.End
End If
'判断爱好合不合法,是否包含非法数据ah = Trim(ah) '选择多个爱好则系统会用,分开 //测试
ah = Replace(ah," ","")
arrAh = Split(ah,",")
For i = LBound(arrAh) To UBound(arrAh)
If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then
Response.write i & "你选择的爱好有问题,请核查" & arrAh(i)
Response.End
End If
Next
'判断上网方式合不合法,是否包含非法数据swfs = Trim(swfs)If swfs = "" Then
Response.write "上网方式不能为空"
Response.End
End If
If swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Then
Response.write "你选择的上网方式有问题,请核查"
Response.End
End If
'判断个人简介是否为空,是否超出1000个字
userGrjs = Trim(userGrjs)
If userGrjs = "" Then
Response.write "个人简介不能为空"
Response.End
End If
If Len(userGrjs) > 1000 Then
Response.write "个人简介不能超过1000个字"
Response.End
End If
Response.write "数据合法性检测通过"
%>
====登陆的HTML代码可相信楼主参照会员注册代码应该没问题了====
5. 网页注册代码
对号你可以设个小的图片,当然文字符号也行,在焦点离开文本框时,触发一个函数,对用户名进行验证,如果验证成功,就显示这个图片。如果只是判断是否为英文,用JavaScript就可以实现吧
6. 网页代码注册登录怎么写
楼上忒黑,人家不容易嘛
<?php
if(isset($_POST['username']) || isset($_POST['password'])) {
$conn = //.....数据库连接
$sql = sprintf('select id from members where username = "%s" and password = "%s"', $_POST['username'], $_POST['password']);
if(mysql_query($sql)) {
setcookie(//..); //可以设置cookie来记录
$_SESSION['user_id'] = //...也可以设置session来记录
}
}
?>
<form method="post">
用户名:<input type="text" name="username" />
密码: <input type="password" name="password" />
<input type="submit" value="登录" />
</form>
Tips:这里程序没有加安全过滤和加密,不过登录的主要步骤基本上就这些了
7. 求网页制作 注册\登录代码!!
是要用什么样的方式、jsp/asp/php等