/*第一种方式*/
$sql="select value from dede_sysconfig where varname=‘cfg_notallowstr‘";
$mingan=$link->query($sql);
$arr = $mingan->fetch_row();
//数组元素组合成字符串
$list="/".implode("|",$arr)."/i";
if(preg_match($list,$username,$matches)){
echo "<script>alert(‘包含敏感词,不能注册‘);</script>";
} else {
$sql= "insert into dede_member2 (userid,uname,email,pwd,mobile,jointime) values(‘$username‘,‘$username‘,‘$email‘,‘$hashpwd‘,‘$mobile‘,‘$jointime‘)";
// echo "出错" . $sql . "<br>" . $conn->error;
//插入数据库
if(!mysqli_query($link,$sql)){
// echo strlen($hashpwd);
// echo "出错" . $sql . "<br>" . $conn->error;
echo "<script>alert(‘数据插入失败‘);window.location.href=‘/a/zhuce/index.html‘</script>";
}
else{
echo "<script>alert(‘注册成功!‘);window.location.href=‘/index.php‘</script>";
}
}