[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> redirect.php (source)

   1  <?php
   2  /*

   3  $Id: redirect.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    switch ($HTTP_GET_VARS['action']) {
  16      case 'banner':
  17        $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");
  18        if (tep_db_num_rows($banner_query)) {
  19          $banner = tep_db_fetch_array($banner_query);
  20          tep_update_banner_click_count($HTTP_GET_VARS['goto']);
  21  
  22          tep_redirect($banner['banners_url']);
  23        }
  24        break;
  25  
  26      case 'url':
  27        if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) {
  28  // BOF: MS2 update 501112-Added

  29          $check_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_url = '" . tep_db_input($HTTP_GET_VARS['goto']) . "' limit 1");
  30          if (tep_db_num_rows($check_query)) {
  31  // EOF: MS2 update 501112-Added

  32            tep_redirect('http://' . $HTTP_GET_VARS['goto']);
  33  // Line Added: MS2 update 501112

  34          }
  35        }
  36        break;
  37  
  38      case 'arturl':
  39        if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) {
  40          $check_query = tep_db_query("select articles_url from " . TABLE_ARTICLES_DESCRIPTION . " where articles_url = '" . tep_db_input($HTTP_GET_VARS['goto']) . "' limit 1");
  41          if (tep_db_num_rows($check_query)) {
  42            tep_redirect('http://' . $HTTP_GET_VARS['goto']);
  43          }
  44        }
  45        break;
  46  
  47      case 'manufacturer':
  48        if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
  49          $manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");
  50          if (tep_db_num_rows($manufacturer_query)) {
  51  // url exists in selected language

  52            $manufacturer = tep_db_fetch_array($manufacturer_query);
  53  
  54            if (tep_not_null($manufacturer['manufacturers_url'])) {
  55              tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");
  56  
  57              tep_redirect($manufacturer['manufacturers_url']);
  58            }
  59          } else {
  60  // no url exists for the selected language, lets use the default language then

  61            $manufacturer_query = tep_db_query("select mi.languages_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_LANGUAGES . " l where mi.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and mi.languages_id = l.languages_id and l.code = '" . DEFAULT_LANGUAGE . "'");
  62            if (tep_db_num_rows($manufacturer_query)) {
  63              $manufacturer = tep_db_fetch_array($manufacturer_query);
  64  
  65              if (tep_not_null($manufacturer['manufacturers_url'])) {
  66                tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$manufacturer['languages_id'] . "'");
  67  
  68                tep_redirect($manufacturer['manufacturers_url']);
  69              }
  70            }
  71          }
  72        }
  73        break;
  74    }
  75  
  76    tep_redirect(tep_href_link(FILENAME_DEFAULT));
  77  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7