亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP ??? ?? ??? ??? ?? ?? ???

?? ?? ???

??? ??? ??? ????.

第二版注冊.png

?? ??? ??? ????.

<?php  
session_start();
//注冊處理界面 regcheck.php
    if(isset($_POST["hidden"]) && $_POST["hidden"] == "hidden")  
    {  
        $user = trim($_POST["username"]);//trim()函數(shù)移除字符串兩側(cè)的空白字符
        $psw = md5(trim($_POST["userpwd"]));  
        $psw_confirm = md5(trim($_POST["confirm"])); 
        $code = $_POST["code"];
        if($user == "" || $psw == "" || $psw_confirm == "")  
        {  
            echo "<script>alert('請確認信息完整性!'); history.go(-1);</script>";  
        }
        else if($code != $_SESSION[' ver_code']){
            echo "<script>alert('驗證碼不正確,請重新輸入!'); history.go(-1);</script>";
        }  
        else   
        {  
            if($psw == $psw_confirm)  
            {  
                $conn = mysqli_connect("localhost","root","root");   //連接數(shù)據(jù)庫,帳號密碼為自己數(shù)據(jù)庫的帳號密碼  
                if(mysqli_errno($conn)){
                    echo mysqli_error($conn);
                    exit;
                }
                mysqli_select_db($conn,"userdb");  //選擇數(shù)據(jù)庫  
                mysqli_set_charset($conn,'utf8'); //設(shè)定字符集  
                $sql = "select username from user where username = '$user'"; //SQL語句
                $result = mysqli_query($conn,$sql);    //執(zhí)行SQL語句  
                $num = mysqli_num_rows($result); //統(tǒng)計執(zhí)行結(jié)果影響的行數(shù)  
                
                if($num)    //如果已經(jīng)存在該用戶  
                {  
                    echo "<script>alert('用戶名已存在'); history.go(-1);</script>";  
                }  
                else    //不存在當(dāng)前注冊用戶名稱  
                {   
                    $ip=ip2long($_SERVER['REMOTE_ADDR']); // 把ip地址轉(zhuǎn)換成整型
                    $time=time();
                    $sql_insert = "insert into `user` (`username`,`userpwd`,`createtime`,`createip`) values('" . $user . "','" . $psw ."','".$time."','".$ip."')"; 
                    $res_insert = mysqli_query($conn,$sql_insert);  
                    if($res_insert)  
                    {  
                        echo "<script>alert('注冊成功!');window.location.href='login.php';</script>";  
                    }  
                    else  
                    {  
                        echo "<script>alert('系統(tǒng)繁忙,請稍候!'); history.go(-1);</script>";  
                    }  
                }  
            }  
            else  
            {  
                echo "<script>alert('密碼不一致!'); history.go(-1);</script>";  
            }  
        }  
    }  
    else  
    {  
        echo "<script>alert('提交未成功!');</script>";  
    }  
?>

?? ??:

  • ?? ??? ?? ? ?? ?? ???

  • ? ??? post ???? ??? $_POST["hidden"]? ????? ?????. ???? ??? ????? ???? ?????. ???? ?? ?????? ???? ?? ?????.

  • ??? ?? ????(trim() ??? ???? ?? ??? ?????, md5() ??? ???? ????? ????) ?? ??? ?????. ?? ??? ????? ?????. ?? ?? ??? ????

  • post ???? ?? ??? ?? ?? ?? ??? ??? ???? ?? ?? ?? ???? ??? ?????. ???? ????? ?????? ???? ???? ???? ?? ?????.

  • ??? ????? ??? ????? ???? ??? ?????. ????? ???? ???? ???? ?????.

  • ??????? ????, ??? ??????? ????, ?? ??? ????, ??? ???? ??????? ????, ??? ??? ??? ??? ????? ???? ???? ?? ???? ???? ??? ??? ?????? ?? ?? ???? ???? ?????(??????? ??? ???? ?? ??? ??? ??? IP ??? ?????)

  • ?? ?? ?? ?? ???? ?? ?? ??? ??? ?? ?? ???? ???? ?? ???? ??? ????? ???? ???? ??? ???? ?????


???? ??
||
<?php session_start(); //注冊處理界面 regcheck.php if(isset($_POST["hidden"]) && $_POST["hidden"] == "hidden") { $user = trim($_POST["username"]);//trim()函數(shù)移除字符串兩側(cè)的空白字符 $psw = md5(trim($_POST["userpwd"])); $psw_confirm = md5(trim($_POST["confirm"])); $code = $_POST["code"]; if($user == "" || $psw == "" || $psw_confirm == "") { echo "<script>alert('請確認信息完整性!'); history.go(-1);</script>"; } else if($code != $_SESSION[' ver_code']){ echo "<script>alert('驗證碼不正確,請重新輸入!'); history.go(-1);</script>"; } else { if($psw == $psw_confirm) { $conn = mysqli_connect("localhost","root","root"); //連接數(shù)據(jù)庫,帳號密碼為自己數(shù)據(jù)庫的帳號密碼 if(mysqli_errno($conn)){ echo mysqli_error($conn); exit; } mysqli_select_db($conn,"userdb"); //選擇數(shù)據(jù)庫 mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 $sql = "select username from user where username = '$user'"; //SQL語句 $result = mysqli_query($conn,$sql); //執(zhí)行SQL語句 $num = mysqli_num_rows($result); //統(tǒng)計執(zhí)行結(jié)果影響的行數(shù) if($num) //如果已經(jīng)存在該用戶 { echo "<script>alert('用戶名已存在'); history.go(-1);</script>"; } else //不存在當(dāng)前注冊用戶名稱 { $ip=ip2long($_SERVER['REMOTE_ADDR']); // 把ip地址轉(zhuǎn)換成整型 $time=time(); $sql_insert = "insert into `user` (`username`,`userpwd`,`createtime`,`createip`) values('" . $user . "','" . $psw ."','".$time."','".$ip."')"; $res_insert = mysqli_query($conn,$sql_insert); if($res_insert) { echo "<script>alert('注冊成功!');window.location.href='login.php';</script>"; } else { echo "<script>alert('系統(tǒng)繁忙,請稍候!'); history.go(-1);</script>"; } } } else { echo "<script>alert('密碼不一致!'); history.go(-1);</script>"; } } } else { echo "<script>alert('提交未成功!');</script>"; } ?>