Computing.Net > Forums > Programming > javascript

javascript

Reply to Message Icon

Original Message
Name: Michael
Date: November 1, 2002 at 12:25:16 Pacific
Subject: javascript
OS: redhat 8/winnt 4/win98
CPU/Ram: 866/256
Comment:

hi everybody, I want my script to collect the ip adress of anyone that comes to my site and email them too me so i can count how many original hits there are at my site. could anyone write out that script for me?


Report Offensive Message For Removal

Response Number 1
Name: michael
Date: November 1, 2002 at 12:27:52 Pacific
Subject: javascript
Reply: (edit)

yes, that is my real email, even though they blocked it out, just replace the --- with uck if you want to email me


Report Offensive Follow Up For Removal

Response Number 2
Name: michael
Date: November 1, 2002 at 12:30:50 Pacific
Subject: javascript
Reply: (edit)

sorry about the crude email addy, just staying away from microsft


Report Offensive Follow Up For Removal

Response Number 3
Name: Don Arnett
Date: November 1, 2002 at 15:19:16 Pacific
Subject: javascript
Reply: (edit)

I doubt that Javascript can get the IP address. You probably need something on the server side; ASP, JSP, Perl, CGI?

There are web statistic packages that sit on your server that collect this stuff for you also. You might do a search for a free one.


Report Offensive Follow Up For Removal

Response Number 4
Name: muska
Date: November 2, 2002 at 21:21:39 Pacific
Subject: javascript
Reply: (edit)

There is a way to ge the IP address with JavaScript. Although, the server you run it on has to have Server-Side Includes (SSL) or something like that enabled. You have to name your page with the extension ".shtml". Then, insert [!--#echo var="REMOTE_ADDR"--] (change [] to braces) into your page somewhere (say between two quotes so that you can store it as a string) and the server will parse the page when it is run and replace that string with the ip address of the user. However, even though you can spit out the ip address with javascript, I do not know of a way to send an email with a javascript. Maybe if you used a form you could do it, but you'll have to figure that out... You could send it to a perl or php script and use a mail function to mail it though.


Report Offensive Follow Up For Removal

Response Number 5
Name: frep45
Date: November 3, 2002 at 11:08:44 Pacific
Subject: javascript
Reply: (edit)

Just so you know, collecting the IP address of every visitor will not work very well... Dial-up ISPs assign a new IP address to every user every time they connect, and some broadband ISPs do that too. That would mean I could visit your page, then disconnect from the Internet, then visit your page again, and it would show two different IP addresses.

The most reliable way, as far as I know, to count unique visitors is by using cookies, even though they can be deleted by the user.


Report Offensive Follow Up For Removal


Response Number 6
Name: muska
Date: November 4, 2002 at 08:15:39 Pacific
Subject: javascript
Reply: (edit)

With cookies, anyone could go to the site, delete the cookie that pertains to that site, then refresh the page. What if the user limits the size of their temporary internet folder to 1MB? The cookies will be deleted frequently.

I think that either way works, but server-side would probably work best because it is more available than SSL.

It really depends on the features supported by the server that the site is running on.


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: javascript

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software