Page 1 of 1

Links

Posted: Sun Dec 08, 2002 11:56 am
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.

Posted: Sun Dec 08, 2002 4:01 pm
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:

Posted: Sun Dec 08, 2002 5:20 pm
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;