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."
.