Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb Site ManagementScripts

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 August 31st, 2003, 05:39 PM
amorpheus amorpheus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 amorpheus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to amorpheus Send a message via Yahoo to amorpheus
Talking recording number of clicks

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?

Reply With Quote
  #2  
Old August 31st, 2003, 07:34 PM
drgroove's Avatar
drgroove drgroove is offline
Moderator Emeritus
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Feb 2002
Location: Scottsdale, AZ
Posts: 7,174 drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Days 23 h 48 m 33 sec
Reputation Power: 2131
Moved from PHP forum to Scripts forum
__________________
DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Need ServiceNow consulting or ITIL process design? Connect with me on LinkedIn

Reply With Quote
  #3  
Old August 31st, 2003, 07:34 PM
drgroove's Avatar
drgroove drgroove is offline
Moderator Emeritus
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Feb 2002
Location: Scottsdale, AZ
Posts: 7,174 drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level)drgroove User rank is General 17th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Days 23 h 48 m 33 sec
Reputation Power: 2131
Did you check Hotscripts, Sourceforge, Google... ?

Reply With Quote
  #4  
Old September 1st, 2003, 12:48 PM
Wite_Noiz Wite_Noiz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: London, England
Posts: 279 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 17 m 28 sec
Reputation Power: 10
Re: recording number of clicks

Quote:
Originally posted by amorpheus
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?


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

Reply With Quote
  #5  
Old September 1st, 2003, 01:20 PM
amorpheus amorpheus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 amorpheus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to amorpheus Send a message via Yahoo to amorpheus
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?

Reply With Quote
  #6  
Old September 1st, 2003, 03:19 PM
Wite_Noiz Wite_Noiz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: London, England
Posts: 279 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 17 m 28 sec
Reputation Power: 10
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.
__________________
Wite_Noiz the grey


W3C | PHP | MySQL
W3Schools for HTML, XHTML, CSS and more

Reply With Quote
  #7  
Old September 1st, 2003, 06:54 PM
amorpheus amorpheus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 amorpheus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to amorpheus Send a message via Yahoo to amorpheus
it doesnt log anything to hit.txt....

Reply With Quote
  #8  
Old September 2nd, 2003, 02:15 AM
Wite_Noiz Wite_Noiz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: London, England
Posts: 279 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 17 m 28 sec
Reputation Power: 10
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.

Reply With Quote
  #9  
Old September 5th, 2003, 03:39 PM
nakulgoyal nakulgoyal is offline
Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Chandigarh, India
Posts: 33 nakulgoyal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 sec
Reputation Power: 0
Send a message via ICQ to nakulgoyal Send a message via AIM to nakulgoyal Send a message via Yahoo to nakulgoyal
Lot of click tracking scrupts out there !!at hotscripts !!

Reply With Quote
  #10  
Old November 12th, 2003, 08:32 AM
banan2 banan2 is offline
// banan2 PRIDE //
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Norway
Posts: 303 banan2 User rank is Corporal (100 - 500 Reputation Level)banan2 User rank is Corporal (100 - 500 Reputation Level)banan2 User rank is Corporal (100 - 500 Reputation Level)banan2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 14 h 57 m 46 sec
Reputation Power: 11
Send a message via AIM to banan2
Re: Re: recording number of clicks

Quote:
Originally posted by Wite_Noiz
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


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
__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > recording number of clicks

Developer Shed Advertisers and Affiliates



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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap