473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help detecting User Details

77
Hello, Im trying To create A code In php That Does the Following:

A. detects visiting users real ip address
B. detects city and country
C. detects browser type and version
D. detects referrer url
E. detects landing page
F. appends this information to a txt file

Im using the following php file hosted in same folder as the txt file, and using

Expand|Select|Wrap|Line Numbers
  1. <script src='http://h1.ripway.com/Inny/spy/spy.php'></script>
in my html.

txt file
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Spy</title>
  4. <body background="http://i14.photobucket.com/albums/a345/Instar/escher_background.gif">
  5.  
  6. </head>
  7. <body>
  8.  
  9. <SCRIPT src='http://h1.ripway.com/Inny/spy/pass.js'></SCRIPT>
  10.  
  11.  
  12.  
  13. <center><font color='red'>
  14. <form method="POST" action="http://www.geobytes.com/IpLocator.htm?GetLocation">
  15. <input type="hidden" name="cid" value="0">
  16. <input type="hidden" name="c" value="0">
  17. <input type="hidden" name="Template" value="iplocator.htm">
  18. <h3>IP Address to locate:<input type="text" name="ipaddress" size="15" value=""> <input type="submit" value="Submit">
  19. </h3>
  20. </form>
  21. </center>
  22.  
  23.  
php file

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Spy</title>
  4. </head>
  5. <body background="http://i14.photobucket.com/albums/a345/Instar/escher_background.gif">
  6. <center><h2>
  7. <center> 
  8. <table border="5" bg color="white">
  9. <tr>
  10. <td><center>
  11. <body>
  12. <?php
  13. $spy = fopen("spy.html" , "a");
  14. $site = $HTTP_REFERER;
  15. $ip = $REMOTE_ADDR;
  16. $browser = $HTTP_USER_AGENT;
  17. $time = date("H:i dS F");
  18.  
  19. echo "<font color='red'>The site User came from: " . $_SERVER["HTTP_REFERER"] . "<br />";
  20. echo "<font color='blue'>ALL IP ADRESSES, TIME, SITE AND USERS BROWSERS ARE BEING CAPTURED!";
  21.  
  22. fwrite($spy,"<font color='blue'><<<<<------------BEGIN------------>>>>></font><br />");
  23. fwrite($spy,"<font color='black'>Site user came from: $site <br />");
  24. fwrite($spy,"IP Address: $ip <br />");
  25. fwrite($spy,"Browser: $browser <br />");
  26. fwrite($spy,"Time: $time <br />");
  27. fwrite($spy,"<font color='red'><<<<<------------END------------>>>>></font><p/><p>");
  28.  
  29. fclose($spy);
  30. ?>
  31.  
  32. </table>
  33. </center></td>
  34. </tr>
  35. </table border>
  36. </body>
  37. </html>
  38.  
  39.  
  40.  
  41.  
Im getting odd results as all entrys show same ip . please help?
Nov 26 '07 #1
7 2367
Inny
77
Bizzare results im getting, not what I want

<<<<<------------BEGIN------------>>>>>
Site user came from: http://herproom.5.forumer.com/index.php?
IP Address: 192.168.0.5
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Time: 00:11 26th November
<<<<<------------END------------>>>>>


<<<<<------------BEGIN------------>>>>>
Site user came from: http://herproom.5.forumer.com/index.php?
IP Address: 192.168.0.5
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Time: 00:15 26th November
<<<<<------------END------------>>>>>


<<<<<------------BEGIN------------>>>>>
Site user came from: http://herproom.5.forumer.com/index.php?
IP Address: 192.168.0.5
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Time: 00:17 26th November
<<<<<------------END------------>>>>>
Nov 26 '07 #2
Markus
6,050 Expert 4TB
Maybe it's the same person?

:P
Nov 26 '07 #3
Inny
77
Nothing Useful to add? Its not the same person.
I think Ive wriiten it wrong and that Ip is the server

Full-screenYour IP address is 192.168.0.5
City: Marina Del Rey California
Country: United States
Continent: North America
Time Zone: PST
Nov 26 '07 #4
Inny
77
second attempt...

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. $spy2 = fopen("spy2.html" , "a");
  3.  
  4.    echo "<html><head><title>HerpSpy</title></head>"; 
  5.    echo "<body><h1>User Info:</h1>"; 
  6.    echo "$HTTP_REFERER=".getenv("$HTTP_REFERER")."<br>"; 
  7.    echo "$REMOTE_ADDR=".getenv("$REMOTE_ADDR")."<br>"; 
  8.    echo "$HTTP_USER_AGENT=".getenv("$HTTP_USER_AGENT")."<br>"; 
  9.    echo "$HTTP_ACCEPT=".getenv("$HTTP_ACCEPT")."<br>"; 
  10.    echo "$HTTP_ACCEPT_LANGUAGE=".getenv("$HTTP_ACCEPT_LANGUAGE")."<br>"; 
  11.    echo "$HTTP_ACCEPT_CHARSET=".getenv("$HTTP_ACCEPT_CHARSET")."<br>"; 
  12.    echo "$HTTP_ACCEPT_ENCODING=".getenv("$HTTP_ACCEPT_ENCODING")."<br>"; 
  13.    echo "</body></html>"; 
  14. fwrite($spy,"<font color='blue'><<<<<------------BEGIN------------>>>>></font><br />");
  15. fwrite($spy2,"<font color='black'>Site user came from: $HTTP_REFERER <br />");
  16. fwrite($spy2,"IP Address: $REMOTE_ADDR <br />");
  17. fwrite($spy2,"Browser: $HTTP_USER_AGENT <br />");
  18. fwrite($spy2,"$HTTP_ACCEPT: $HTTP_ACCEPT <br />");
  19. fwrite($spy2,"Language: $HTTP_ACCEPT_LANGUAGE <br />");
  20. fwrite($spy2,"$HTTP_ACCEPT_CHARSET: $HTTP_ACCEPT_CHARSET <br />");
  21. fwrite($spy2,"$HTTP_ACCEPT_ENCODING:$HTTP_ACCEPT_ENCODING <br />");
  22. fwrite($spy2,"<font color='red'><<<<<------------END------------>>>>></font><p/><p>");
  23.  
  24. fclose($spy2);
  25.  
  26.  
  27. ?> 
  28.  
but still getting same ip! why? Other visitors ARE getting logged, as Ive added Language and seen diff languages in the logs but still same ip and not showing the rerrer page !Help
Nov 26 '07 #5
Markus
6,050 Expert 4TB
Is IP Addr: 192.168.0.5, yours? MAybe you should check.

It might be the server your on?

But i'm not really sure..

i've not done much with REMOTE_ADDR but i'll have a play around n hopefuly give you some more input.
Nov 26 '07 #6
Inny
77
No its not my ip (see ip resolution above) Im in Australia mate!
Got me beat though! Hope you can help.
Cheers

this is what im getting on that ip

OrgName: Internet Assigned Numbers Authority
OrgID: IANA
Address: 4676 Admiralty Way, Suite 330
City: Marina del Rey
StateProv: CA
PostalCode: 90292-6695
Country: US

NetRange: 192.168.0.0 - 192.168.255.255
CIDR: 192.168.0.0/16
NetName: IANA-CBLK1
NetHandle: NET-192-168-0-0-1
Parent: NET-192-0-0-0-0
NetType: IANA Special Use
NameServer: BLACKHOLE-1.IANA.ORG
NameServer: BLACKHOLE-2.IANA.ORG
Comment: This block is reserved for special purposes.
Comment: Please see RFC 1918 for additional information.
Comment:
RegDate: 1994-03-15
Updated: 2002-09-16

OrgAbuseHandle: IANA-IP-ARIN
OrgAbuseName: Internet Corporation for Assigned Names and Number
OrgAbusePhone: +1-310-301-5820
OrgAbuseEmail: abuse@iana.org

OrgTechHandle: IANA-IP-ARIN
OrgTechName: Internet Corporation for Assigned Names and Number
OrgTechPhone: +1-310-301-5820
OrgTechEmail: abuse@iana.org

# ARIN WHOIS database, last updated 2007-11-25 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database
Nov 26 '07 #7
Inny
77
Bump Please help? How can I avoid Getting Index Pages ? Including Referer php in the script tags not working.
Also Cant get real Ip
Nov 28 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
2
by: Tom | last post by:
Hi, I would like to use the standard PHP sessions and I understand they rely on the target web browser to support session cookies. I have tried the following code: <? session_start(); if...
4
by: Daniel Orner | last post by:
Does anyone know of a simple way to have a Python script find out what browser is accessing it? After a web search the only thing I found to do this is Zope, but the system I'm programming doesn't...
21
by: Lasher | last post by:
Hi, I have clients using an application that allows users to change their passwords. The application uses the 'ALTER USER xxx IDENTIFIED BY.....' command. What I need to do is use Oracle to...
6
by: Virginia Kirkendall | last post by:
Hi: I'm new with this & need help creating a XSL table that looks like the following: --------------------------------------------------------- | | | | | |...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: wwwords | last post by:
Is there a general method for detecting that a user has changed the record currently visible on a form, whether this is by hitting PgUp or PgDn or clicking on a navigation button, even if no change...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.