iTx Technologies offre gratuitement
cet espace pour OsCommerce !

title

Body

[fermer]

/ -> redirect.php (source)

   1  <?php
   2  /*
   3    $Id$
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2007 osCommerce
   9  
  10    This program is free software; you can redistribute it and/or modify
  11    it under the terms of the GNU General Public License v2 (1991)
  12    as published by the Free Software Foundation.
  13  */
  14  
  15    $_SERVER['SCRIPT_FILENAME'] = __FILE__;
  16  
  17    require ('includes/application_top.php');
  18  
  19    switch ($_GET['action']) {
  20      case 'banner':
  21        if (isset($_GET['goto']) && is_numeric($_GET['goto'])) {
  22          if ($osC_Services->isStarted('banner') && $osC_Banner->isActive($_GET['goto'])) {
  23            osc_redirect($osC_Banner->getURL($_GET['goto'], true));
  24          }
  25        }
  26        break;
  27  
  28      case 'url':
  29        if (isset($_GET['goto']) && !empty($_GET['goto'])) {
  30          $Qcheck = $osC_Database->query('select products_url from :table_products_description where products_url = :products_url limit 1');
  31          $Qcheck->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
  32          $Qcheck->bindValue(':products_url', $_GET['goto']);
  33          $Qcheck->execute();
  34  
  35          if ($Qcheck->numberOfRows() === 1) {
  36            osc_redirect('http://' . $_GET['goto']);
  37          }
  38        }
  39        break;
  40  
  41      case 'manufacturer':
  42        if (isset($_GET['manufacturers_id']) && !empty($_GET['manufacturers_id'])) {
  43          $Qmanufacturer = $osC_Database->query('select manufacturers_url from :table_manufacturers_info where manufacturers_id = :manufacturers_id and languages_id = :languages_id');
  44          $Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
  45          $Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
  46          $Qmanufacturer->bindInt(':languages_id', $osC_Language->getID());
  47          $Qmanufacturer->execute();
  48  
  49          if ($Qmanufacturer->numberOfRows() && !osc_empty($Qmanufacturer->value('manufacturers_url'))) {
  50            $Qupdate = $osC_Database->query('update :table_manufacturers_info set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = :manufacturers_id and languages_id = :languages_id');
  51            $Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
  52            $Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
  53            $Qupdate->bindInt(':languages_id', $osC_Language->getID());
  54            $Qupdate->execute();
  55  
  56            osc_redirect($Qmanufacturer->value('manufacturers_url'));
  57          } else {
  58  // no url exists for the selected language, lets use the default language then
  59            $Qmanufacturer = $osC_Database->query('select mi.languages_id, mi.manufacturers_url from :table_manufacturers_info mi, :table_languages l where mi.manufacturers_id = :manufacturers_id and mi.languages_id = l.languages_id and l.code = :code');
  60            $Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
  61            $Qmanufacturer->bindTable(':table_languages', TABLE_LANGUAGES);
  62            $Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
  63            $Qmanufacturer->bindValue(':code', DEFAULT_LANGUAGE);
  64            $Qmanufacturer->execute();
  65  
  66            if ($Qmanufacturer->numberOfRows() && !osc_empty($Qmanufacturer->value('manufacturers_url'))) {
  67              $Qupdate = $osC_Database->query('update :table_manufacturers_info set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = :manufacturers_id and languages_id = :languages_id');
  68              $Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
  69              $Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
  70              $Qupdate->bindInt(':languages_id', $Qmanufacturer->valueInt('languages_id'));
  71              $Qupdate->execute();
  72  
  73              osc_redirect($Qmanufacturer->value('manufacturers_url'));
  74            }
  75          }
  76        }
  77        break;
  78    }
  79  
  80    osc_redirect(osc_href_link(FILENAME_DEFAULT));
  81  ?>


Generé en: Wed Mar 3 09:51:02 2010 | Cross-referenced par PHPXref 0.7