效果圖如下: (紅色的為即時檢測)
注意: 我編寫php 使用的是xampp 和hbuilder
在html 和php 直接傳參失敗 ,只能將html **寫到php當中才能在php當中傳參成功
public "-//w3c//dtd xhtml 1.0 transitional//en" "">index.php<?php
?>
1index_user.php<?php
2include_once('conn.php');34
$name=$_post['username'];
5$password=$_post['password'];67
echo
$name;8
echo
$password;9
10if($name==''||$password=='')else
' and password=''";
14$result=mysqli_query($conn, $sql
);15
$num=mysqli_num_rows($result
);16
if($num==0)else21}
2223 ?>
1register.phppublic "-//w3c//dtd xhtml 1.0 transitional//en" "">
2330
3166
6768
1register_user.php<?php
2include_once('conn.php');34
$name=$_post['username'];
5$password=$_post['password'];
6$phone=$_post['phone'];
7$address=$_post['address'];
8$email=$_post['email'];910
11if($name==""||$password==""||$phone==""||$email=="")else
','','','','')";
1617
$result=mysqli_query($conn, $sql
);18
19if ($result
) else24}
25 ?>
1register_user_test.php<?php
2$servername = "localhost";
3$username = "root";
4$password = "101032";
5$dbname = "db_database02";67
//建立連線
8$conn = new mysqli($servername, $username, $password, $dbname);9
10if ($conn->connect_error)
13$name=$_post['username'];
1415
$sql = "select * from user where username=''";
1617
$result=mysqli_query($conn, $sql
);18
$num=mysqli_num_rows($result
);19
if($num==0)else
24$conn->close();
25 ?>
1conn.php<?php
2$conn=mysqli_connect("localhost","root","101032","db_database02") or die("資料庫連線失敗");34
mysqli_query($conn,'set names utf8'); //
告訴伺服器,本頁面的字符集是utf8
56 ?>
郵箱驗證 郵箱驗證看它!
celery基礎請移步 先說一下 主要功能 django實現web郵箱驗證頁面,填寫郵箱等資訊,利用ajax把郵箱post給後端,後端將郵箱位址傳遞給celery任務佇列,執行任務 生成驗證碼存在redis中,再把驗證碼傳送給從前端獲取到的郵箱,前端獲取到的驗證碼再和redis中的對比,通過則驗證成...
身份證驗證
1 簡單的正規表示式 1 preg match d d dx id card 2 preg match d 18 19 20 d 01 d 0123 d d d x id card 3 preg match d d d x x id card 2 複雜並且嚴格一些的驗證 這個可以驗證15位和18位的...
身份證驗證
身份證分為兩類 1 全是數字 15位或者18位。2 大寫x 18位,最後一位字母x,其餘必需是數字。正則 d d d d x 身份驗證例項 header content type text html charset utf 8 idc post idc bm substr idc,0,6 gende...