Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //code tạo mã xác nhận bằng md5
- include("config.php");
- if(isset($_POST["submit"])){
- $ho = addslashes($_POST["ho"]);
- $ten = addslashes($_POST["ten"]);
- $email = addslashes($_POST["email"]);
- $username = addslashes($_POST["username"]);
- $password = md5($_POST["password"]);
- $confirmpassword = md5($_POST["confirmpassword"]);
- $day = addslashes($_POST["day"]);
- $phone = addslashes($_POST["phone"]);
- $cmnd = addslashes($_POST["cmnd"]);
- $_POST["capcha"];
- if($ho == "" || $ten == "" || $email == "" || $username == "" || $_POST["password"] == "" || $_POST["confirmpassword"] == "" || $day == "" || $phone == "" || $cmnd == ""){
- echo "Bạn chưa điền đầy đủ thông tin";
- }
- if($_POST["password"] != $_POST["confirmpassword"]){
- echo "Hai mật khẩu bạn nhập không giống nhau";
- }
- if(mysql_num_rows(mysql_query("SELECT username FROM members WHERE username = '$username'"))>0){
- echo "Tài khoản này đã có người sử dụng";
- }
- if(mysql_num_rows(mysql_query("SELECT email FROM members WHERE email = '$email'"))>0){
- echo "Email đã có người sử dụng";
- }
- if($_SESSION["security_code"] != $_POST["capcha"]){
- echo "Bạn đã nhập sai mã xác nhận";
- }
- $creat = mysql_query('INSERT INTO members(ho,ten,email,username,password,day,phone,cmnd) VALUES($ho, $ten, $email, $username, $password, $day, $phone, $cmnd)');
- if($creat){
- echo "Đăng ký thành công";
- }else{
- echo "Đăng ký thất bại";
- }
- }
- $md5_hash = md5(rand(0,999));
- $security_code = substr($md5_hash, 15, 7);
- $_SESSION["security_code"] = $security_code;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement