Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Java Script For Ip Address
Old 01-16-2007, 11:43 AM Java Script For Ip Address
Junior Talker

Posts: 1
Name: Manpreet Singh
Trades: 0
Can Anyone Help Me......... How Can I Extract The IP Address Of A Person With Whom I Am Chatting Or Whom Who Has Visited My Website
manpreetrules is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-16-2007, 12:40 PM Re: Java Script For Ip Address
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
You can't do it accurately at the best of times.

Javascript also doesn't allow for this at all, IIRC.

Why not use a server-side programming language? Most of them can get an IP within 1 line. It's still not 100% accurate, but it's as good as you'll get.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-07-2007, 06:13 AM Re: Java Script For Ip Address
mhelweg's Avatar
Junior Talker

Posts: 1
Name: Michael Helweg
Trades: 0
OR you could try this. This code must be on a secure page (shtml) and when called upon-it will display the visitors i.p. address 100% of the time. Which you could then dump to a file or whatever.


////////// start here /////////
<html>
<head>
<title>show your visitors ip address</title>
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
</script>
</head>

<body>
<td>
<form method="POST" action="" name="myform">
IP ADDR:<input name="ipaddr"; id="ipadr" size="15" style="border-style: solid; border-width: 0; ">
</form>
</td>
</body>
</html>
mhelweg is offline
Reply With Quote
View Public Profile
 
Old 02-07-2007, 09:16 AM Re: Java Script For Ip Address
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
You could selectively add entries to your server log with something like my javascript logging script.
http://willcode4beer.com/tips.jsp?set=jslogging
You could find the IP in your server log and associate it with the messag sent to the log.
willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 02-08-2007, 08:42 AM Re: Java Script For Ip Address
Super Talker

Posts: 140
Trades: 0
if you can not get the IP using java script, how google analytics do this?
__________________

Please login or register to view this content. Registration is FREE
nvidura is offline
Reply With Quote
View Public Profile
 
Old 02-08-2007, 08:56 AM Re: Java Script For Ip Address
BruceWayne's Avatar
Extreme Talker

Posts: 182
Trades: 0
I found some tutorial where you can record the IP's of your visitors and you can also do some simple manipulation in that code to do some IP banning how ever this is written in PHP
if you are interested here is the link http://www.webdesign.org/web/web-pro...ning.8624.html
BruceWayne is offline
Reply With Quote
View Public Profile Visit BruceWayne's homepage!
 
Old 02-08-2007, 09:34 AM Re: Java Script For Ip Address
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
Quote:
Originally Posted by nvidura View Post
if you can not get the IP using java script, how google analytics do this?
They don't do it with javascript exactly. When your browser requests the javascript file, you ip is stored in the server log. So, the javascript doesn't do it, its the actual request for the javascript.
willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 02-08-2007, 05:42 PM Re: Java Script For Ip Address
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Exactly. Google does it using server-side programming.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Java Script For Ip Address
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.74349 seconds with 12 queries