Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PHP script question

  1. #1
    Agony Aunty-Online Moira's Avatar
    Join Date
    Jun 2003
    Posts
    1,063

    PHP script question

    I'm trying to include a "ban" script to put on the index page of my website so that a range of IP addresses can't view it. (The sitemeter stats give IP addresses of visitors minus the last octet.) Can anyone tell me whether this is right:

    Code:
    <? if(strstr($_SERVER['REMOTE_ADDR'] ,"82.30.155.")) { die("<font size=+2><b><center>[message]</font></b></center>"); }?>
    to stop, say IP address 82.30.155.70 viewing the page, or whether I need to do something different to place a wildcard for the last octet? I know the basic script is right because I've used it successfully in the past.
    77 111 105 114 97

    My PGP signature

  2. #2
    Senior Member WolfeTone's Avatar
    Join Date
    Jun 2007
    Location
    Ireland
    Posts
    197
    No that's fine.

  3. #3
    Agony Aunty-Online Moira's Avatar
    Join Date
    Jun 2003
    Posts
    1,063
    Oh, that's brilliant - many thanks for the prompt response. Have some positive reputation
    77 111 105 114 97

    My PGP signature

  4. #4
    Senior Member WolfeTone's Avatar
    Join Date
    Jun 2007
    Location
    Ireland
    Posts
    197
    Thank you!

  5. #5
    Agony Aunty-Online Moira's Avatar
    Join Date
    Jun 2003
    Posts
    1,063
    Wups! Turns out I banned the wrong IP group - a guestbook message implied that a friend could no longer access the site, so I've taken that PHP script out. Still, a useful exercise to see what worked (but it's back to the drawing board)

    Yes, confirmation that the script and the way of globally banning every IP with the first three octets, using that method as a wildcard for the last set really does work. I'm just sorry that a good friend had to be the unwitting tester ....

    *hides under the table with embarrassment*
    Last edited by Moira; July 13th, 2007 at 06:30 PM.
    77 111 105 114 97

    My PGP signature

  6. #6
    Member striker0204's Avatar
    Join Date
    Apr 2007
    Posts
    42
    moira, how long have you been coding php?

    any good refference sites for learning?

  7. #7
    Senior Member WolfeTone's Avatar
    Join Date
    Jun 2007
    Location
    Ireland
    Posts
    197
    http://www.php.net (What more can I say)

    Moira, why not use banning based on usernames?

  8. #8
    Senior Member Aardpsymon's Avatar
    Join Date
    Feb 2007
    Location
    St Annes (aaaa!)
    Posts
    434
    I would say its a problem like wikipedia has with our IP range. Wikipedia have locked out our IP address for editing and account creation. Guestbook type app wouldn't have usernames as such.
    If the world doesn't stop annoying me I will name my kids ";DROP DATABASE;" and get revenge.

  9. #9
    Senior Member WolfeTone's Avatar
    Join Date
    Jun 2007
    Location
    Ireland
    Posts
    197
    To me, it looks like the guestbook was used to send a message saying I'm locked out from the rest of the site.

    So if they can access the guestbook but not the page in question, then maybe create a database of usernames and block activity that way.

  10. #10
    Agony Aunty-Online Moira's Avatar
    Join Date
    Jun 2003
    Posts
    1,063
    Yes, the unfortunate friend locked out of the site let me know via the guestbook. I'm not sure banning usernames would work, as the intention was to stop people at work browsing it - not that there's anything dreadful there, and certainly no mention of work, but I just didn't really want people ogling it. They wouldn't have usernames as such.

    As for coding PHP, I don't really - I just use it on a "need to know" basis and learn what I have to, to run the scripts I want. What I really need is someone from work to leave a guestbook message, then blocking work's IP (which will be static) would be child's play.
    77 111 105 114 97

    My PGP signature

Similar Threads

  1. PHP news publisher script
    By bupati in forum Web Development
    Replies: 1
    Last Post: February 16th, 2007, 09:44 AM
  2. Web Buggery: Analyzing Tracking Images
    By Irongeek in forum The Security Tutorials Forum
    Replies: 8
    Last Post: April 27th, 2005, 04:44 PM
  3. PHP Flaws
    By SDK in forum Web Security
    Replies: 19
    Last Post: December 20th, 2004, 05:31 PM
  4. PHP Question...
    By Sevari in forum Web Development
    Replies: 3
    Last Post: February 25th, 2003, 01:02 AM
  5. Installing Apache (1.3.22) and PHP (4.1.1)
    By Rewandythal in forum Other Tutorials Forum
    Replies: 6
    Last Post: July 13th, 2002, 02:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •