Thanks for your help, you hit the nail on the head + now I know about the in_array function.
Below is the code that I used, just in case other people run into the same problem:
Case-insensitive version of in_array
function is_in_array($str, $array) {
return preg_grep('/' . preg_quote($str, '/') . '$/i', $array);
}
function check_user($file_ext){
Open the file for reading
$lines = file("users/userlist.txt");
# Remove the line breaks
foreach ($lines as $key=>$value) { $lines[$key]=trim($value); }
# Test to see if the userid is in the lines array
if (is_in_array($_SESSION["userid"], $lines)){
echo "allowed";
}
else{
echo "Not allowed";
}
}
Regards,
Nick