var r=confirm("点击注册")
if (r==true)
{
document.write("注册成功")
}
else
{
document.write("注册失败")
}
</script>
确切的说,登陆注册代码,是由2部分组成首先,是html元素,具体表单元素(注册也好,登陆也好,都需要输入框和按钮提供给用户输入他的信息和提交他的信息)
第二部分:需要服务器端动态语言去处理表单发送来的信息,而这个,由于html是客户端语言,已经html不具备动态解析功能,所以,html是不可能做得到的。这部分就需要诸如但不限于:asp php asp.net jsp等来进行服务器端处理
$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条)