This topic is locked
[SOLVED]

Blocking IPs

9/1/2021 1:02:32 PM
PHPRunner General questions
D
DRCR Dev author

Hi

I have a table called _IP_blocked and a column named IP which holds all banned IPs.

I'm trying to use this code in the APP INIT, but doesn't seem to work (I've used my IP address to test).

Is there anything special I need to do in the formating to make it work. I considered if any of the other lines could be causing the issue and moved them around and had the same result.
` ![img alt](https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=28611&image=1&table=forumtopics)
$res = DB::Select("_IP_blocked", "IP");
$array = mysqli_fetch_row($res);
if (in_array($_SERVER['REMOTE_ADDR'], $array)) exit();



-c
D
DRCR Dev author 9/1/2021

img alt

admin 9/1/2021

I'm sorry, I don't know anything about

Please study examples from DB::Select() article in the manual.

The second parameter must be WHERE clause and not a field name like "IP".

Also not clear why you decided to add mysqli_fetch_row() function as it is not in the manual.

D
DRCR Dev author 9/1/2021

And the penny dropped. Thank you. I was looking at this all wrong.