ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 17th, 2004, 01:13 PM
Pestilencia Pestilencia is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Tehran - Iran
Posts: 44 Pestilencia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 54 m 45 sec
Reputation Power: 6
How can I Track the Nummber of All Visitors, and Specific One?!

HI,
I need t track the Visitor of My Site. I mean I want to know the Number of All Visitor and the number that a Specific Visitor has Visited the Site. actually I've not so much problem with All wisitor but the Specific one!
what do U believe the best solution is?!
I've tried catch the User IP and handle it with that, but I've been told it's not Possible, if it's not, how can I do this, or if Yes
how ?! (is it Request.ServerVariables("REMOTE_ADDR") or not?)
Somebody Help PLZ!
__________________
KhoSroW.

Reply With Quote
  #2  
Old January 19th, 2004, 06:13 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 6
This is a brief outline of what you need to do....

Create a single table called "Stats" as follows:

Field Name Field Type
StatID Long, AutoIncrement, Primary Key
Date Date/Time
Time Date/Time
Path String
IP String

Here is code to capture and record a users visit:

PHP Code:
<%
(...)

'Get the data into variables first
sPath = Request.ServerVariables("script_name")
sIP = Request.ServerVariables("remote_addr")

'
Assuming we have an open connection and our recordset is rs;
sSQL "SELECT * FROM Stats"
rs.Open,,, adCmdTable
rs
.AddNew
rs
("Date") = Date
rs
("Time") = Time
rs
("Path") = sPath
rs
("IP") = sIP
rs
.Update

(...)
%> 


Then you can use some SQ statements to filter the captured information. Here are the most common examples:

Total Page Views
SELECT COUNT(StatID) AS Total FROM Stats

Page Views for a Specific Page
SELECT COUNT(StatID) AS Total FROM Stats WHERE Path = '/index.asp'

Page Views Grouped by Pages
SELECT Path, COUNT(StatID) AS Total FROM Stats GROUP BY Path

Page views for a specific time period
SELECT COUNT(StatID) AS Total FROM Stats WHERE Date BETWEEN #mm/dd/yyyy# AND #mm/dd/yyyy#

Visitors for a Specific Page
SELECT COUNT(IP) AS Total FROM Stats WHERE Page = '/index.asp'

Visitors for each Page
SELECT Path, COUNT(IP) AS Total FROM Stats GROUP BY Path

Visitors for a specific time period
SELECT COUNT(IP) AS Total FROM Stats WHERE Date BETWEEN #mm/dd/yyyy# AND #mm/dd/yyyy#

Visitors for each page for a specific time period
SELECT Path, COUNT(IP) AS Total FROM Stats WHERE Date BETWEEN #mm/dd/yyyy# AND #mm/dd/yyyy# GROUP BY Path



Hope that helps??

Reply With Quote
  #3  
Old January 19th, 2004, 06:28 AM
Pestilencia Pestilencia is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Tehran - Iran
Posts: 44 Pestilencia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 54 m 45 sec
Reputation Power: 6
Tnx alot!...
I've known some of them, but Urs is very complete!
but still my question is, this line:

sIP = Request.ServerVariables("remote_addr")

gives back the User IP or Server IP, ... you see, I've been told that the resulk of this, is Server IP and I could not rely on that in my case (I was really believe on the person who told me, but I think he was wrong!!!)
sorry of asking again, is that User IP, or Server one!?
please make me Clear!

Tnx.

Reply With Quote
  #4  
Old January 19th, 2004, 07:00 AM
madhouse madhouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 57 madhouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 16 m 49 sec
Reputation Power: 6
It returns the Users IP Address.....not the Servers IP Address!!

Reply With Quote
  #5  
Old January 20th, 2004, 11:02 AM
Glitch Glitch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Ont. Canada
Posts: 24 Glitch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Tracking a user via IP could be misleading if they are behind a proxy server. Many users could share the same IP as far as you are concerned.

You could write a (encrypted) unique ID to a cookie and look for that when the user hits your site. This is also not 100% reliable though as the user could delete their cookie.

Cheers

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > How can I Track the Nummber of All Visitors, and Specific One?!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT