注冊網頁代碼
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等