Results 1 to 7 of 7

Thread: Free MOD for IP address

  1. #1
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default Free MOD for IP address

    here is a free MOD for the monthly contest. It adds the IP address as a custom field and captures the ip address of whoever is submitting the link during the add link process by a user

    Go to the Admin Control Panel and click the Custom Field hyperlink in the Links section.

    For the Field name, enter ip_address

    For the Text field, enter IP Address

    For the Type field, select the Text option from the drop down list

    for the Required and Searchable options, click No for both. Actually, you can select whatever suits you needs for either of these. You could select Yes for the Required field but it really should make no difference for a user submitting a link. If you add the link as the admin, then you would need to add an IP during the add process.

    For the Permission field, select the Admin only option from the drop down list

    Click the Add Field button to save the custom field



    Edit the add_form.html file.

    You do not need to change which option (Show or Hide) you are using for <%$custom_field_form%>.

    at the bottom of the page, enter the following just above the </form> tag
    HTML Code:
    <input type="hidden" name="ip_address" value="<%$ip_address%>" />
    it should look like the following
    HTML Code:
    <input type="hidden" name="ip_address" value="<%$ip_address%>" />
    </form> 
    Edit the add.php file.
    Change the call to DisplayTemplate at about line 160 in the function ShowFormAddUrl as follows:

    if (@getenv("REMOTE_ADDR"))
    {
    $ip_address = @getenv("REMOTE_ADDR");
    } else {
    $ip_address = @getenv("HTTP_X_FORWARDED_FOR");
    }

    DisplayTemplate($theme_path . "add_form.html","\$ip_address,\$error_msg,\$title,\$url,\$description,\$category ,\$contact_name,\$email,\$cat,\$add_cat1,\$add_cat 2,\$keywords,\$reciprocal_url,\$custom_field_form, \$sponsored_listing_period,\$premium_listing_perio d,\$basic_listing_price,\$currency_symbol,\$availa ble_payment_systems"
    Save your changes.

    All done.



    .
    Last edited by esm; 03-08-2008 at 08:05 AM.
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  2. #2
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    Love it, nice one

  3. #3
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    or you could add something like the following after the </form>

    HTML Code:
    <div style="text-align:center">We have recorded the following
    IP Address:<%$ip_address%></div>

    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  4. #4
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    once again thanks, nice and easy explaination .

    I did notice a typo "add_form.php" should be "add_form.html"

    Works great, will probally add the field to the detail_link.html as "Submitted by IP" etc.

    Thanks!

  5. #5
    Join Date
    Feb 2008
    Posts
    22

    Default

    To make it better, perhaps we'll need to exclude this custom field in "block_sort_links" so it doesn't show in browse listing page.

  6. #6
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by seveneth View Post
    To make it better, perhaps we'll need to exclude this custom field in "block_sort_links" so it doesn't show in browse listing page.
    I didn't look at it what you were referring to but the problem I have is that the field is designated as "Admin only" so that means that it should not appear anywhere except to the admin and probably only in the admin area screens.

    If it appears elsewhere, maybe a fix by the developer...



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  7. #7
    Join Date
    Feb 2008
    Posts
    22

    Default

    Well, I have to agree on this one
    I think it can be considered as a bug.

Similar Threads

  1. Ip address
    By tane in forum v5.x
    Replies: 0
    Last Post: 06-30-2006, 12:29 PM
  2. Address, Zip Code, etc??
    By RIChristianscom in forum Blocks and Modification
    Replies: 6
    Last Post: 03-27-2006, 10:48 AM
  3. Email Address
    By sofiah in forum v5.x
    Replies: 1
    Last Post: 10-31-2003, 05:14 PM
  4. No IP address in Who's Online
    By craven in forum v5.x
    Replies: 0
    Last Post: 08-28-2003, 02:45 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
  •