Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Hello all, and a question about PHP tracking...
Old 12-23-2005, 04:25 AM Hello all, and a question about PHP tracking...
Skilled Talker

Posts: 82
Trades: 0
Good day to everyone from a new member - does anyone know what's happened to devnetwork.net today? Oops... probably a rude word here?

I wonder if anyone can help me out here - being a relative newcomer to coding, myself - so that I can make some headway with my little tracking script.

I've written a nice hit counter script that works well:

<?
//A small but effective script to echo the number of hits contained in a flatfile database,
//to be manipulated as necessary.

$fh = fopen("hits.txt","r+");
$current = file_get_contents("hits.txt");
echo $current;
$current++;
fwrite($fh,$current);
fclose($fh);
?>

This works perfectly as a hit counter, and I want to develop it a little so that it displays hits for the current and previous months (not total hits)- without the use of an SQL database. This way, I can echo the contents of the text file in a tracking suite instead of on the web page being tracked, capiche?

Anyone have any ideas? All help gratefully received!

Thanks in advance,

Matt Cooper
mattcooper is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-24-2005, 02:07 AM
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
You could use the date function to get the month then prefix the hits.txt with the month. this would give you a txt file for every month containing the number of hits... eg jan_hits.txt, feb_hits.txt and so on.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 12-24-2005, 08:54 AM
Skilled Talker

Posts: 68
Trades: 0
<?php
$month = date ("F");
$fh = fopen("$month.txt","r+");
$current = file_get_contents("$month.txt");
echo $current;
$current++;
fwrite($fh,$current);
fclose($fh);
?>
somthing like that? tho i'm not 100% sure that would work, even do you get the idea?
mrpaul is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Hello all, and a question about PHP tracking...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28578 seconds with 12 queries