<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 {
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)