[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 banner_statistics.php

Zen Cart 源代码 banner_statistics.php




下载文件

文件名: banner_statistics.php
文件类型: PHP文件
文件大小: 8.93 KiB
MD5: cd297ace69a346eb5de3db35a0947a6d

banner_statistics.php - 关闭高亮
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // |zen-cart Open Source E-commerce                                       |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 2003 The zen-cart developers                           |
  7. // |                                                                      |
  8. // | http://www.zen-cart.com/index.php                                    |
  9. // |                                                                      |
  10. // | Portions Copyright (c) 2003 osCommerce                               |
  11. // +----------------------------------------------------------------------+
  12. // | This source file is subject to version 2.0 of the GPL license,       |
  13. // | that is bundled with this package in the file LICENSE, and is        |
  14. // | available through the world-wide-web at the following url:           |
  15. // | http://www.zen-cart.com/license/2_0.txt.                             |
  16. // | If you did not receive a copy of the zen-cart license and are unable |
  17. // | to obtain it through the world-wide-web, please send a note to       |
  18. // | license@zen-cart.com so we can mail you a copy immediately.          |
  19. // +----------------------------------------------------------------------+
  20. //  $Id: banner_statistics.php 1969 2005-09-13 06:57:21Z drbyte $
  21. //
  22.  
  23.  
  24.   require('includes/application_top.php');
  25.  
  26.   $type = (isset($_GET['type']) ? $_GET['type'] : '');
  27.  
  28.   $banner_extension = zen_banner_image_extension();
  29.  
  30. // check if the graphs directory exists
  31.   $dir_ok = false;
  32.   if (function_exists('imagecreate') && zen_not_null($banner_extension)) {
  33.     if (is_dir(DIR_WS_IMAGES . 'graphs')) {
  34.       if (is_writeable(DIR_WS_IMAGES . 'graphs')) {
  35.         $dir_ok = true;
  36.       } else {
  37.         $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
  38.       }
  39.     } else {
  40.       $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
  41.     }
  42.   }
  43.  
  44.   $banner = $db->Execute("select banners_title
  45.                                from " . TABLE_BANNERS . "
  46.                                where banners_id = '" . (int)$_GET['bID'] . "'");
  47.  
  48.   $years_array = array();
  49.   $years = $db->Execute("select distinct year(banners_history_date) as banner_year
  50.                              from " . TABLE_BANNERS_HISTORY . "
  51.                              where banners_id = '" . (int)$_GET['bID'] . "'");
  52.   while (!$years->EOF) {
  53.     $years_array[] = array('id' => $years->fields['banner_year'],
  54.                            'text' => $years->fields['banner_year']);
  55.     $years->MoveNext();
  56.   }
  57.  
  58.   $months_array = array();
  59.   for ($i=1; $i<13; $i++) {
  60.     $months_array[] = array('id' => $i,
  61.                             'text' => strftime('%B', mktime(0,0,0,$i)));
  62.   }
  63.  
  64.   $type_array = array(array('id' => 'daily',
  65.                             'text' => STATISTICS_TYPE_DAILY),
  66.                       array('id' => 'monthly',
  67.                             'text' => STATISTICS_TYPE_MONTHLY),
  68.                       array('id' => 'yearly',
  69.                             'text' => STATISTICS_TYPE_YEARLY));
  70. ?>
  71. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  72. <html <?php echo HTML_PARAMS; ?>>
  73. <head>
  74. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  75. <title><?php echo TITLE; ?></title>
  76. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  77. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  78. <script language="javascript" src="includes/menu.js"></script>
  79. <script type="text/javascript">
  80.   <!--
  81.   function init()
  82.   {
  83.     cssjsmenu('navbar');
  84.     if (document.getElementById)
  85.     {
  86.       var kill = document.getElementById('hoverJS');
  87.       kill.disabled = true;
  88.     }
  89.   }
  90.   // -->
  91. </script>
  92. </head>
  93. <body onload="init()">
  94. <!-- header //-->
  95. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  96. <!-- header_eof //-->
  97.  
  98. <!-- body //-->
  99. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  100.   <tr>
  101. <!-- body_text //-->
  102.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  103.       <tr>
  104.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  105.           <tr><?php echo zen_draw_form('year', FILENAME_BANNER_STATISTICS, '', 'get'); ?>
  106.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  107.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', '1', HEADING_IMAGE_HEIGHT); ?></td>
  108.             <td class="main" align="right"><?php echo TITLE_TYPE . ' ' . zen_draw_pull_down_menu('type', $type_array, (zen_not_null($type) ? $type : 'daily'), 'onChange="this.form.submit();"'); ?><noscript><input type="submit" value="GO"></noscript><br>
  109. <?php
  110.   switch ($type) {
  111.     case 'yearly': break;
  112.     case 'monthly':
  113.       echo TITLE_YEAR . ' ' . zen_draw_pull_down_menu('year', $years_array, (isset($_GET['year']) ? $_GET['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>';
  114.       break;
  115.     default:
  116.     case 'daily':
  117.       echo TITLE_MONTH . ' ' . zen_draw_pull_down_menu('month', $months_array, (isset($_GET['month']) ? $_GET['month'] : date('n')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript><br>' . TITLE_YEAR . ' ' . zen_draw_pull_down_menu('year', $years_array, (isset($_GET['year']) ? $_GET['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>';
  118.       break;
  119.   }
  120. ?>
  121.             </td>
  122.           <?php echo zen_hide_session_id() . zen_draw_hidden_field('page', $_GET['page']) . zen_draw_hidden_field('bID', $_GET['bID']); ?></form></tr>
  123.         </table></td>
  124.       </tr>
  125.       <tr>
  126.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  127.       </tr>
  128.       <tr>
  129.         <td class="main" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  130.       </tr>
  131.       <tr>
  132.         <td align="center">
  133. <?php
  134.   if (function_exists('imagecreate') && ($dir_ok == true) && zen_not_null($banner_extension)) {
  135.     $banner_id = (int)$_GET['bID'];
  136.  
  137.     switch ($type) {
  138.       case 'yearly':
  139.         include(DIR_WS_INCLUDES . 'graphs/banner_yearly.php');
  140.         echo zen_image(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banner_id . '.' . $banner_extension);
  141.         break;
  142.       case 'monthly':
  143.         include(DIR_WS_INCLUDES . 'graphs/banner_monthly.php');
  144.         echo zen_image(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banner_id . '.' . $banner_extension);
  145.         break;
  146.       default:
  147.       case 'daily':
  148.         include(DIR_WS_INCLUDES . 'graphs/banner_daily.php');
  149.         echo zen_image(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banner_id . '.' . $banner_extension);
  150.         break;
  151.     }
  152. ?>
  153.           <table border="0" width="600" cellspacing="0" cellpadding="2">
  154.             <tr class="dataTableHeadingRow">
  155.              <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_SOURCE; ?></td>
  156.              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VIEWS; ?></td>
  157.              <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CLICKS; ?></td>
  158.            </tr>
  159. <?php
  160.     for ($i=0, $n=sizeof($stats); $i<$n; $i++) {
  161.       echo '            <tr class="dataTableRow">' . "\n" .
  162.            '              <td class="dataTableContent">' . $stats[$i][0] . '</td>' . "\n" .
  163.            '              <td class="dataTableContent" align="right">' . number_format($stats[$i][1]) . '</td>' . "\n" .
  164.            '              <td class="dataTableContent" align="right">' . number_format($stats[$i][2]) . '</td>' . "\n" .
  165.            '            </tr>' . "\n";
  166.     }
  167. ?>
  168.           </table>
  169. <?php
  170.   } else {
  171.     include(DIR_WS_FUNCTIONS . 'html_graphs.php');
  172.  
  173.     switch ($type) {
  174.       case 'yearly':
  175.         echo zen_banner_graph_yearly($_GET['bID']);
  176.         break;
  177.       case 'monthly':
  178.         echo zen_banner_graph_monthly($_GET['bID']);
  179.         break;
  180.       default:
  181.       case 'daily':
  182.         echo zen_banner_graph_daily($_GET['bID']);
  183.         break;
  184.     }
  185.   }
  186. ?>
  187.         </td>
  188.       </tr>
  189.       <tr>
  190.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  191.       </tr>
  192.       <tr>
  193.         <td class="main" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  194.       </tr>
  195.     </table></td>
  196. <!-- body_text_eof //-->
  197.   </tr>
  198. </table>
  199. <!-- body_eof //-->
  200.  
  201. <!-- footer //-->
  202. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  203. <!-- footer_eof //-->
  204. <br>
  205. </body>
  206. </html>
  207. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron