/
main_categories.php
executable file
·71 lines (56 loc) · 1.81 KB
/
main_categories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
#
# Copyright (c) 2007, Jassen Moran. All rights reserved.
# MongoTickets.com Confidential Proprietary.
#
require('../include/smarty_package.php');
// put full path to Smarty.class.php
require('../lib/php/Smarty/Smarty.class.php');
include('../include/host_info.inc.php');
include('../include/domain_info.inc.php');
require_once('../include/ticket_db.php');
require('DbUtils.php');
require('Utils.php');
include('../include/error.php');
require('../include/breadcrumbs.inc.php');
if((isset($_REQUEST['id']) && ($_REQUEST['id'] <= 4) && ($_REQUEST['id'] >=0)) && (isset($_REQUEST['name']) && (strlen($_REQUEST['name']) < 10) )) {
$categoryID = $_REQUEST['id'];
$categoryName = $_REQUEST['name'];
}
else {
header("Location: http://$domain/");
}
$smarty = new Smarty;
$smarty->template_dir = '../smarty/templates';
$smarty->compile_dir = '../smarty/templates_c';
$smarty->cache_dir = '../smarty/cache';
$smarty->config_dir = '../smarty/configs';
$smarty->compile_check = true;
$smarty->assign("RootUrl", $root_url);
if( $dbh=mysql_connect ($host_name, $db_username, $db_password)) {
mysql_select_db ($db_name);
$smarty->assign("CategoryName", $categoryName);
$breadcrumb_str = Breadcrumbs($categoryID, 0);
$smarty->assign("Breadcrumbs", $breadcrumb_str);
switch ($categoryID) {
case 3:
$smarty->display('sports.tpl');
break;
case 2:
$smarty->display('concerts.tpl');
break;
case 4:
$smarty->display('theater.tpl');
break;
}
mysql_close($dbh);
}
else {
$smarty->display('main.tpl');
handle_error_no_exit ('top_level_categories.code: I cannot connect to the database because: ' . mysql_error());
$error_message = get_error_message();
$smarty->assign("ErrorMessage", $error_message);
$smarty->display('error_page.tpl');
}
$smarty->display('footer.tpl');
?>