hpdl
|
1
|
1
|
<?php
|
|
2
|
/*
|
hpdl
|
21
|
3
|
$Id: redirect.php 824 2006-08-29 11:09:15Z hpdl $
|
hpdl
|
1
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
hpdl
|
448
|
8
|
Copyright (c) 2006 osCommerce
|
hpdl
|
1
|
9
|
|
|
10
|
Released under the GNU General Public License
|
|
11
|
*/
|
|
12
|
|
hpdl
|
824
|
13
|
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
|
|
14
|
|
hpdl
|
1
|
15
|
require('includes/application_top.php');
|
|
16
|
|
|
17
|
switch ($_GET['action']) {
|
|
18
|
case 'banner':
|
|
19
|
if (isset($_GET['goto']) && is_numeric($_GET['goto'])) {
|
|
20
|
if ($osC_Services->isStarted('banner') && $osC_Banner->isActive($_GET['goto'])) {
|
hpdl
|
757
|
21
|
osc_redirect($osC_Banner->getURL($_GET['goto'], true));
|
hpdl
|
1
|
22
|
}
|
|
23
|
}
|
|
24
|
break;
|
|
25
|
|
|
26
|
case 'url':
|
hpdl
|
757
|
27
|
if (isset($_GET['goto']) && !empty($_GET['goto'])) {
|
hpdl
|
448
|
28
|
$Qcheck = $osC_Database->query('select products_url from :table_products_description where products_url = :products_url limit 1');
|
|
29
|
$Qcheck->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
|
|
30
|
$Qcheck->bindValue(':products_url', $_GET['goto']);
|
|
31
|
$Qcheck->execute();
|
|
32
|
|
|
33
|
if ($Qcheck->numberOfRows() === 1) {
|
hpdl
|
757
|
34
|
osc_redirect('http://' . $HTTP_GET_VARS['goto']);
|
hpdl
|
448
|
35
|
}
|
hpdl
|
1
|
36
|
}
|
|
37
|
break;
|
|
38
|
|
|
39
|
case 'manufacturer':
|
hpdl
|
757
|
40
|
if (isset($_GET['manufacturers_id']) && !empty($_GET['manufacturers_id'])) {
|
hpdl
|
21
|
41
|
$Qmanufacturer = $osC_Database->query('select manufacturers_url from :table_manufacturers_info where manufacturers_id = :manufacturers_id and languages_id = :languages_id');
|
|
42
|
$Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
|
|
43
|
$Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
|
hpdl
|
383
|
44
|
$Qmanufacturer->bindInt(':languages_id', $osC_Language->getID());
|
hpdl
|
21
|
45
|
$Qmanufacturer->execute();
|
hpdl
|
1
|
46
|
|
hpdl
|
757
|
47
|
if ($Qmanufacturer->numberOfRows() && !osc_empty($Qmanufacturer->value('manufacturers_url'))) {
|
hpdl
|
21
|
48
|
$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');
|
|
49
|
$Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
|
|
50
|
$Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
|
hpdl
|
383
|
51
|
$Qupdate->bindInt(':languages_id', $osC_Language->getID());
|
hpdl
|
21
|
52
|
$Qupdate->execute();
|
hpdl
|
1
|
53
|
|
hpdl
|
757
|
54
|
osc_redirect($Qmanufacturer->value('manufacturers_url'));
|
hpdl
|
1
|
55
|
} else {
|
|
56
|
// no url exists for the selected language, lets use the default language then
|
hpdl
|
21
|
57
|
$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');
|
|
58
|
$Qmanufacturer->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
|
|
59
|
$Qmanufacturer->bindTable(':table_languages', TABLE_LANGUAGES);
|
|
60
|
$Qmanufacturer->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
|
|
61
|
$Qmanufacturer->bindValue(':code', DEFAULT_LANGUAGE);
|
|
62
|
$Qmanufacturer->execute();
|
hpdl
|
1
|
63
|
|
hpdl
|
757
|
64
|
if ($Qmanufacturer->numberOfRows() && !osc_empty($Qmanufacturer->value('manufacturers_url'))) {
|
hpdl
|
21
|
65
|
$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');
|
|
66
|
$Qupdate->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
|
|
67
|
$Qupdate->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
|
|
68
|
$Qupdate->bindInt(':languages_id', $Qmanufacturer->valueInt('languages_id'));
|
|
69
|
$Qupdate->execute();
|
hpdl
|
1
|
70
|
|
hpdl
|
757
|
71
|
osc_redirect($Qmanufacturer->value('manufacturers_url'));
|
hpdl
|
1
|
72
|
}
|
|
73
|
}
|
|
74
|
}
|
|
75
|
break;
|
|
76
|
}
|
|
77
|
|
hpdl
|
757
|
78
|
osc_redirect(osc_href_link(FILENAME_DEFAULT));
|
hpdl
|
1
|
79
|
?>
|