I'm new to PHP so I wanted to know how do I make a script which you have to put a GET parameter (index.php?test=value) and it checks is value is in a txt file provided. If the value exists then print yes if no then print no, if there isn't a GET parameter print like ''empty''. Please help me how to do this.
$_GET['test'] = 'value';
if(empty($_GET['test'])) {
echo 'empty';
} else {
$file ='asdfasdfasvalue';
if(strpos($file, $_GET['test'])) {
echo 'yes';
} else {
echo 'no';
}
}
You should populate $file
with the file's contents.
Functions being used...
http://php.net/manual/en/function.empty.php
http://php.net/strpos
http://php.net/manual/en/function.file-get-contents.php