Links

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
alsaffar
Forum Newbie
Posts: 16
Joined: Sun Sep 29, 2002 12:03 pm

Links

Post by alsaffar »

Hi everyone,

If I have a link to php or html or ram or rm or a link to anything, how can I count number of hitting that link?

In another way, if I hit one link, how can I execute a code in anoter page? while I'm linking to a realplayer file for example.

Example:

<a href="/Media/Test.rm">Download file</a>

I hope that my problem is clear :)

Thanks in advance for any help provided.
stickman373
Forum Commoner
Posts: 30
Joined: Mon Jul 22, 2002 10:26 am

Post by stickman373 »

make a script like this:

http://www.site.com/tracker.php?link=ht ... ia/Test.rm

Code: Select all

mysql_connect(...);
$results = mysql_query("SELECT * FROM database WHERE sitename='" . $_REQUEST['link'] . "'");

    $count = $result['hits'] + 1;
    mysql_query("UPDATE ... SET hits='$count' WHERE ...");


header("Location: " . $_REQUEST['link']);
that code wont really work, but its the basic idea of how to count the click if u store the info in mysql database :wink:
CONFIQ
Forum Commoner
Posts: 32
Joined: Fri Oct 18, 2002 3:39 pm
Location: Israel - Raanana

Post by CONFIQ »

stickman373 wrote: mysql_query("UPDATE ... SET hits='$count' WHERE ...");
Offtopic: Just to tip you... next time use
mysql_query("update ... set hits=hits+1 where ....");

so you won't need this part of code

Code: Select all

$results = mysql_query("SELECT * FROM database WHERE sitename='" . $_REQUEST['link'] . "'"); 
    $count = $result['hits'] + 1;
Post Reply