static function isAdmin() { return User::authSession() && $_SESSION['user']->rol == 1; }
<?php /** * Api de Consultas de Cedulas Venezolanas - Modulo de Pasarela de Pago * * @author Kijam Lopez <*****@*****.**> * @copyright 2015 Desarrollos Cuado C.A. * @license GPLv3 */ include_once "./lib/classDBAndUser.php"; include_once "./lib/mercadopagove.php"; $isLogin = User::authSession(); if (!$isLogin) { header('location: login.php?nologin'); exit; } $user = $_SESSION['user']; $error = false; $msj = false; $service = false; $plan_db = false; if ($_GET['currency'] != 'VEF' && $_GET['currency'] != 'USD') { $error = 'La moneda seleccionada no esta soportada por nuestro sistema'; } if (!isset($_GET['id_plan']) || (int) $_GET['id_plan'] < 1) { $error = 'Debe seleccionar un plan.'; } $country = getGeoip(); if ($_GET['currency'] == 'VEF' && ($user->country != 'VE' || $country != 'VE')) { $error = 'Se ha detectado que usted se encuentra en ' . getCountries($user->country != 'VE' ? $user->country : $country) . ', usted sólo puede pagar en U$D.'; }
$isAdministrator = false; if (isset($_POST['user']) && isset($_POST['pass'])) { if (User::validpass($_POST['user'], $_POST['pass'])) { User::login($_POST['user'], $_POST['pass']); if (!User::isAdmin()) { $eMsj = "Esta cuenta no esta autorizada para utilizar esta seccion"; User::logOut(); } else { $isLogin = true; $isAdministrator = true; } } else { $eMsj = "Usuario o contraseña invalida"; } } if (User::authSession()) { $isLogin = true; if (User::isAdmin()) { $isAdministrator = true; } } $isAccess = $isLogin && $isAdministrator; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/redmond/jquery-ui.css" /> <link rel="stylesheet" type="text/css" href="css/main.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>