home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 90 / PIWD90.iso / pc / contents / ecommerce / software / osCommerce.exe / oscommerce-2.2ms2 / catalog / includes / counter.php < prev    next >
PHP Script  |  2003-02-10  |  980b  |  29 lines

  1. <?php
  2. /*
  3.   $Id: counter.php,v 1.5 2003/02/10 22:30:52 hpdl Exp $
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2003 osCommerce
  9.  
  10.   Released under the GNU General Public License
  11. */
  12.  
  13.   $counter_query = tep_db_query("select startdate, counter from " . TABLE_COUNTER);
  14.  
  15.   if (!tep_db_num_rows($counter_query)) {
  16.     $date_now = date('Ymd');
  17.     tep_db_query("insert into " . TABLE_COUNTER . " (startdate, counter) values ('" . $date_now . "', '1')");
  18.     $counter_startdate = $date_now;
  19.     $counter_now = 1;
  20.   } else {
  21.     $counter = tep_db_fetch_array($counter_query);
  22.     $counter_startdate = $counter['startdate'];
  23.     $counter_now = ($counter['counter'] + 1);
  24.     tep_db_query("update " . TABLE_COUNTER . " set counter = '" . $counter_now . "'");
  25.   }
  26.  
  27.   $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));
  28. ?>
  29.