Jump to content

Display logged IP on order form


shoggy24

Recommended Posts

I like the line that reads

 

This order form is provided in a secure environment and to help protect against fraud your current IP address (x.x.x.x) is being logged

 

In the default template, which is located in order-stepone.tpl but i use the single order page and i want it to display on that page when the client is placing the order. So i copied the code to order-steptwo.tpl in singlepage folder. The message is diplayed like

 

This order form is provided in a secure environment and to help protect against fraud your current IP address () is being logged

 

with no IP address showing is there something i am missing or need to do for the IP address to display.

Link to comment
Share on other sites

This is more intricate than what you may want need, but nonetheless:

 

{php}
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (strstr($ip, ', ')) {
	$ips = explode(', ', $ip);
	$ip = $ips[0];
}
$host = @gethostbyaddr($ip);
} else {
$ip = $_SERVER['REMOTE_ADDR'];
if (strstr($ip, ', ')) {
	$ips = explode(', ', $ip);
	$ip = $ips[0];
}
$host = @gethostbyaddr($ip);
}
{/php}

 

Your IP has been logged to prevent fraudulent signups 
Host/IP: {php}echo $host{/php}/{php}echo $ip{/php} 
Date/Time: {$todaysdate} {php}echo date("H:i:s");{/php}

 

This is just what I had been using for my old order forms before this was an added variable.

Link to comment
Share on other sites

Jason, when i tried your code the page wouldnt load at all, maybe i am missing something.

 

Jordan in order to use your method do i have to create a file using the first code (in your posting above) and then paste the second code in my tpl file.

If so where in the second code do i reference the file created.

Link to comment
Share on other sites

Jason, when i tried your code the page wouldnt load at all, maybe i am missing something.

 

Jordan in order to use your method do i have to create a file using the first code (in your posting above) and then paste the second code in my tpl file.

If so where in the second code do i reference the file created.

 

Sorry, I didn't really complete the code.

{php}echo $_SERVER['REMOTE_ADDR'];{/php}

 

That should display it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated