<?php chdir('../common'); require_once 'init.php'; chdir('../database'); require_once 'plataform.php'; chdir('../pages'); if (!isset($_SESSION["id"])) { header("Location: index.php"); } else { if ($_SESSION["permission"] == "merchant") { header("Location: stores.php"); } } // Last merchants $lastMerchants = getMerchants(); $lastMerchants = array_slice($lastMerchants, 0, 5); $smarty->assign('lastMerchants', $lastMerchants); // Stores profits $storesProfits = getStoresProfits('2010-01-01', '2014-01-01'); $storesProfits = array_slice($storesProfits, 0, 3); $smarty->assign('storesProfits', $storesProfits); // Get last stores logos $storesLogos = getStoresLogos(); $storesLogos = array_slice($storesLogos, 0, 3); // Update paths function updatePath($elem) { if ($elem["filename"] != 'imageurl') { $elem["file"] = "../files/" . $elem["file"]; }
<?php chdir('../common'); require_once 'init.php'; chdir('../database'); require_once 'plataform.php'; chdir('../pages'); if (isset($_SESSION['permission']) and $_SESSION['permission'] == 'admin') { $merchants = getMerchants(); $total = count($merchants); $smarty->assign('title', 'Merchants'); $smarty->assign('loggedin', isset($_SESSION['id'])); $smarty->assign('merchants', $merchants); $smarty->assign('total', $total); $smarty->assign('user', $_SESSION["name"]); $smarty->assign('permission', $_SESSION['permission']); $smarty->display('merchants.tpl'); } else { header("Location: index.php"); }