Results 1 to 6 of 6
  1. #1
    Constant Pligger urbn's Avatar
    Joined
    Oct 2010
    Posts
    107

    Comment insert to include IP Address

    I run a site where 90% of comments / stories are by anonymous posts. Recently we have been having people from other sites spamming comments on the boards.

    I have setup story submissions to include the IP address of the user ( by adding $linkres->link_field1 = $_SERVER['REMOTE_ADDR']; to the submit.php page) but I can't seem to find the page or query that handles the comment submissions.

    Can anyone point me in the right direction to which page, class or function I will need to edit to include the IP Address to the comment insert query?

    Also from what I have read registered user submissions are handled different then anonymous submissions, is this correct?

  2. #2
    Constant Pligger urbn's Avatar
    Joined
    Oct 2010
    Posts
    107
    Well I found a simple fix / hack for this.

    I guess since user accounts track the IP address within the user table the only need is to track anonymous posters IP's.

    To track the IP address of anonymous comment posts you can do the following:
    *Note this assumes the anonymous comments module is in use.


    Create a new field in your comments table:
    ipaddress, varchar 17


    Open /modules/anonymous_comments/anonymous_comments_main.php

    FIND:

    $sql = "INSERT INTO " . table_comments . " (comment_user_id, comment_link_id, comment_date, comment_randkey, comment_content,`comment_anonymous_username`, `comment_anonymous_email`, `comment_anonymous_website` ) VALUES ($user_id, $link_id, NOW(), $randkey, '$comment_content', '$a_username','$a_email', '$a_website')";


    REPLACE WITH:

    $a_ipaddress = $_SERVER['REMOTE_ADDR'];

    $sql = "INSERT INTO " . table_comments . " (comment_user_id, comment_link_id, comment_date, comment_randkey, comment_content,`comment_anonymous_username`, `comment_anonymous_email`, `comment_anonymous_website`,ipaddress ) VALUES ($user_id, $link_id, NOW(), $randkey, '$comment_content', '$a_username','$a_email', '$a_website', '$a_ipaddress')";



    What this does:
    All this will do is update the SQL insert string to include adding the ipaddress record with the $a_ipaddress value which is the value the server picks up for the users IP address.


    With this information you can run queries to find all matching IP Addresses and delete all the spam for a specific IP, or find the IP used by a poster to ban by IP.

  3. #3
    New Pligger key_key's Avatar
    Joined
    Nov 2011
    Posts
    2
    very good answer, congratulations

  4. #4
    Constant Pligger foofoo's Avatar
    Joined
    Aug 2010
    Posts
    127
    This maybe it.

    See this post from me http://forums.pligg.com/questions-co...-geo-flag.html

    How could 1 use $_SERVER['REMOTE_ADDR'] to fetch the anonymous users ip for a country code flag?

  5. #5
    New Pligger JagenganiDymn's Avatar
    Joined
    Dec 2011
    Posts
    1
    оффтоп: модеры, а можно как нить перепост себе вконтик сделать? не вижу кнопок, обычно внизу они

  6. #6
    New Pligger PedroFunhe's Avatar
    Joined
    Jan 2012
    Posts
    1

    just a test, admin, del this message

    just a test, admin, del this message

Similar Threads

  1. How to Replace Pligg Comment Box to Facebook Comment Box ?
    By 12kerala in forum Questions & Comments
    Replies: 4
    Last Post: 04-24-2012, 01:24 PM
  2. IP address as URL
    By urarcade in forum Questions & Comments
    Replies: 2
    Last Post: 05-09-2011, 12:27 PM
  3. Anonymous comment insert problem
    By calvin199 in forum Questions & Comments
    Replies: 7
    Last Post: 10-12-2010, 11:48 AM
  4. Best way to include Jquery
    By sirwanme in forum Questions & Comments
    Replies: 0
    Last Post: 08-15-2010, 06:16 AM
  5. Can I include a page?
    By glcaff in forum Questions & Comments
    Replies: 2
    Last Post: 04-30-2006, 08:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting