PDA

View Full Version : Help.....


SexyCityEddie
2005-04-28, 05:37 PM
hi guys.... do u know any script or site that provides free script for detecting the site visitors' IP, OS, Browser, ISP, etc???

i thought that its cool if you have that script in your site coz its kinda impressive.

any script will do... better if by JS or PHP

its something like this:

your IP is: 213.564.34.66
your browser is: Firefox
your OS is: Windows XP
your ISP is: pldt.net


or take a look at this. www.danasoft.com


thanks... :D

Cleo
2005-04-28, 05:41 PM
You mean something like this?
http://cleoslinks.com/info.php

SexyCityEddie
2005-04-28, 05:44 PM
You mean something like this?
http://cleoslinks.com/info.php


yeah.. exactly. lol better if u also add the OS and ISP. lol

are you gonna show me the codes? lol

Cleo
2005-04-28, 05:49 PM
That is just a bit of php code less the firewall test at the bottom of the page.

Here is the page source code. Be sure to use the .php extension on the page.

<html>

<head>
<title>Info Page</title>
</head>

<body bgcolor="#ffffff">
<div align="center">
Below you will find your requested information.<br>
<br>
<?php print "Your ip is: $REMOTE_ADDR <br><br>
Your browser is: $HTTP_USER_AGENT <br><br>
The URL that you came from is: $HTTP_REFERER" ?><br>
<br>
<br>
Today's date is<br>
<?php echo date("Y-m-d"); ?><br>
<br>
<br>
</div>
</body>

</html>

SexyCityEddie
2005-04-28, 05:53 PM
wow.. thanks cleo. u the man. lol

now the only script left that im going to research is OS and ISP detector.. cool..

thanks again dude....

but AFAIC, i cant use that script just like that right? i think i must have a declaration or string or something???

Cleo
2005-04-28, 05:59 PM
You are welcome but I'm not a dude.

The OS does show up in that. You can do a reverse lookup on the IP here http://www.whois.sc/

cd34
2005-04-28, 05:59 PM
<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
preg_match('/\)\ .*\ (.*)\//',$ua,$browser);
preg_match('/\(.*; (.*);\ .*;\ .*\)\ /',$ua,$os);
?>
your IP is: <?php echo $_SERVER['REMOTE_ADDR']; ?><br>
your browser is: <?php echo $browser[1]; ?><br>
your OS is: <?php echo $os[1]; ?><br>
your ISP is: <?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']); ?><br>
<p>
<script language="javascript" type="text/javascript">
document.write(navigator.appName + "<br>");
document.write(navigator.platform + "<br>");
</script>

Cleo
2005-04-28, 06:03 PM
Kewl but it says that my OS is "U"
http://cleoslinks.com/info.php


your IP is: 66.176.162.232
your browser is: Safari
your OS is: U
your ISP is: 66.176.162.232
Netscape
MacPPC

cd34
2005-04-28, 06:07 PM
yeah, I was afraid of that.... the UA string is not really that standard in its composition

I guess you could look for telltale strings in it with a table rather than trying to pluck out the piece that some browsers have. It worked on two of the browsers I tested.

also, change gethostbyname to gethostbyaddr -- I wrote that off the top of my head and made a thinko. :)

SexyCityEddie
2005-04-28, 06:08 PM
You are welcome but I'm not a dude.

The OS does show up in that. You can do a reverse lookup on the IP here http://www.whois.sc/



Thanks cleo. |thumb

Cleo
2005-04-28, 06:10 PM
That fixed the host :)

This is what I see as my browser string
Your browser is: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312

SexyCityEddie
2005-04-28, 06:11 PM
<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
preg_match('/\)\ .*\ (.*)\//',$ua,$browser);
preg_match('/\(.*; (.*);\ .*;\ .*\)\ /',$ua,$os);
?>
your IP is: <?php echo $_SERVER['REMOTE_ADDR']; ?><br>
your browser is: <?php echo $browser[1]; ?><br>
your OS is: <?php echo $os[1]; ?><br>
your ISP is: <?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']); ?><br>
<p>
<script language="javascript" type="text/javascript">
document.write(navigator.appName + "<br>");
document.write(navigator.platform + "<br>");
</script>



this is great also. i tried this but the problem is the IP OS ISP and Browser is blank, i put it inside the "body" and saved as php.. do i have to edit some? |thumb


tt

Cleo
2005-04-28, 06:14 PM
The difference between cd34 and me is he actually understands the code and I just have little snippets of code that I've saved over the years.

I do have dusty book or two on php

SexyCityEddie
2005-04-28, 06:16 PM
oh wait guys, DO I HAVE TO PUT THE PHP FILE ONLINE??? lol coz i tried both of your scripts offline. the file is just in my local folder. hahaha

Pedronas
2005-04-28, 06:16 PM
tnx Cleo

cd34
2005-04-28, 06:25 PM
try:


<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
preg_match('/\)\ .*\ (.*)\//',$ua,$browser);
preg_match('/\((.*)\)\ /',$ua,$os);
$os = explode(';',$os[1]);
?>
your IP is: <?php echo $_SERVER['REMOTE_ADDR']; ?><br>
your browser is: <?php echo $browser[1]; ?><br>
your OS is: <?php echo $os[2]; ?><br>
your ISP is: <?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']); ?><br>

SexyCityEddie
2005-04-28, 06:34 PM
wow! many thanks to CLEO and CD34... you guys are great.. thats a very big help.. |thumb |headbang| |bow|




tt

Cleo
2005-04-28, 06:36 PM
That works for Safari but returns nothing for IE
This is IE's string
"Your browser is: Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)"

your IP is: 66.176.162.232
your browser is: Safari
your OS is: PPC Mac OS X
your ISP is: c-66-176-162-232.hsd1.fl.comcast.net
Netscape
MacPPC


Shouldn't this say Safar?
"document.write(navigator.appName"

FireFox

your IP is: 66.176.162.232
your browser is: Firefox
your OS is: PPC Mac OS X Mach-O
your ISP is: c-66-176-162-232.hsd1.fl.comcast.net

cd34
2005-04-28, 06:51 PM
yeah, I figured that -- IE doesn't have the arguments in the same order. Its a lot harder than it seems to get it to be accurate across all of the different variations since there is no standard layout for the UserAgent.

Cleo
2005-04-28, 06:56 PM
Seems a lot easier just to read the info for yourself then trying to grab bits of it and display them.

The ISP info is pretty kewl.

Look at the OS when I told Safari to be Konqueror :)

your IP is: 66.176.162.232
your browser is:
your OS is:
your ISP is: c-66-176-162-232.hsd1.fl.comcast.net
undefined
X11

Your browser is: Mozilla/5.0 (compatible; Konqueror/3)

swedguy
2005-04-28, 07:10 PM
You mean something like this?
http://cleoslinks.com/info.php
I see my old cookie checker in there :D

Cleo
2005-04-28, 07:16 PM
I couldn't remember where I got that.:)

It works great when I'm trying to figure out why one of Angel's members is having problems seeing her feeds.