Skip to content

Instantly share code, notes, and snippets.

@shellus
Created August 28, 2017 03:39
Show Gist options
  • Select an option

  • Save shellus/185f87d729328f6ac8fdc2986b8643b0 to your computer and use it in GitHub Desktop.

Select an option

Save shellus/185f87d729328f6ac8fdc2986b8643b0 to your computer and use it in GitHub Desktop.

Revisions

  1. 娃娃脾气 created this gist Aug 28, 2017.
    30 changes: 30 additions & 0 deletions check.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    <?php
    /**
    * Created by PhpStorm.
    * User: shellus
    * Date: 2017/8/28
    * Time: 11:30
    */
    $fd = fopen("pass.txt", "r");
    // 如果php运行在linux,那么pass.txt里面的换行符用\n
    // 如果php运行在windows,那就用\r\n
    // 如果要固定用\n,那就把代码中的PHP_EOL换成"\n"

    function check($pass){
    if (trim($pass) === "") return false;

    global $fd;
    while (($line = stream_get_line($fd, 1024, PHP_EOL)) !== false){
    if ($line === $pass){
    return true;
    }
    }
    return false;
    }


    if (check(@$_GET['pass'])){
    echo "1";
    }else{
    echo "0";
    }