I'm trying to create a "banned" list, and if their IP appears in the list, they won't be allowed.
I'm basically setting up futallaby because I fail at setting up serissa and Wakaba on a free server.^^;
That's the function that appears in the imgboard.php file What do I need to change it to get it to read from a .txt or database file or whatever. Please go into detail about the database, as I'd like that a little better, but the .txt file is also good.
$handle = fopen('filename.txt','r'); $thisisthelist = fread($handle,9000); fclose($handle); $badip = explode($thisisthelist,"\n");
I would like to expand on this.
Could probably go as
$handle = fopen('filename.txt','r'); $thisisthelist = fread($handle, filesize('filename.txt')); fclose($handle); $badip = explode($thisisthelist,"\n"); $banned = false; while (list ($key, $val) = each ($badip)) { if($val == $_SERVER['REMOTE_ADDR']) { $banned = true; } } if($banned) { #do bad stuff }
This actualy cycles trough the list, checks to see if the ip is there.