Skip to content

Commit

Permalink
HUGE BUG FIX!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
ImmanuelNL authored Feb 19, 2019
1 parent b418184 commit 9e3ad1f
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions idea.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
<?php
function allowedEmailAdresses($file="emails.txt", $check) {
$myfile = fopen($file, "r") or die("Unable to open file!");
$handle = fopen($file, "r") or die("Unable to open file!");
// Output one line until end-of-file
$ok = false;
$i = 0;
while(!feof($myfile)) {
// echo fgets($myfile) . "<br>";
$user = fgets($myfile);
if ($user == $check) {
$ok = true;
}
$i++;
$pattern = '/\s*/m';
$replace = '';
if ($handle) {
while (($line = fgets($handle)) !== false) {
// process the line read.
$line = preg_replace( $pattern, $replace, $line); // remove any spaces
if ($line == $check) {
$ok = true;
}
}
fclose($myfile);
if ($ok) {
fclose($handle);
} else {
// error opening the file.
echo "<pre>E 100</pre>";
return false;
}
if ($ok == true) {
return true;
} else {
return false;
Expand Down Expand Up @@ -43,4 +50,4 @@ function getIP() {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
}

0 comments on commit 9e3ad1f

Please sign in to comment.