This is a use mysql php instance user registration code, is relatively simple, that is, html Submit the data saved to the mysql database tutorial. * / include ('global.php');
if ($ _ post ['sub']) { $ user = $ _post ['username']; $ pwd = md5 ($ _ post ['password1']. $ user); $ email = $ _post ['email']; $ q = $ mysql-> query ("insert into` hl`.`hl_member` (`id`,` username`, `password`,` email`) values (null, '$ user', '$ pwd' '$ email'); "); if ($ q) { setcookie ('login', $ user); $ prompt_msg-> p ('Congratulations, dear member, you have successfully registered!', 'index.php', 'Now go to the home page.', 'Http://www.jzread.com', 'go to the forum Stroll! '); } else { $ prompt_msg-> p ('Sorry, system failed!'); } } ?> <! doctype html public "- // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.jzread.com/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text / html; charset = gb2312" /> <title> </ title> <link rel = "stylesheet" type = "text / css tutorial" href = "css / reg_log.css" />
</ head>
<body> <form id = "myform" name = "myform" method = "post" action = "register.php"> <div id = "top"> Sign Up & nbsp; <a href="login.php"> Sign In </a> </ div> <div id = "content"> <div class = "c1"> Please complete the following required fields to complete registration </ div> <div class = "c2"> <span> All items with a red * are required. If incomplete, you will not be able to register </ span> </ div> <div class = "cinput"> <dl> <dt> username <font color = "red"> * </ font> </ dt> <dd> <input id = "username" name = "username" type = "text" maxlength = "12" /> </ dd> <dd id = "user_prompt" class = "prompt"> Uppercase and Lowercase English letters, numbers, numbers, and underscores Length <3-12 bytes </ dd> </ dl> </ div> <div class = "cinput"> <dl> <dt> Close & nbsp; & nbsp; Code <font color = "red"> * </ font> </ dt> <dd> <input id = "password1" name = "password1" type = "password" maxlength = "16" /> </ dd> <dd id = "pwd1_prompt" class = "prompt"> Minimum length: 6 Maximum length: 16, letters, numbers, and _, case insensitive </ dd> </ dl> </ div> <! - Detect password strength -> <div class = "cinput" style = "padding-bottom: 0px;"> <! - ie6 hack -> <div class = "chkpwd"> <span id = "cp1_prompt" class = "cp1"> </ span> <span id = "cp2_prompt" class = "cp2"> </ span> <span id = "cp3_prompt" class = "cp3"> </ span> </ div> </ div> <div class = "cinput" style = "padding-top: 0px;"> <dl> <dt> Confirm password <font color = "red"> * </ font> </ dt> <dd> <input id = "password2" name = "password2" type = "password" maxlength = "16" /> </ dd> <dd id = "pwd2_prompt" class = "prompt"> Please re-enter the password you filled in </ dd> </ dl> </ div> <div class = "cinput"> <dl> <dt> email <font color = "red"> * </ font> </ dt> <dd> <input id = "email" name = "email" type = "text" /> </ dd> <dd id = "email_prompt" class = "prompt"> Please fill in the real and most commonly used mailbox </ dd> </ dl> </ div> <div style = "clear: both"> </ div> </ div> <div id = "bottom"> <input class = "btn1" type = "submit" name = "sub" value = "Submit Registration" id = "checkall" /> <input class = "btn2" type = "reset" name = "reset" value = "reset" onclick = "return sub (this.form)" /> </ div> </ form> </ body> </ html>
Database structure
create table `hl`.`hl_member` ( `id` int (4) not null auto_increment comment 'Auto-encoding', `username` varchar (100) not null comment 'user name', `password` varchar (200) not null comment 'user password', `answer` varchar (100) not null comment 'secret security' `question` varchar (100) not null comment 'secret security question', `email` varchar (100) not null comment 'email', `realname` varchar (200) not null comment 'login limit', `birthday` date not null comment 'Date of birth', `telephone` varchar (20) not null comment 'phone number', `qq` varchar (15) not null comment 'qq number', `count` int (1) not null comment 'login limit', `active` int (1) not null comment 'Whether or not to activate', primary key (`id`) ) engine = innodb character set gb2312 collate gb2312_chinese_ci;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.