Skip to content

Instantly share code, notes, and snippets.

@shellus
Created August 28, 2017 03:39
Show Gist options
  • Save shellus/185f87d729328f6ac8fdc2986b8643b0 to your computer and use it in GitHub Desktop.
Save shellus/185f87d729328f6ac8fdc2986b8643b0 to your computer and use it in GitHub Desktop.
<?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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment