Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
can some won please help me out with this script im trying to get it to save the viewers current ip address to there own hard drive as a cookie it does not need to be retreved just stored for the current sesion and the renew the next time the viewer vists the web page heres the script I had to leave part of the script tags out but youll get the idea Thanks for your time.........
//html
//head
//body
//script language="javascript"/expireDate = new Date
/expireDate.setMonth(expireDate.getMonth())///head
/var ip = ''/function ipval() {
/document.myform.ipaddr.value=ip;
/}
/window.onload=ipval
//script/form method="post" action="" name="myform">
/
//form
/script/ipAddr = ""
/if (document.cookie != "") {
/ipAddr = document.cookie.split("=")[1]
/}/function setCookie() {
/ipAddr = document.myForm.nameField.value
/document.cookie = "ipAddr="+ipAddr+";expires=" + expireDate.toGMTString()
/}
/onLoad="setCookie"=document.myForm.nameField.value = ipAddr"//script
//body
//html

Hello there,
As far as my experience goes, I haven't been successful in retreiving a user's IP address. If so, you could record it in a cookie file, but getting it is the problem. Go here for a set of cookie functions if you need them.

getting the ip address is the easy part i just cant figure out the cookie part thanks for the link Tim

here you go can you send that link again? The one above does not work Thanks!!
oh ya uncomment all the lines before you try to use it..
////var ip = ''
//function ipval() {
//document.myform.ipaddr.value=ip;
//}
//window.onload=ipval
////
//
//

Send me your email address it will not let me post it here it keeps cuting parts of it out, when i try to post it. Also will you resend that link the one above does not work thanks Tim

![]() |
How to read an c exe with...
|
Needed help
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |