SLAMPPLiveCD : DownloadStats

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2005-10-31 17:51:53 by KemasAntonius

Additions:
<em class="error">Unknown action "dcounter"</em>

Deletions:




Edited on 2005-10-31 17:29:01 by KemasAntonius

Additions:


Deletions:




Edited on 2005-10-31 17:28:47 by KemasAntonius

Additions:


Deletions:




Edited on 2005-10-31 17:19:26 by KemasAntonius

Deletions:
  1. <?php
  2. ######################################################################
  3. ######################################################################
  4. ###                                                                ###
  5. ###   Download Counter                            Version 0.95   ###
  6. ###   Copyright 2004 Eljee Bergwerff               php@eljee.com   ###
  7. ###   Created 10-2004                      Last Modified   Today   ###
  8. ###   Scripts Name:                       download_counter.php   ###
  9. ###                                                                ###
  10. ######################################################################
  11. ######################################################################
  12. //This is a basic DOWNLOAD COUNTER script created with simplicity in mind.
  13. //
  14. //features:     -Add a link behind the script and it will start counting that link directly. No additional setup
  15. //        -Overview table with links and download counts
  16. //        -Easy removal and resetting of download counters
  17. //        -Very easy setup, just change some variables and off you go
  18. //        -One single file with setup function
  19. //        -Counts as much files as you want
  20. //        -Downloaders will not notice anything
  21. //
  22. //instructions: -First edit the MySQL data below to reflect your mysql settings.
  23. //        -Run http://www.yourdomain.com/download_counter.php?file=setup
  24. //        -done!
  25. //
  26. //usage:        -add a link behind the 'file=' like this:
  27. //        http://www.yourdomain.com/download_counter.php?file=http://www.foo.bar/program.zip
  28. //        -A new record for http://www.foo.bar/program.zip will be created automaticly and counting will begin
  29. //        -go to http://www.yourdomain.com/download_counter.php to view the counters!
  30. // MySQL data
  31. $db_host = "localhost";   //Mysql Host
  32. $db_login = "kemas";            //Mysql username
  33. $db_pass = "kemas1980";   //Mysql password
  34. $db_name = "slampp";    //Mysql database This can be a existing database.
  35.                                 //If so, take a look at the Table Name $db_table_files to make sure it doesn't conflict with a existing table
  36.                                 //If the database doesn't exist the script wil try to create one
  37. //Webmaster Email
  38. $webmaster_email = "kyantonius@kyantonius.com";
  39. //Table and Fields data
  40. //There is no need to change this, just in case you want to
  41. $db_table_files         = "files_counter";
  42. $db_files_id            = "id";
  43. $db_files_link_url   = "link_url";
  44. $db_files_link_total    = "link_total";
  45. $db_files_link_date  = "link_date";
  46. //In case anything went wrong with the setup of the tables you can create them manually also:
  47.                         //
  48.                         //      CREATE DATABASE `download_counter`;
  49.                         //      USE download_counter;
  50.                         //
  51.                         //      CREATE TABLE `files` (
  52.                         //        `id` int(5) NOT NULL auto_increment,
  53.                         //        `link_url` varchar(255) NOT NULL default '',
  54.                         //        `link_total` varchar(10) NOT NULL default '0',
  55.                         //        `link_date` datetime NOT NULL default '0000-00-00 00:00:00',
  56.                         //        PRIMARY KEY  (`id`),
  57.                         //        UNIQUE KEY `link_url` (`link_url`)
  58.                         //      ) TYPE=MyISAM AUTO_INCREMENT=1;
  59. ####################################################################################
  60. //do not change anything below this line (if you don't need to..)
  61. $file = $_GET[file];
  62. #####################
  63. #Open DB
  64. #####################
  65.     $db=0;
  66.     openDB();
  67. #####################
  68. #dertimine what to do
  69. #####################
  70. if ($file == '')        {showlist();exit;}
  71. if ($file == 'list')    {showlist();exit;}
  72. if ($file == 'delete')  {delete($_GET[id]);showlist();exit;}
  73. if ($file == 'reset_counter')   {reset_counter($_GET[id]);showlist();exit;}
  74. if ($file == 'setup')   {setup();showlist();exit;}
  75. #####################
  76. #Check if this is a new link
  77. #####################
  78.     $query = "SELECT * FROM `$db_table_files` WHERE `$db_files_link_url` = '$file'";
  79.     $result=mysql_query($query);
  80.     $output = mysql_fetch_array($result);
  81.     if (!($output)) {addnewlink();header("Location: http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$file"); exit;}
  82.     else            {addcouter($output[$db_files_id],$output[$db_files_link_total]);
  83.                         if ($succes){header("Location: $file"); exit;}
  84.                         else{echo"Error: Please email $webmaster_email";}
  85.     exit;
  86.     }
  87. #####################
  88. #Functions
  89. #####################
  90. //ADD NEW LINK after has been checked if the link in the URL is already present in the database a new record will be added.
  91. //This new record will contain the link, the add date and the amount of downloads
  92. function addnewlink(){
  93.     global $db_table_files,$db_files_link_url,$file,$db_files_link_date;
  94.     $insertorupdate = "insert";
  95.     $now = date( "Y-m-d H-i-s");
  96.     $data = array("$db_files_link_url"=>"$file","$db_files_link_date"=>"$now");
  97.     safe($insertorupdate,$db_table_files,$data,$id);
  98. }
  99. //AAD COUNTER will read the amount of downloads of a link, add one and safe it again to the database
  100. function addcouter($id,$link_total){
  101.     global $db_table_files,$db_files_link_total;
  102.     $link_total++;
  103.     $data = array("$db_files_link_total"=>"$link_total");
  104.     safe(update,$db_table_files,$data,$id);
  105. }
  106. //SAFE this is a insert or update function to make adding things to the database a bit more easy.
  107. function safe($insertorupdate,$table,$data,$id){
  108.             global $webmaster_email;
  109.             if ($insertorupdate == "insert")
  110.                     {
  111.                     $insertorupdate = "insert into $table";
  112.                     foreach($data as $k => $v) {
  113.                                         $keystring .="`$k`, ";
  114.                                         $v=addslashes($v);
  115.                                         $valuestring .= "'$v', ";
  116.                                         }
  117.                                 $valuestring = substr("$valuestring", 0, -2);
  118.                                 $keystring = substr("$keystring", 0, -2);
  119.                     $data = "($keystring) VALUES ($valuestring)";
  120.                     }
  121.             else
  122.                     {
  123.                     $insertorupdate = "update $table set";
  124.                     foreach($data as $k => $v) {
  125.                                         $v=addslashes($v);
  126.                                         $datastring .="$k = \"$v\", ";
  127.                                         }
  128.                                         $datastring = substr("$datastring", 0, -2);
  129.                                         $data = $datastring;
  130.                     }
  131.             if ($id == ''){$where = "";}
  132.             else{$where = "where id = '$id'";}
  133.                     $query="$insertorupdate $data $where";
  134.                     $result=mysql_query($query);
  135.                         if ($result){
  136.                         global $succes;
  137.                         $succes = 1;
  138.                         }
  139.                         else{
  140.                         echo "Error: <br>".mysql_error();
  141.                         echo "<br>Email: $webmaster_email";
  142.                         }
  143.     return;
  144.     }
  145. //OPEN DB a function to make the connection to the database
  146. function openDB()
  147.     {   global $db,$db_host,$db_login,$db_pass,$db_name;
  148.         $db=mysql_connect("$db_host","$db_login","$db_pass");
  149.         mysql_select_db("$db_name",$db);
  150.     }
  151. //SHOWLIST reads all links in the database and print them in a table with links to reset or delete the link.
  152. //It will also show the amount of downloads
  153. function showlist()
  154.     {
  155.         global  $db_table_files,
  156.                 $db_files_link_url,
  157.                 $db_files_link_total,
  158.              $db_files_link_date,
  159.              $db_files_id;
  160.             $result=mysql_query("SELECT * FROM `$db_table_files`");
  161.             echo mysql_error();
  162.             echo "<table border=1 width=100% cellspacing=0 bordercolor=#C5C5C5><tr>";
  163.             echo "<b>Download Counter</b><br> <td><b>[Url]</b></td><td><b>[Downloads]</b></td></tr>\r\n";
  164.             echo "<font size=1>";
  165.             while ($row=mysql_fetch_array($result))
  166.             {
  167.                 $url_array = split('[/]', $row[$db_files_link_url]);
  168.                 $url_array = array_reverse($url_array);
  169.                 list($db_files_link_file) = $url_array;
  170.                 echo "";
  171.                 echo "<td><a href=\"http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$row[$db_files_link_url]\">$row[$db_files_link_url]</a></td>\r\n";
  172.                 if ($row[$db_files_link_total]  == 1){$s="";}else{$s="s";}
  173.                 echo "<td>$row[$db_files_link_total] time$s since $row[$db_files_link_date]</td>\r\n";
  174.                 echo "</tr>";
  175.             }
  176.         echo "</table>";
  177.     }
  178. ?>




Edited on 2005-10-31 17:19:02 by KemasAntonius

Additions:
  1. <?php
  2.  
  3. ######################################################################
  4. ######################################################################
  5. ###                                                                ###
  6. ###   Download Counter                            Version 0.95   ###
  7. ###   Copyright 2004 Eljee Bergwerff               php@eljee.com   ###
  8. ###   Created 10-2004                      Last Modified   Today   ###
  9. ###   Scripts Name:                       download_counter.php   ###
  10. ###                                                                ###
  11. ######################################################################
  12. ######################################################################
  13.  
  14. //This is a basic DOWNLOAD COUNTER script created with simplicity in mind.
  15. //
  16. //features:     -Add a link behind the script and it will start counting that link directly. No additional setup
  17. //        -Overview table with links and download counts
  18. //        -Easy removal and resetting of download counters
  19. //        -Very easy setup, just change some variables and off you go
  20. //        -One single file with setup function
  21. //        -Counts as much files as you want
  22. //        -Downloaders will not notice anything
  23. //
  24. //instructions: -First edit the MySQL data below to reflect your mysql settings.
  25. //        -Run http://www.yourdomain.com/download_counter.php?file=setup
  26. //        -done!
  27. //
  28. //usage:        -add a link behind the 'file=' like this:
  29. //        http://www.yourdomain.com/download_counter.php?file=http://www.foo.bar/program.zip
  30. //        -A new record for http://www.foo.bar/program.zip will be created automaticly and counting will begin
  31. //        -go to http://www.yourdomain.com/download_counter.php to view the counters!
  32.  
  33.  
  34.  
  35.  
  36.  
  37. // MySQL data
  38. $db_host = "localhost";   //Mysql Host
  39. $db_login = "kemas";            //Mysql username
  40. $db_pass = "kemas1980";   //Mysql password
  41. $db_name = "slampp";    //Mysql database This can be a existing database.
  42.                                 //If so, take a look at the Table Name $db_table_files to make sure it doesn't conflict with a existing table
  43.                                 //If the database doesn't exist the script wil try to create one
  44.  
  45. //Webmaster Email
  46. $webmaster_email = "kyantonius@kyantonius.com";
  47.  
  48. //Table and Fields data
  49. //There is no need to change this, just in case you want to
  50. $db_table_files         = "files_counter";
  51. $db_files_id            = "id";
  52. $db_files_link_url   = "link_url";
  53. $db_files_link_total    = "link_total";
  54. $db_files_link_date  = "link_date";
  55.  
  56.  
  57. //In case anything went wrong with the setup of the tables you can create them manually also:
  58.                         //
  59.                         //      CREATE DATABASE `download_counter`;
  60.                         //      USE download_counter;
  61.                         //
  62.                         //      CREATE TABLE `files` (
  63.                         //        `id` int(5) NOT NULL auto_increment,
  64.                         //        `link_url` varchar(255) NOT NULL default '',
  65.                         //        `link_total` varchar(10) NOT NULL default '0',
  66.                         //        `link_date` datetime NOT NULL default '0000-00-00 00:00:00',
  67.                         //        PRIMARY KEY  (`id`),
  68.                         //        UNIQUE KEY `link_url` (`link_url`)
  69.                         //      ) TYPE=MyISAM AUTO_INCREMENT=1;
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ####################################################################################
  76. //do not change anything below this line (if you don't need to..)
  77. $file = $_GET[file];
  78.  
  79. #####################
  80. #Open DB
  81. #####################
  82.  
  83.     $db=0;
  84.     openDB();
  85.  
  86. #####################
  87. #dertimine what to do
  88. #####################
  89.  
  90. if ($file == '')        {showlist();exit;}
  91. if ($file == 'list')    {showlist();exit;}
  92. if ($file == 'delete')  {delete($_GET[id]);showlist();exit;}
  93. if ($file == 'reset_counter')   {reset_counter($_GET[id]);showlist();exit;}
  94. if ($file == 'setup')   {setup();showlist();exit;}
  95.  
  96.  
  97. #####################
  98. #Check if this is a new link
  99. #####################
  100.  
  101.     $query = "SELECT * FROM `$db_table_files` WHERE `$db_files_link_url` = '$file'";
  102.     $result=mysql_query($query);
  103.     $output = mysql_fetch_array($result);
  104.  
  105.     if (!($output)) {addnewlink();header("Location: http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$file"); exit;}
  106.     else            {addcouter($output[$db_files_id],$output[$db_files_link_total]);
  107.                         if ($succes){header("Location: $file"); exit;}
  108.                         else{echo"Error: Please email $webmaster_email";}
  109.     exit;
  110.     }
  111.  
  112.  
  113. #####################
  114. #Functions
  115. #####################
  116.  
  117. //ADD NEW LINK after has been checked if the link in the URL is already present in the database a new record will be added.
  118. //This new record will contain the link, the add date and the amount of downloads
  119. function addnewlink(){
  120.     global $db_table_files,$db_files_link_url,$file,$db_files_link_date;
  121.     $insertorupdate = "insert";
  122.     $now = date( "Y-m-d H-i-s");
  123.     $data = array("$db_files_link_url"=>"$file","$db_files_link_date"=>"$now");
  124.     safe($insertorupdate,$db_table_files,$data,$id);
  125. }
  126.  
  127. //AAD COUNTER will read the amount of downloads of a link, add one and safe it again to the database
  128. function addcouter($id,$link_total){
  129.     global $db_table_files,$db_files_link_total;
  130.     $link_total++;
  131.     $data = array("$db_files_link_total"=>"$link_total");
  132.     safe(update,$db_table_files,$data,$id);
  133. }
  134.  
  135. //SAFE this is a insert or update function to make adding things to the database a bit more easy.
  136. function safe($insertorupdate,$table,$data,$id){
  137.  
  138.             global $webmaster_email;
  139.  
  140.             if ($insertorupdate == "insert")
  141.                     {
  142.                     $insertorupdate = "insert into $table";
  143.                     foreach($data as $k => $v) {
  144.                                         $keystring .="`$k`, ";
  145.                                         $v=addslashes($v);
  146.                                         $valuestring .= "'$v', ";
  147.                                         }
  148.  
  149.                                 $valuestring = substr("$valuestring", 0, -2);
  150.                                 $keystring = substr("$keystring", 0, -2);
  151.  
  152.                     $data = "($keystring) VALUES ($valuestring)";
  153.                     }
  154.             else
  155.                     {
  156.                     $insertorupdate = "update $table set";
  157.                     foreach($data as $k => $v) {
  158.                                         $v=addslashes($v);
  159.                                         $datastring .="$k = \"$v\", ";
  160.  
  161.                                         }
  162.  
  163.                                         $datastring = substr("$datastring", 0, -2);
  164.                                         $data = $datastring;
  165.                     }
  166.  
  167.             if ($id == ''){$where = "";}
  168.             else{$where = "where id = '$id'";}
  169.  
  170.                     $query="$insertorupdate $data $where";
  171.  
  172.                     $result=mysql_query($query);
  173.                         if ($result){
  174.                         global $succes;
  175.                         $succes = 1;
  176.                         }
  177.                         else{
  178.                         echo "Error: <br>".mysql_error();
  179.                         echo "<br>Email: $webmaster_email";
  180.                         }
  181.     return;
  182.     }
  183.  
  184. //OPEN DB a function to make the connection to the database
  185. function openDB()
  186.     {   global $db,$db_host,$db_login,$db_pass,$db_name;
  187.         $db=mysql_connect("$db_host","$db_login","$db_pass");
  188.         mysql_select_db("$db_name",$db);
  189.     }
  190.  
  191. //SHOWLIST reads all links in the database and print them in a table with links to reset or delete the link.
  192. //It will also show the amount of downloads
  193. function showlist()
  194.     {
  195.         global  $db_table_files,
  196.                 $db_files_link_url,
  197.                 $db_files_link_total,
  198.              $db_files_link_date,
  199.              $db_files_id;
  200.  
  201.             $result=mysql_query("SELECT * FROM `$db_table_files`");
  202.             echo mysql_error();
  203.  
  204.  
  205.             echo "<table border=1 width=100% cellspacing=0 bordercolor=#C5C5C5><tr>";
  206.             echo "<b>Download Counter</b><br> <td><b>[Url]</b></td><td><b>[Downloads]</b></td></tr>\r\n";
  207.             echo "<font size=1>";
  208.  
  209.  
  210.             while ($row=mysql_fetch_array($result))
  211.             {
  212.                 $url_array = split('[/]', $row[$db_files_link_url]);
  213.                 $url_array = array_reverse($url_array);
  214.                 list($db_files_link_file) = $url_array;
  215.  
  216.                 echo "";
  217.                 echo "<td><a href=\"http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$row[$db_files_link_url]\">$row[$db_files_link_url]</a></td>\r\n";
  218.                 if ($row[$db_files_link_total]  == 1){$s="";}else{$s="s";}
  219.                 echo "<td>$row[$db_files_link_total] time$s since $row[$db_files_link_date]</td>\r\n";
  220.                 echo "</tr>";
  221.             }
  222.  
  223.  
  224.         echo "</table>";
  225.  
  226.     }
  227.  
  228. ?>


Deletions:




Edited on 2005-10-31 16:59:23 by KemasAntonius

Additions:
<?php include('http://www.kyantonius.com/hadith/quotation.php'); ?>

Deletions:
<?php include('http://slampp.abangadek.com/download_counter.php'); ?>



Edited on 2005-10-31 16:58:40 by KemasAntonius

Additions:


Deletions:




Edited on 2005-10-31 16:52:47 by KemasAntonius

Deletions:
'$file','$db_files_link_date'=>'$now'); safe($insertorupdate,$db_table_files,$data,$id); } //ADD COUNTER will read the amount of downloads of a link, add one and safe it again to the database function addcouter($id,$link_total){ global $db_table_files,$db_files_link_total; $link_total++; $data = array('$db_files_link_total'=>'$link_total'); safe(update,$db_table_files,$data,$id); } //SAFE this is a insert or update function to make adding things to the database a bit more easy. function safe($insertorupdate,$table,$data,$id){ global $webmaster_email; if ($insertorupdate == 'insert') { $insertorupdate = 'insert into $table'; foreach($data as $k => $v) { $keystring .='`$k`, '; $v=addslashes($v); $valuestring .= ''$v', '; } $valuestring = substr('$valuestring', 0, -2); $keystring = substr('$keystring', 0, -2); $data = '($keystring) VALUES ($valuestring)'; } else { $insertorupdate = 'update $table set'; foreach($data as $k => $v) { $v=addslashes($v); $datastring .='$k = \'$v\', '; } $datastring = substr('$datastring', 0, -2); $data = $datastring; } if ($id == ''){$where = '';} else{$where = 'where id = '$id'';} $query='$insertorupdate $data $where'; $result=mysql_query($query); if ($result){ global $succes; $succes = 1; } else{ echo 'Error:
'.mysql_error(); echo '
Email: $webmaster_email'; } return; } //OPEN DB a function to make the connection to the database function openDB() { global $db,$db_host,$db_login,$db_pass,$db_name; $db=mysql_connect('$db_host','$db_login','$db_pass'); mysql_select_db('$db_name',$db); } //SHOWLIST reads all links in the database and print them in a table with links to reset or delete the link. //It will also show the amount of downloads function showlist() { global $db_table_files, $db_files_link_url, $db_files_link_total, $db_files_link_date, $db_files_id; $result=mysql_query('SELECT * FROM `$db_table_files`'); echo mysql_error(); echo ''; echo 'Download Counter
\r\n'; echo ''; while ($row=mysql_fetch_array($result)) { $url_array = split('[/]', $row[$db_files_link_url]); $url_array = array_reverse($url_array); list($db_files_link_file) = $url_array; echo ''; echo '\r\n'; if ($row[$db_files_link_total] == 1){$s='';}else{$s='s';} echo '\r\n'; echo ''; } echo '
[Url][Downloads]
$row[$db_files_link_url]$row[$db_files_link_total] time$s since $row[$db_files_link_date]
'; } ?>




Edited on 2005-10-31 16:52:30 by KemasAntonius

Additions:
$db_host = 'localhost'; Mysql Host
$db_login = 'kemas';
Mysql username
$db_pass = 'kemas1980'; Mysql password
$db_name = 'slampp';
Mysql database This can be a existing database.
$webmaster_email = 'kyantonius@kyantonius.com';
$db_table_files = 'files_counter';
$db_files_id = 'id';
$db_files_link_url = 'link_url';
$db_files_link_total = 'link_total';
$db_files_link_date = 'link_date';
$query = 'SELECT * FROM `$db_table_files` WHERE `$db_files_link_url` = '$file;
if (!($output)) {addnewlink();header('Location: http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$file'); exit;}
if ($succes){header('Location: $file'); exit;}
else{echo'Error: Please email $webmaster_email';}
$insertorupdate = 'insert';
$now = date( 'Y-m-d H-i-s');
$data = array('$db_files_link_url'=>'$file','$db_files_link_date'=>'$now');
$data = array('$db_files_link_total'=>'$link_total');
if ($insertorupdate
'insert')
$insertorupdate = 'insert into $table';
$keystring .='`$k`, ';
$valuestring .= $v', ';
$valuestring = substr('$valuestring', 0, -2);
$keystring = substr('$keystring', 0, -2);
$data = '($keystring) VALUES ($valuestring)';
$insertorupdate = 'update $table set';
$datastring .='$k = \'$v\', ';
$datastring = substr('$datastring', 0, -2);
if ($id
){$where = ;} else{$where = 'where id = '$id;}
$query='$insertorupdate $data $where';
echo 'Error: <br>'.mysql_error();
echo '<br>Email: $webmaster_email';
$db=mysql_connect('$db_host','$db_login','$db_pass');
mysql_select_db('$db_name',$db);
$result=mysql_query('SELECT * FROM `$db_table_files`');
echo '<table border=1 width=100% cellspacing=0 bordercolor=#C5C5C5><tr>';
echo '<b>Download Counter</b><br> <td><b>[Url]</b></td><td><b>[Downloads]</b></td></tr>\r\n';
echo '<font size=1>';
echo ;
echo '<td><a href=\'http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$row[$db_files_link_url]\'>$row[$db_files_link_url]</a></td>\r\n';
if ($row[$db_files_link_total]
1){$s=;}else{$s='s';} echo '<td>$row[$db_files_link_total] time$s since $row[$db_files_link_date]</td>\r\n';
echo '</tr>';
echo '</table>';


Deletions:
$db_host = "localhost"; Mysql Host
$db_login = "kemas"; Mysql username
$db_pass = "kemas1980"; Mysql password
$db_name = "slampp";
Mysql database This can be a existing database.
$webmaster_email = "kyantonius@kyantonius.com";
$db_table_files = "files_counter";
$db_files_id = "id";
$db_files_link_url = "link_url";
$db_files_link_total = "link_total";
$db_files_link_date = "link_date";
$query = "SELECT * FROM `$db_table_files` WHERE `$db_files_link_url` = '$file'";
if (!($output)) {addnewlink();header("Location: http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$file"); exit;}
if ($succes){header("Location: $file"); exit;}
else{echo"Error: Please email $webmaster_email";}
$insertorupdate = "insert";
$now = date( "Y-m-d H-i-s");
$data = array("$db_files_link_url"=>"$file","$db_files_link_date"=>"$now");
$data = array("$db_files_link_total"=>"$link_total");
if ($insertorupdate
"insert")
$insertorupdate = "insert into $table";
$keystring .="`$k`, ";
$valuestring .= "'$v', ";
$valuestring = substr("$valuestring", 0, -2);
$keystring = substr("$keystring", 0, -2);
$data = "($keystring) VALUES ($valuestring)";
$insertorupdate = "update $table set";
$datastring .="$k = \"$v\", ";
$datastring = substr("$datastring", 0, -2);
if ($id
){$where = ;} else{$where = "where id = '$id'";} $query="$insertorupdate $data $where"; echo "Error:
".mysql_error(); echo "
Email: $webmaster_email"; $db=mysql_connect("$db_host","$db_login","$db_pass"); mysql_select_db("$db_name",$db); $result=mysql_query("SELECT * FROM `$db_table_files`"); echo ""; echo "Download Counter
\r\n"; echo ""; echo
[Url][Downloads]
;
echo "<td><a href=\"http://$_SERVER[SERVER_NAME]$_SERVER[SCRIPT_NAME]?file=$row[$db_files_link_url]\">$row[$db_files_link_url]</a></td>\r\n";
if ($row[$db_files_link_total]
1){$s="";}else{$s="s";} echo "<td>$row[$db_files_link_total] time$s since $row[$db_files_link_date]</td>\r\n";
echo "</tr>";
echo "</table>";




Oldest known version of this page was edited on 2005-10-31 16:47:27 by KemasAntonius []
Page view:
"$file","$db_files_link_date"=>"$now"); safe($insertorupdate,$db_table_files,$data,$id); } //ADD COUNTER will read the amount of downloads of a link, add one and safe it again to the database function addcouter($id,$link_total){ global $db_table_files,$db_files_link_total; $link_total++; $data = array("$db_files_link_total"=>"$link_total"); safe(update,$db_table_files,$data,$id); } //SAFE this is a insert or update function to make adding things to the database a bit more easy. function safe($insertorupdate,$table,$data,$id){ global $webmaster_email; if ($insertorupdate == "insert") { $insertorupdate = "insert into $table"; foreach($data as $k => $v) { $keystring .="`$k`, "; $v=addslashes($v); $valuestring .= "'$v', "; } $valuestring = substr("$valuestring", 0, -2); $keystring = substr("$keystring", 0, -2); $data = "($keystring) VALUES ($valuestring)"; } else { $insertorupdate = "update $table set"; foreach($data as $k => $v) { $v=addslashes($v); $datastring .="$k = \"$v\", "; } $datastring = substr("$datastring", 0, -2); $data = $datastring; } if ($id == ''){$where = ;}
else{$where = "where id = '$id'";}

$query="$insertorupdate $data $where";

$result=mysql_query($query);
if ($result){
global $succes;
$succes = 1;
}
else{
echo "Error: <br>".mysql_error();
echo "<br>Email: $webmaster_email";
}
return;
}

OPEN DB a function to make the connection to the database
function openDB()
{ global $db,$db_host,$db_login,$db_pass,$db_name;
$db=mysql_connect("$db_host","$db_login","$db_pass");
mysql_select_db("$db_name",$db);
}

SHOWLIST reads all links in the database and print them in a table with links to reset or delete the link.
It will also show the amount of downloads
function showlist()
{
global $db_table_files,
$db_files_link_url,
$db_files_link_total,
$db_files_link_date,
$db_files_id;

$result=mysql_query("SELECT * FROM `$db_table_files`");
echo mysql_error();


echo "<table border=1 width=100% cellspacing=0 bordercolor=#C5C5C5><tr>";
echo "<b>Download Counter</b><br> <td><b>[Url]</b></td><td><b>[Downloads]</b></td></tr>\r\n";
echo "<font size=1>";


while ($row=mysql_fetch_array($result))
{
$url_array = split('[/]', $row[$db_files_link_url]);
$url_array = array_reverse($url_array);
list($db_files_link_file) = $url_array;

echo ; echo "$row[$db_files_link_url]\r\n"; if ($row[$db_files_link_total] == 1){$s=;}else{$s="s";}
echo "<td>$row[$db_files_link_total] time$s since $row[$db_files_link_date]</td>\r\n";
echo "</tr>";
}


echo "</table>";

}

?>
""
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.7791 seconds