Link to home
Start Free TrialLog in
Avatar of GAUTAM
GAUTAMFlag for United States of America

asked on

Report of the users accessing the website

Hi Experts...
I wanted to generate a report for every uer accessing the website.
The web report should be of the following format.
How do i achieve the same.
Please help
System Details Report:

-----------------------------------
Connection_IP:                
-----------------------------------
Connection_PTR:                
-----------------------------------
Connection_Speed:             
-----------------------------------
Connection_Type:               
-----------------------------------
Connection_Proxied:            
-----------------------------------
Connection_ISP:                
-----------------------------------
Connection_Country:            
-----------------------------------
Connection_State:              
-----------------------------------
Connection_City:               
-----------------------------------
Connection_Latitude:           
-----------------------------------
Connection_Longitude:          
-----------------------------------
Connection_Zip:                
-----------------------------------
Browser_UserAgent:             
-----------------------------------
Browser_Name:                  
-----------------------------------
Browser_RenderEngine:          
-----------------------------------
Browser_ActiveX:               
-----------------------------------
OS_Name:                      
-----------------------------------
OS_Architecture:               
-----------------------------------
Other_Resolution:             
-----------------------------------
Other_ColorDepth:              
-----------------------------------
Plugin_Java:                   
-----------------------------------
Plugin_Flash:                  
-----------------------------------
Plugin_Windows_Media_Player:   
-----------------------------------
Other_Microsoft_Office:        
-----------------------------------
Other_Microsoft_.Net:         
-------------------------------

Report provided by http://www.systemdetails.com

Open in new window

Avatar of arnold
arnold
Flag of United States of America image

Several items you can not know, i.e. connection speed.
Some information you can derive based on the browser/version they use.
ISP you can derive by looking up arin or the regional authority responsible for IP allocation.
Avatar of GAUTAM

ASKER

@arnold: Thanks for the reply.
Can you pls provide any api examples for the same or any documentation which would help regarding this.
Even though i cannot get all information whatever is gettable will do.
Please help...
There is no API. You crunch the log (awstats log cruncher) could be what you are looking for.

depending on your logging configuration
source IP date/time "request and what was request" outcome/result amount_of_data_sent referrer(page_from_which_the_request_came) useragent  etc.


source Ip can be looked up using DNS and arin,etc. to see to whom it is assigned and depending on the naming convention may tell you the geographic location (DNS LOC records if employed by the party to whom the IPs are allocated)

you would have an entry that would include something like

 "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"

This deals with the UserAgent (browser used to access site)
You know system is windows 2003 (windows NT 5.2)
.NET 1.1,2.0,3.0,3.5 available
IE 7 or newer Trident/4.0 narrows it down to IE 8 (http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/33e0ed49-11fb-4d91-857c-a35496e90075/)

Detecting plugins is part of the data being passed and would not be in the log.



Here is a JSP that prints the request headers sent by the browser.
<%@ page import="java.util.*" %>
<html><body>
<%
    Enumeration headerNames = request.getHeaderNames();
    while(headerNames.hasMoreElements()) {
      String headerName = (String)headerNames.nextElement();
      out.println(headerName);
      out.println(" " + request.getHeader(headerName) + "<br/>");
    }
%>
</body></html>

Open in new window

Avatar of GAUTAM

ASKER

@arnold: & rrz@871311: Thanks a lot for your replies.

@arnold: I could not follow from where do i begin this procedure of getiing the user's info.
As rrz@871311 has replied the basic info is obtained regarding the user's browzer etc.

My main requirements are ISP provider and IP address.
If these are obtained my requirement will be satisfied.
Can you provide any samples or tutorials or any material which can get me started on this which can be integrated in java code.
Please help...
http://www.eclipse.org/tptp/home/documents/tutorials/gla/gettingstarted_gla.html

IP address should be part of the data in the log and will satisfy both your condition provided you know how to query whois.arin.net and then whois.other to get data on to whom the IP/IP Block was allocated.

http://www.javapractices.com/topic/TopicAction.do?Id=87
For IP address, you can use  methods of HttpServletRequest.
RemoteHost: <%=request.getRemoteHost()%><br/>
RemoteAddress: <%=request.getRemoteAddr()%><br/>

Open in new window

rz the asker wants java examples parsing logs not asp/windows server settings that would display to the user what their hostname/ip is when they visit sites (at least that is what think the asker is looking for).
arnold: rrz is giving the Java/jsp code for seeing the contents of the request header.  It isn't clear from the asker whether they want to parse logs as you suggested, or if they want Java code to read http request information.   This is the Java zone, so the assumption that Java code is desired seems a reasonable one.
Unfortunately it seems it all depends on how one interprets the, "I want to generate a report for every user accessing the website."
one is to present the data to the user another is to present the data to the asker.
The Tag, "report of users accessing the website" leans more towards data crunching from logs or part of the java/jsp to log/record the data in local database.
The code I posted, just demonstrates how to obtain some of the data. Ultimately, I think gaugeta could use a logging framework or write his own Filter to create a log file.
Avatar of GAUTAM

ASKER

@all : Thanks a lot for your replies.
Sorry for the confusion caused.

The thing i wanted is to get the dynamic ip address of the user accessing the website and the isp of the user.
And for achieveing the same i do not know whether to parse logs as mentioned by arnold or use the method suggested by rrz@871311 which retreives the data from the implicit jsp request object.

Which method is appropriate for this requirement.
Please help...
Do you want access to the data in real-time or is this a historical type of info gathering?

Determining information i.e. ISP, location, etc. involves lookups and is not present in the request.  The question is do you want to perform those lookups while the site is being accessed or can it be done at a later time presumably off peak?

You could use the suggestion and when access is made to the site while the jsp runs on the server, it inserts the data into a local database.
Depending on how active your site is and whether you would incorporate this mechanism in every page on your site, the database size will/can grow fast.

Determining the scope/options of the browser means that you would have to run javascript in the browser on the client to see what options they have.
http://www.javascriptkit.com/script/script2/plugindetect.shtml and report back.
Avatar of GAUTAM

ASKER

@arnold:Thanks for the reply.

>>Do you want access to the data in real-time or is this a historical type of info gathering?

Yes i want to access data in real time as the user sccess the web-site.

>>The question is do you want to perform those lookups while the site is being accessed or can it be done at a later time presumably off peak?

I want to perform these lookups while the site is being accessed.

Please help...
The experts have helped.  Try writing some code and see if you run into any problems.
Then you can use the example rrz and within your code insert data into a database that you an then query in realtime who is currently on.
updating the date/time for a client will keep this information current, setting a cookie to keep track of the same person to minimize data duplication while minimizing the amount of repetitive work looking up IP, source, etc.
Avatar of GAUTAM

ASKER

@all : Thanks for the replies.
Will try these and get back if i face any issues.
Avatar of GAUTAM

ASKER

@arnold: I tried the code below but i am getting the ip address set for the lan connection for the system but am not getting the dynamic ip address for the system which i checked from http://ipchicken.com/ which was different from the one getting displayed.
Please help...

RemoteHost: <%=request.getRemoteHost()%><br/>
RemoteAddress: <%=request.getRemoteAddr()%><br/>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GAUTAM

ASKER

@arnold:Thanks for the reply.
Yes i access the website within the lan.
I will do as you have suggested and get back with the status.
realtime? You should use a filter class of java.