[PHP]blocking ip address from viewing site

Started by deadly7, August 05, 2005, 09:33:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zorm

I'll blame you for not knowing better yet selling your PHP services! :p
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Sidoh

I just remembered that it was there and copied/pasted from it.  =P

It's better than getenv("REMOTE_ADDR").

I did know that, by the way.  :-\

"selling my services?"  Show me the price, please.

rabbit


Sidoh

I don't think anyone was asking anything near the subject of a specific price on PHP development.  Plus, zorm's statement wasn't even directed towards you.

rabbit

Eh..he said "show me the price".  Close enough.

JTN Designer

Quote from: deadly7 on August 05, 2005, 09:33:18 PM
<?phpinclude "nav.html";print "<font color=\"white\">". $_SERVER['REMOTE_ADDR'] ."</font>";if $_SERVER['REMOTE_ADDR'] = 127.0.0.1 Then {echo "<meta http-equiv=\"refresh\" content=\"5; url=http://www.mysite.com/dir/noview.php\" />" }?>


Why doesn't it work?

Edit: Returns this message
Parse error: parse error, unexpected T_VARIABLE, expecting '(' in /home/deadly7/public_html/ on line 15
Quoteif $_SERVER['REMOTE_ADDR'] = 127.0.0.1 Then {
That is line 15.

Although this has been resolved; Mark since you're using a Boolean, try to put the include statement on the return true section of the script, I.E.

<?phpif($_SERVER['REMOTE_ADDR'] == "127.0.0.1")      { ?>     <meta http-equiv="refresh" content="5; url=noview.php">     <?php     } else {                include "nav.html";                }?>


Sidoh

It's easier to just include some file that checks for banned IP's and then uses exit; if it finds one.

JTN Designer

Yeah, using the .htaccess or on a dedicated linux build, use SSH to modify the access.conf file using DenyAll


Sidoh

Quote from: subject[PHP]blocking ip address from viewing site

Which is why I didn't include information in .htaccess.  :)

JTN Designer



Sidoh