Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2005-08-13, 10:58 AM
Junior Member
 
Join Date: May 2005
Posts: 26
cardine
Default

Does anybody know of a counter that would track www.blah.com/index.php?username=people as a different website as www.blah.com/index.php?username=yes.
The one i use tracks them as the same page.
Thanks
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2005-08-13, 03:06 PM
Member
 
Join Date: Dec 2004
Posts: 62
nirus
Default

Why don't you write an if statement that checks the value of ?username= and writes to files depending on what it is... people or yes.
Code:
if ($_GET['username'] == "people"){
    //fopen people.dat
    //grab it's contents
    //add 1 to it
    //fclose people.dat
  }
else if ($_GET['username'] == "yes"){
    //fopen yes.dat
    //grab it's contents
    //add 1 to it
    //fclose yes.dat
  }
else {
   echo "Um, index.php was called directly or index.php?username=_____ was not in the URL";
}
After this... when ever you want to see the counter number just get file contents of people.dat or yes.dat. If you want total... just add the 2 files.
-Nirus
Reply With Quote
  #3 (permalink)  
Old 2005-08-13, 03:49 PM
Junior Member
 
Join Date: May 2005
Posts: 26
cardine
Default

But I'm (hopefully) going to have hundreds of different usernames that are being tracked. Then I'd also have to manually add another block of code each time somebody signs up. I'm looking for for a graphical counter so each different member knows how many visitors they have gotten to their website (for tracking).
Reply With Quote
  #4 (permalink)  
Old 2005-08-14, 11:19 AM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

Got rid of the double post for you.

Use a database.

The table only needs two fields username and count

Then on each page, check to see if the username is in the table, and if not, add it, then add one to the count.

It isnt letting me post the example.........
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #5 (permalink)  
Old 2005-08-14, 11:29 AM
Junior Member
 
Join Date: May 2005
Posts: 26
cardine
Default

It won't let me post the code; but I think I've gotten it to work (with the database). Is there anyway (with cookies maybe) to make the counter unique as opposed to pageviews?

Thanks!

EDIT: I uploaded the main part of the MySQL code (in html so you can see the source). Here it is: MySQL Code
Reply With Quote
  #6 (permalink)  
Old 2005-08-14, 02:39 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

sure. set a cookie and check it on each page view. Create it with a certain time to expire.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:51 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.