| Coding Forum Problems with your code? Let's hear about it. |
06-03-2004, 09:51 PM
|
#1 (permalink)
|
|
Inactive
Join Date: 06-03-04
Posts: 24
Latest Blog: None
|
php page tracking
I'm working on a script that tracks pages a person has been to. Its main job is to see if the person has been to the page yet. The thing is, it can't be based off cookies because it needs to be accurate, and i don't want to do anything with a database, because... that'd be a lot of fields. Anyone have any ideas?
|
|
|
06-03-2004, 11:58 PM
|
#2 (permalink)
|
|
Inactive
Join Date: 05-27-04
Posts: 83
Latest Blog: None
|
Quote:
|
i don't want to do anything with a database, because... that'd be a lot of fields.
|
How many fields? Approximate idea? 10? 1000? 1,000 fields?
I may be missing something but, unless you use some sort of unique login mechanism you have to use cookies to identify the user machine. Of course this is not 100% reliable setup as users may delete cookies.
Without cookies you may sorta identify a mchine by a combination of IP Address+Operating System+Browser. That still is not 100% reliable for some pretty obvious reasons.
You may store some info on the server and regardless of the "number of fields" this is preferred to flat text files because of speed. The number of fields you are worried about is not going to change because you are trying to avoid a database. After all, if you are going to record some type of info about the user, the amount of that info is logically ordered into some kind of record (or array of strings, integers etc) i.e. equivalents of fields. You have to store information somewhere on the server. So you're going to have the same number of fields regardless what technology you use: cookies, flat text file or database.
|
|
|
06-04-2004, 03:19 AM
|
#3 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
Why not sessions. It'll work if you only need to track them on your site. Could be 2 fields.. id and session.
|
|
|
06-04-2004, 09:10 AM
|
#4 (permalink)
|
|
Inactive
Join Date: 06-03-04
Posts: 24
Latest Blog: None
|
The size of the site is constantly growing. And we have to keep track of what pages a person has visited. Each page's main content is an include based off of a variable...f, which is GET. Now, we have to take the name of the include, and keep track of it. If we use a session, then the session dies when someone logs off or closes their browser. Right now we have approximately 750 different pages (f includes). What i'm thinking about doing is creating a txt doc for each user, and just a running list of what sites have been visited.... We have 300 gig of hosting space so it should be fine, and if i place the text file in /var/www then it should be alright for security. What i'll do is i'll search through the text file for the include name, if its not there then i'll add it. :-/ If anyone knows of a better way (i'm sure there is one) it would be greatly appreciated
|
|
|
06-04-2004, 11:22 AM
|
#5 (permalink)
|
|
Inactive
Join Date: 05-27-04
Posts: 83
Latest Blog: None
|
I dont' think the txt files is such a good idea. From what I understand you will be doing a sequential search on records within each file. Sequential searches are very costly in terms of cpu time and disk acess. Databases were created to address this issue.
You can easilly design a table that will do the same, only much much faster. And no, you won't need 750 fields at all. Possibly 3 or 4 in one table.
|
|
|
06-04-2004, 12:10 PM
|
#6 (permalink)
|
|
Inactive
Join Date: 06-03-04
Posts: 24
Latest Blog: None
|
yeah, the flat-file system was kind of .. last resource.. but we have a pretty hefty machine thats going to be chugging this for us (dual opterons) ~ but instead weve decided to just allow ourselves a mysql table, and a row for each page visit.... but now there are going to be some 4,000 entries as the site its being made for has a lot of active members.. so we're just going to do id-> auto-inc key, user-id-> self explanatory, page-id->self explanatory
we just wanted to avoid huge mysql tables- oh well
thanks everyone..
|
|
|
06-04-2004, 12:47 PM
|
#7 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
i wuld just do a mysql system with a table that is like
users ip | site id
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-04-2004, 12:59 PM
|
#8 (permalink)
|
|
Inactive
Join Date: 05-27-04
Posts: 83
Latest Blog: None
|
Quote:
|
Originally Posted by theSpear
i wuld just do a mysql system with a table that is like
users ip | site id
|
not good enough. Say you have a school or a university. A few students access some external website via LAN - all of the visits will be flagged as coming from the same IP.
|
|
|
06-04-2004, 01:20 PM
|
#9 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
then make ppl have to make user accounts 
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-04-2004, 01:21 PM
|
#10 (permalink)
|
|
Inactive
Join Date: 06-03-04
Posts: 24
Latest Blog: None
|
well, the idea is to keep track of the number of pages the user visits, ip will be included in the user table, but we don't want the logging to be ip-specific, instead, we want it to be user-id specific..
well i'm going to go back to writing my paper which compares programming languages to countries..php is Italy- the definition of style and beauty
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:43 AM.
© Copyright 2008 V7 Inc
|