invalid ip blocker script not work on my page!

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

1 reply · 322 views · started 14 years ago · 1 min read

2 participants
jayarukshanth Newbie · 2 posts #1

I am trying to put my invalip ip blocker script in my php page. But it,s not working! Plz help me to do it for best. I put these code on my page of site!

<?php $ip=$_SERVER['REMOTE_ADDR']; function validateIP($ip) { $regexp = "([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})"; $validate = ereg($regexp, $ip); if ($validate == true) { return true; } else { return false; }; ?>

plz help me to solve this problem. Thank you!

arnage Lead · 811 posts #2

Deprecated ereg. Just read posted threads, its solved many, many times.

function validateIP($ip) {
if (preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/D', $ip)) {
return true;
} else {
return false;
}
}
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close