Alex's Support Forums » Hacks

IP address capture (Pro)

(4 posts)
  1. Alex,

    First off, MORE kudos for the Pro version! It's amazingly simple to set up and use! Great work!!! Especially for us designers who only know how to make stuff look pretty but not so much how to make it function...

    I need 2 things that I can't figure out how to do (if at all possible):

    1. capture the IP address when the form is submitted
    2. make the first opt-in checkbox required

    Thanks in advance for any help.

    Brian

    Posted 2 months ago #
  2. Thanks Brian :)

    The IP address of a user isn't currently captured. I am aware that some scripts record IPs as an anti-spam measure (to ban IPs). The problem with this is that there is a risk of banning other people as well who may happen to be using the same network or ISP. Any self-respecting spammer also knows how to change or fake their IP address.

    This blog post may be useful:

    http://kalsey.com/2004/02/why_ip_banning_is_useless

    If I see significant demand for this feature I may add it, but I think you'll find the app very resistant to spam anyway. I also have several ideas to tighten it further in future.

    By "the first opt-in checkbox" do you mean the mailing list opt-in checkbox on the contact form? I made the decision in development that form owners should not able to:

    a) Pre-check the opt-in checkbox (making it opt-out)
    b) Require that people join the mailing list.

    These methods are discouraged by email marketers. Systems like Campaign Monitor will refuse a such a list.

    http://www.campaignmonitor.com/anti-spam

    Perhaps what you're after is to capture people's names as well as their email addresses when they use the list subscribe form? I plan to add that ability in a future version.

    Posted 2 months ago #
  3. Alex,

    Thanks for the quick reply. The reasons for my request are for a specific need my client has, who I am using SimpleContactPro for. They are trying to follow best practices (and maybe even legal practices) for data capture by collecting first & last name, email, zip code, double opt-in, and IP address. I am not schooled on the requirements or legalities, I just know this is what my client requires. Unfortunately, if we cannot figure out a way to integrate IP address capture, then I will have to use something else (like PHPlist, which we used on a similar site.) I would much prefer to use your script - it looks FAR more professional and clean, has easy back-end user management and all the other great features. If I can get it to work with IP address capture then I am certain I will use it on multiple sites (consider that a bribe) :)

    Thanks again!

    Posted 2 months ago #
  4. Here is a workaround to add IP address logging to your contact form's mailing list opt-in.

    Disclaimer

    * I consider this a hack (as WordPress defines one) and I do not support it
    * I wrote this because it is a minor modification. I cannot develop new features based on individual request
    * I do not guarantee that I will add IP logging functionality to a future release
    * If I do add IP logging, I do not guarantee that it will be implemented in this manner
    * I do not guarantee that future updates won't break this
    * You are urged to back up your files and database before attempting a modification of this sort

    ____________________________________

    1) Database modification

    Add a new field called ip to the end of your list_member table. In this case searchability isn't important so for simplicity I used a varchar field. Like any development choice, the pros and cons are debatable. Such is life.

    If your host has the phpMyAdmin control panel this would be the easiest way. If you're familiar with SQL, you could use MySQL Query Browser.

    2) contact.php

    Enter this line of code at the very top after <?php :

    $user_ip = $_SERVER["REMOTE_ADDR"];

    3) sc_admin/include/contact.php

    Change line 251 to say:

    $query = "INSERT INTO $table_list_member (name_full,email,ip) VALUES ('$name_full','$email','$user_ip')";

    4) sc_admin/list.php

    Change line 94 to say:

    $query = "SELECT m.email,m.ip FROM $table_list_member m, $table_list_subscribe s WHERE m.id=s.member_id AND s.confirmkey='' ORDER BY m.email";

    Change line 100 to say:

    printf("<li><a href=\"mailto:%s\" title=\"Send an email to '%s'\">%s (%s)</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"list.php?remove=%s\" class=\"remove\" title=\"Remove '%s' from the mailing list\">Remove</a></li>\n",$list["email"],$list["email"],$list["email"],$list["ip"],$list["email"],$list["email"]);

    ____________________________________

    That should log a user's IP address when a user opts in to your mailing list through your contact form. The user's IP address will be displayed on the mailing list page in sc_admin, next to their email address.

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.