Welcome to apple.newbox.org Wednesday, June 07 2023 @ 11:56 AM EDT  
Links |  Past Polls |  Advanced Search |   
Topics
Home
Applications (8/0)
Classic (0/0)
Hardware (12/0)
Miscellaneous (6/0)
Networking/Serving (3/0)
Mac OS X (13/0)
Terminal/CLI (3/0)
iPhone (3/0)
General News (3/0)
GeekLog (1/0)

User Functions
Username:

Password:

Don't have an account yet? Sign up as a New User

What's New
STORIES
No new stories

LINKS last 2 wks
No recent new links


Older Stories
Saturday 06-Mar
  • iPad thoughts (0)

  • Friday 19-Feb
  • A Couple Small Time Machine Notes (0)

  • Saturday 26-Sep
  • Details about iPhone backups and restore (0)

  • Monday 29-Jun
  • Camera updates in iPhone OS 3.0 (0)

  • Saturday 30-May
  • Mac mini disassembly notes (0)

  • Friday 15-May
  • Notes about Windows 7 on a 10.4 Mac with Virtual Box (0)

  • Monday 02-Mar
  • Safari 4 (Beta) notes (0)

  • Saturday 17-Jan
  • Random software notes (0)

  • Wednesday 17-Dec
  • Quicksilver vs. Spotlight (0)
  • 10.5's Dock still sucks (0)


  • Fight Geeklog comment spam    
    Monday, October 10 2005 @ 04:10 PM EDT
    Contributed by: Admin

    GeekLogI've got an ugly-but-it-works approach to fighting spam.

    Update: this works. Perfectly. I haven't had a single piece of comment spam since implementing it. Of course, if spammers decide to start creating comment spam with less than three URLs, I'm hosed, but until then, I'm fine. Almost by definition, they won't. Having three links instead of twenty seems to be not worth it.

    I tried 'bad_behavior' but it didn't do much for me. So, I put together this ugly hack to make the page die if someone submits a comment with more than three HREFs. Obviously this isn't for everyone, and it may not work with your particular installation of Geeklog or PHP, but it works for me.

    I finally had a few minutes to figure this hack out and post this entry and let a couple people know about it. I didn't have time to make it as nice as the 'speed limit' feature and I probably won't take it any further. I got the idea from TUAW.com, who doesn't allow more than three links in a comment. A number-of-links threshold could be implemented as easily and neatly as the 'speed limit' is currently, but that's beyond my capacity right now. If anyone wants something like this in the stock release, talk to the (awesome) GL team!

    To enable: just add this after line 349--$comment = addslashes ($comment)--in 'comment.php'. (Might be different, I'm still a rev or two down, I think.)

    # ugly code added by BMA to kill comment spam
    # simple enough: 4 or more 'href' tags = DON'T ACCEPT
    # ugly but I'm sick of cleaning up gl_comments in phpMyAdmin
    #
    # note that this happens *after* the speed limit test but *before* the 
    # insert so if a user hits 'submit', gets this message, goes back, fixes 
    # his comment, and presses 'submit' again, they will then see your
    # 'speed limit' message if they edit quickly.
    #
    # improvements welcome!
    # send comments, fixes, etc. to brianashe izat gmail dizot com
    #
    # To adjust the threshold, change commentParts[4]
    # from '4' to whatever number you want to trigger a failure.
    #
    # 'strtolower' is used to capture href, HREF, HrEf, etc.
    #
    
    $commentSpamMessage="Sorry! We can't allow comments with more than three 'href'
        tags. This is an effort to reduce comment spam. If you have a legitimate
        need to post more than three links, please create a page somewhere and post
        one link to it here. Sorry to have to do this. Just another way spammers
        are ruining the world in general and the Internet in particular."; 
                       
    if (isset($comment)) {
        $commentParts=explode("href",strtolower($comment));
        if (isset($commentParts[4])) {
            die ($commentSpamMessage);
        }
    }
    

      [ Views: 7256 ]  


    Fight Geeklog comment spam | 0 comments | Create New Account
    The following comments are owned by whomever posted them. This site is not responsible for what they say.
    What's Related

    Story Options
  • Mail Story to a Friend
  • Printable Story Format


  • Created this page in 0.29 seconds


     Copyright © 2023 apple.newbox.org
     All trademarks and copyrights on this page are owned by their respective owners.

    Powered By