Author Topic: [PHP]blocking ip address from viewing site  (Read 17975 times)

0 Members and 1 Guest are viewing this topic.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: [PHP]blocking ip address from viewing site
« Reply #30 on: August 23, 2005, 10:52:17 pm »
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

Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [PHP]blocking ip address from viewing site
« Reply #31 on: August 24, 2005, 12:29:03 am »
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.

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: [PHP]blocking ip address from viewing site
« Reply #32 on: August 24, 2005, 01:31:05 am »

Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [PHP]blocking ip address from viewing site
« Reply #33 on: August 24, 2005, 05:24:56 pm »
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.

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: [PHP]blocking ip address from viewing site
« Reply #34 on: August 24, 2005, 09:20:48 pm »
Eh..he said "show me the price".  Close enough.

Offline JTN Designer

  • PHP Related Expert
  • Newbie
  • *
  • Posts: 53
    • View Profile
    • http://www.advahost.com
Re: [PHP]blocking ip address from viewing site
« Reply #35 on: September 26, 2005, 07:17:30 pm »
<?php
include "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
Quote
if $_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.

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


Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [PHP]blocking ip address from viewing site
« Reply #36 on: September 26, 2005, 08:06:52 pm »
It's easier to just include some file that checks for banned IP's and then uses exit; if it finds one.

Offline JTN Designer

  • PHP Related Expert
  • Newbie
  • *
  • Posts: 53
    • View Profile
    • http://www.advahost.com
Re: [PHP]blocking ip address from viewing site
« Reply #37 on: September 27, 2005, 05:07:24 pm »
Yeah, using the .htaccess or on a dedicated linux build, use SSH to modify the access.conf file using DenyAll


Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [PHP]blocking ip address from viewing site
« Reply #38 on: September 27, 2005, 05:27:36 pm »
Quote from: subject
[PHP]blocking ip address from viewing site

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

Offline JTN Designer

  • PHP Related Expert
  • Newbie
  • *
  • Posts: 53
    • View Profile
    • http://www.advahost.com
Re: [PHP]blocking ip address from viewing site
« Reply #39 on: September 27, 2005, 08:46:02 pm »
Jeesh your hard to counterpoint :P


Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [PHP]blocking ip address from viewing site
« Reply #40 on: September 27, 2005, 08:57:25 pm »
Hehe.