我从昨天起就试图解决这个问题,PHP黑名单

时间:2015-02-16 05:23:19

标签: php security

我一直在尝试在表单提交上制作一个黑名单,我怎样才能使它工作..,以便它会检查爆炸时的每个数组..

if(isset($_POST["username"])and isset($_POST["password"])) {
    $username = $_POST["username"];
    $password = $_POST["password"];
    $black = file_get_contents("blacklist.txt");
    $array = explode(" ",$black);
    if(empty($username)or empty($password)) {
        echo '<h1> Must enter fields </h1>';
    } else if(strpos($username,$array[0])!==false or strpos($password,$array[1])!==false) { 
        echo 'Must not contain:'. $array[$count];
    } else if($username == "dersus" and $password == "123456") {
        echo 'You have been logged in';
    }
}    

0 个答案:

没有答案