Show the user their IP addy?

This is a discussion on "Show the user their IP addy?" within the JavaScript Forum section. This forum, and the thread "Show the user their IP addy? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 16th, 2008, 18:03
Junior Member
Join Date: Dec 2007
Location: Minnesota
Age: 25
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Show the user their IP addy?

Hi,.

We have this code already to view all about the users browser. But what i need exactly is some sort of addition to it to see the users IP addy.
We need this for our customer website. The customer needs to be able to view their IP addy and this makes our job alot more easy to solve their issues. so the boss says lol.

Here is my code so far
HTML: Select all
<html>
<body>

<script type="text/javascript">
var x = navigator;
document.write("CodeName=" + x.appCodeName);
document.write("<br />");
document.write("MinorVersion=" + x.appMinorVersion);
document.write("<br />");
document.write("Name=" + x.appName);
document.write("<br />");
document.write("Version=" + x.appVersion);
document.write("<br />");
document.write("CookieEnabled=" + x.cookieEnabled);
document.write("<br />");
document.write("CPUClass=" + x.cpuClass);
document.write("<br />");
document.write("OnLine=" + x.onLine);
document.write("<br />");
document.write("Platform=" + x.platform);
document.write("<br />");
document.write("UA=" + x.userAgent);
document.write("<br />");
document.write("BrowserLanguage=" + x.browserLanguage);
document.write("<br />");
document.write("SystemLanguage=" + x.systemLanguage);
document.write("<br />");
document.write("UserLanguage=" + x.userLanguage);
</script>

</body>
</html>
This really needs to be a user end feature. Im not sure if im going in the correct direction. If you look on some websites, they show you your own IP addy in a small box on the website. Well thats what im trying to create.
God invented java to drive us insane lol.

thank you for your time

Last edited by c010depunkk; Jan 16th, 2008 at 20:56. Reason: please use [HTML] tags when posting HTML
Reply With Quote

  #2 (permalink)  
Old Jan 16th, 2008, 18:24
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show the user their IP addy?

You have to use php:
PHP: Select all

<?php
echo $_SERVER['REMOTE_ADDR'];
?>
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Jan 16th, 2008, 19:19
Junior Member
Join Date: Dec 2007
Location: Minnesota
Age: 25
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show the user their IP addy?

Thanks for the info.

Do i just add the PHP code to my XHTML/CSS?
I have made our site using XHTML and used a CSS stylesheet.

Is the code you posted above the code i need?.
Reply With Quote
  #4 (permalink)  
Old Jan 16th, 2008, 19:34
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Show the user their IP addy?

I'm not sure how your page is layed out.
But that will just print the IP Address. If you put it that on it's own in a PHP script and I visited it, I would just see 78.32.29.193.
You can put it wherever you want in your file, just make sure it ends in .php.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jan 17th, 2008, 03:53
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Show the user their IP addy?

Is the page/sites that you are developing is a static or a dynamic sites?

Basic explaination:
Static: no database
Dynamic: with database interaction.

If your web host support PHP, then you could use Alex code provided you save the page in .php extension
If it do not support PHP, you could use ASP then like this:
HTML: Select all
<%
   Dim ipadd
   ipadd = Request.ServerVariables("remote_addr")
   Response.Write(ipadd) 'This will display the use ip address!
%>
There is a JavaScript function, but I wouldn't recommend it
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #6 (permalink)  
Old Jan 17th, 2008, 17:31
Junior Member
Join Date: Dec 2007
Location: Minnesota
Age: 25
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Show the user their IP addy?

There will be database interaction on our website.
Its our main business and we have a client log in section and we are adding a shopping feature plus we are trying to work on a build your own product section where customers can mix and match all products to create their Computer. Its computer sales we work in.
Thats one of the reasons we need to show user IP as its to do with our tech side of the business.
Reply With Quote
  #7 (permalink)  
Old Jan 17th, 2008, 23:41
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Show the user their IP addy?

So, did Alex way or mine solved your problem?
again...What language do you use to build your site?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Images don't show lung JavaScript Forum 3 Nov 17th, 2007 10:54
[SOLVED] Show "Image" Depends On User "Status"? Monie Classic ASP 6 Oct 16th, 2007 01:22
Slide show/s :) OmiE Flash & Multimedia Forum 4 May 25th, 2007 04:55
favicon doesn't show berjoe Graphics and 3D 20 Nov 13th, 2006 14:32
not sure what its called but i can show you what i mean bruno89 Web Page Design 12 Oct 17th, 2006 07:15


All times are GMT. The time now is 04:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43