|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
I would like to record how many times peopple click this one link i have on my website is there a php script that does that or some sort of cgi script?
![]() |
|
#2
|
||||
|
||||
|
Moved from PHP forum to Scripts forum
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#3
|
||||
|
||||
|
Did you check Hotscripts, Sourceforge, Google... ?
|
|
#4
|
|||
|
|||
|
Re: recording number of clicks
Quote:
Do you still need help? If it's just one link, you could change it to redirect to (for instance) 'hit.php'. You would need to have a 'hits.txt' file with 666 access (CHMOD 666 hits.txt) hit.php: Code:
<?php
## Open hits counter to get current count ##
$fH = @fopen('hits.txt', 'r');
## Only save new count if it opened ##
if ($fH)
{
$count = fgets($fH, 1024);
@fclose($fH);
## Add one to count (or restart if corrupt) ##
if (is_numeric($count))
$count++;
else
$count = 1;
## Only save if possible ##
$fH = @fopen('hits.txt', 'w');
if ($fH)
fputs($count . "\n");
@fclose($fH);
}
## Redirect ##
header('Location: http://new/url/');
?>
Of course, if you're talking about many links, I'd suggest using a database back-end. Hope this helps |
|
#5
|
|||
|
|||
|
hmm thanx...what does the txt file suposed to look like?
i tested the link out but it doesnt record it to txt...and im running my own apache webserver on windows so..chmod i dont think is available so how do i deal with that? |
|
#6
|
|||
|
|||
|
As far as I know, you shouldn't have any problems with write properties on windows.
The text file should create itself. If not, try creating a blank hits.txt (or whatever). It's possible Apache isn't letting you create new files. If you take the '@' symbols off while debugging, it should give you some extra info. |
|
#7
|
|||
|
|||
|
it doesnt log anything to hit.txt....
|
|
#8
|
|||
|
|||
|
Have you tried removing the '@' symbols to see if any errors are produced?
It should tell you if the file cannot be read or written to, for any reason. |
|
#9
|
|||
|
|||
|
Lot of click tracking scrupts out there !!at hotscripts !!
|
|
#10
|
|||
|
|||
|
Re: Re: recording number of clicks
Quote:
Didnt work.. Error: Warning: Wrong parameter count for fputs() in /mnt/home3/b/ba/banan289/public_html/m-eye/gbcount.php on line 20 Warning: Cannot add header information - headers already sent by (output started at /mnt/home3/b/ba/banan289/public_html/m-eye/gbcount.php:20) in /mnt/home3/b/ba/banan289/public_html/m-eye/gbcount.php on line 25
__________________
|
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > recording number of clicks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|