Use the PHP one because some people have javascript disabled.

Use the PHP one because some people have javascript disabled.
You can use either javascript/php.
Personally, I would go for PHP. Simply renaming the page to .php and adding a little code (I'd do it like this):
That would appear something like this:PHP Code:<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "<i>Your IP address has been logged: " . $ip . ".</i>";
?>
Your IP address has been logged: 11.22.33.44
And could simply be put at the bottom of the form.
You can also simply add this to the area of the form coding that stores the data submitted in the form as variables (if PHP):
And this would register the visitor's ip as a variable ($ip), and if it's something like submitting an email, you just add it to the email like all the other variables ie. name etc.PHP Code:$ip = $_SERVER['REMOTE_ADDR'];
Hope I've helped.
Last edited by iUnknown; 28-01-2009 at 11:05 PM.
Kind Regards,
Guy__________________
Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
Tech-Hosts.co.uk.
Arent we trying to get the "clients" IP?
Javascript is also client side (though you can still get the IP with it), though I think it might be because
HTML is a markup language...??????????????????????????
Hi, names James. I am a web developer.
why not just
instead of adding all your wacky YOUR IP IS" . $IP OH GOD SET A VARIABLE FOR SOMETHING THAT NEVER CHANGESPHP Code:<?php echo $_SERVER[ 'REMOTE_ADDR' ]; ?>
+REP IF I CAN
+REP IF I CAN
THANKS, +REP IF I CANYou can use either javascript/php.
Personally, I would go for PHP. Simply renaming the page to .php and adding a little code (I'd do it like this):
That would appear something like this:PHP Code:<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "<i>Your IP address has been logged: " . $ip . ".</i>";
?>
Your IP address has been logged: 11.22.33.44
And could simply be put at the bottom of the form.
You can also simply add this to the area of the form coding that stores the data submitted in the form as variables (if PHP):
And this would register the visitor's ip as a variable ($ip), and if it's something like submitting an email, you just add it to the email like all the other variables ie. name etc.PHP Code:$ip = $_SERVER['REMOTE_ADDR'];
Hope I've helped.
Thanks, +REP IF I CAN
![]()
Rofl, Jewish Bear makes me laugh every time. I'm loving the use of wacky. Anyway, glad to see it's been sorted. I'd say PHP is best.
"RETIRED" FROM HABBO(X)
:¬:
TOMSPIT / COWLY05
That's a server side include that for some reason has been combined with javascript. You could just do:
Both examples require certain configurations to work, otherwise every XSS vulnerability would be alot more serious.HTML Code:Your IP is: <!--#echo var="REMOTE_ADDR"-->
I tried "<!--#echo var="REMOTE_ADDR" -->"
It does not work..
Fighting over single and double quotes...
Want to hide these adverts? Register an account for free!