做一个HTML用户注册界面,要求能注册新用户,用户的账号密码保存到SQL2000里,请问如何实现

做一个HTML用户注册界面,要求能注册新用户,用户的账号密码保存到SQL2000里,请问如何实现,第1张

用asp做个简单的例子:先做一个用户注册的htm页面,再做一个接收的asp网页

<html><title>用户注册</title>

<body>

<form name="userReg" action="reg.asp" method="post">

<input name="username">

这里填写需要提交的数据项

<input type="submit" value="提交">

</form>

</body>

</html>

reg.asp

<html><body>

<%

set conn = Server.CreateObject("ADODB.Connection")

conn.Open "Driver={SQL Server}Server=mySqlServerDatabase=GKsoftUID=GKadminPWD="

sqlstr="select * from 注册用户表名"

tmpUname=request("username")

。。。

rs.open conn,sqlstr,1,1

这里可以添加判断是否为新注册

rs.addnew

rs(0)=tmpUname

.......

rs.update

%>

</html>

粗略地写了点,希望对你有帮助吧

$uname = $_POST['username']

$pword = $_POST['password']

$uname = htmlspecialchars($uname)

$pword = htmlspecialchars($pword)

$uLength = strlen($uname)

$pLength = strlen($pword)

if ($uLength >= 10 &&$uLength <= 20) {

$errorMessage = ""

}

else {

$errorMessage = $errorMessage . "Username must be between 10 and 20 characters" . "<BR>"

}

if ($pLength >= 8 &&$pLength <= 16) {

$errorMessage = ""

}

else {

$errorMessage = $errorMessage . "Password must be between 8 and 16 characters" . "<BR>"

}

$user_name = "root"

$pass_word = ""

$database = "login"

$server = "127.0.0.1"

$db_handle = mysql_connect($server, $user_name, $pass_word)

$db_found = mysql_select_db($database, $db_handle)

if ($db_found) {

}

$SQL = "SELECT * FROM login WHERE L1 = $uname"

$result = mysql_query($SQL)

$num_rows = mysql_num_rows($result)

if ($num_rows >0) {

$errorMessage = "Username already taken"

}

else {

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6104553.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-14
下一篇 2023-03-14

发表评论

登录后才能评论

评论列表(0条)

保存