PDA

View Full Version : tag for showing viewer info? ie:IP,browser,OS,ISP???



whoo59
10-15-2005, 04:54 PM
I heard there was a tag called show globals, but im not sure anyone that can help me to find a tag to display the viewer's IP, OS, ISP, and Browser...i know i have seen this before so i know its out there...thanx

Twey
10-15-2005, 08:23 PM
I think you want a server-side solution. Clientside, all you can use is the navigator object. In PHP, for example, you can use things like $_SERVER['HTTP_REMOTE_ADDR'] to get the IP address, $_SERVER['HTTP_REMOTE_HOST'] to get the reverse lookup of that IP address, from which you can usually determine the ISP, and $_SERVER['HTTP_USER_AGENT'] to get the user-agent string, which may contain information such as the OS, browser name and version, and rendering engine. For example, my user-agent string (running Firefox (http://www.mozilla.org/products/firefox) on Fedora Core 4 (fedora.redhat.com) on an i686) is:
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7

ddadmin
10-15-2005, 11:12 PM
As Trey mentioned, you'll need a server side language such as PHP for this. For example, something like the below code:

<!--#echo var="REMOTE_ADDR"-->

when inserted in a PHP enabled page (ie: something.php) will display the IP address of the browsing visitor.

Twey
10-16-2005, 09:51 AM
I beg to differ. ddadmin's code is not PHP but SSI (server-side includes), generally named with a .shtml extension. To use PHP, you could use something like
<?php echo($_SERVER['HTTP_REMOTE_ADDR']); ?>This is fine for REMOTE_ADDR, but you would probably want to use a more complex script to parse the others in most cases.

whoo59
10-17-2005, 04:09 AM
ok i havent done anything with PHP yet so ill have to try it out
thnx
and your shure there is no CSS solution to this

-thnx
-ps im pretty new at webdesign i know HTML and have just started learning CSS

Twey
10-17-2005, 03:32 PM
CSS? Why would CSS have anything to do with it? CSS is for changing the style and layout of the page. You're talking about dynamic content. There is no way to do this client-side, unless you use something like ActiveX or Java. Even then it would be complicated and unreliable. The best solution is just to use server-side scripting.

ddadmin
10-17-2005, 06:22 PM
I beg to differ. ddadmin's code is not PHP but SSI

Ops you're right, I wasn't thinking straight. :)