public function check_administrator() { $result = false; $username = $_SESSION['username']; if (isset($_SESSION['username'])) { $dbc = new DbConnexion(); $c = $dbc->connect(); $sql = "SELECT * FROM users where login='******'"; $result = $c->query($sql); $login = ""; $usertype = 0; while ($row = $result->fetch_assoc()) { $login = $row["login"]; $usertype = (int) $row["user_type"]; } if ($login == $username && $usertype == 1) { $result = true; } else { $result = false; } } else { $result = false; } return $result; }
<?php include '../../security/check_session.php'; include '../../config/connexion.php'; $cs = new CheckSession(); if (!$cs->check_user_session()) { header("Location:" . $_SERVER['DOCUMENT_ROOT'] . './index.php'); } $dbc = new DbConnexion(); $c = $dbc->connect(); ?> <?php include '../header.php'; ?> <!-- BEGIN PAGE CONTAINER --> <div class="page-container"> <!-- BEGIN PAGE HEAD --> <div class="page-head"> <div class="container"> <!-- BEGIN PAGE TITLE --> <div class="page-title"> <h1> Product Management <small>List, add, delete and update products</small> </h1> </div> <!-- END PAGE TITLE --> <!-- BEGIN PAGE TOOLBAR --> <div class="page-toolbar"> <!-- BEGIN THEME PANEL -->
<?php include 'security/check_session.php'; include 'config/connexion.php'; $cs = new CheckSession(); if ($cs->check_user_session()) { header("location:module/product/product-list.php"); } $dbc = new DbConnexion(); $c = $dbc->connect(); $errorMessage = ""; ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]--> <!-- BEGIN HEAD --> <head> <meta charset="utf-8" /> <title>MSPOS Web Plateform</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta content="" name="description" /> <meta content="" name="author" /> <!-- BEGIN GLOBAL MANDATORY STYLES --> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />