Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #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
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,223 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 32 m 57 sec
Reputation Power: 174
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


Reply With Quote
  #3  
Old August 31st, 2003, 07:34 PM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,223 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 32 m 57 sec
Reputation Power: 174
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: 277 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 42 m 30 sec
Reputation Power: 5
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: 277 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 42 m 30 sec
Reputation Power: 5
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: 277 Wite_Noiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 42 m 30 sec
Reputation Power: 5
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: 6
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


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway