<?php
session_start();
$user_id = $_SESSION["user_id"];
$type= $_SESSION["type"];
include '../connection/includecon.php';
?>
<!DOCTYPE html>
<html lang="en">
    <?php

//Simple & effective way to get client mac address
// Turn on output buffering
ob_start();
//Get the ipconfig details using system commond
system('ipconfig /all');

// Capture the output into a variable

    $mycom=ob_get_contents();

// Clean (erase) the output buffer

    ob_clean();

$findme = "Physical";
//Search the "Physical" | Find the position of Physical text
$pmac = strpos($mycom, $findme);

// Get Physical Address
$mac=substr($mycom,($pmac+36),17);
//Display Mac Address
 if($mac=='28-B2-BD-D9-8B-5E'){ ;
?>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="images/favicon.png">
    <title></title>
    <!-- Bootstrap Core CSS -->
    <link href="../css/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="../css/helper.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">
   
</head>

<body class="fix-header fix-sidebar">
    <!-- Preloader - style you can find in spinners.css -->
    <div class="preloader">
        <svg class="circular" viewBox="25 25 50 50">
			<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
    </div>
    <!-- Main wrapper  -->
    <div id="main-wrapper">
        <!-- header header  -->
        <div class="header">
            <nav class="navbar top-navbar navbar-expand-md navbar-light">
                <!-- Logo -->
                <div class="navbar-header">
                    <a class="navbar-brand" href="index.html">
                        <!-- Logo icon -->
                       <!-- <b><img src="../images/logo.png" alt="homepage" class="dark-logo" /></b>-->
                        <!--End Logo icon -->
                        <!-- Logo text -->
                        <span><img src="../images/logo-text.png" alt="homepage" class="dark-logo" /></span>
                    </a>
                </div>
                <!-- End Logo -->
                <div class="navbar-collapse">
                    <!-- toggle and nav items -->
                    <ul class="navbar-nav mr-auto mt-md-0">
                        <!-- This is  -->
                        <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up text-muted  " href="javascript:void(0)"><i class="mdi mdi-menu"></i></a> </li>
                        <li class="nav-item m-l-10"> <a class="nav-link sidebartoggler hidden-sm-down text-muted  " href="javascript:void(0)"><i class="ti-menu"></i></a> </li>
                        <!-- Messages -->
                        
                        <!-- End Messages -->
                    </ul>
                    <!-- User profile and search -->
                    <ul class="navbar-nav my-lg-0">

                        <!-- Search -->
                        <li class="nav-item hidden-sm-down search-box"> <a class="nav-link hidden-sm-down text-muted  " href="javascript:void(0)"><i class="ti-search"></i></a>
                            <form class="app-search">
                                <input type="text" class="form-control" placeholder="Search here"> <a class="srh-btn"><i class="ti-close"></i></a> </form>
                        </li>
                       
                       
                        <!-- Profile -->
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-muted  " href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="../images/users/5.jpg" alt="user" class="profile-pic" /></a>
                            <div class="dropdown-menu dropdown-menu-right animated zoomIn">
                                <ul class="dropdown-user">
                                    <li><a href="#"><i class="ti-user"></i> Profile</a></li>
                                   
                                    <li><a href="#"><i class="ti-settings"></i> Setting</a></li>
                                    <li><a href="../logout.php"><i class="fa fa-power-off"></i> Logout</a></li>
                                </ul>
                            </div>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
        <!-- End header header -->
        <!-- Left Sidebar  -->
        <div class="left-sidebar">
            <!-- Sidebar scroll-->
            <div class="scroll-sidebar">
                <!-- Sidebar navigation-->
                <nav class="sidebar-nav">
                    <ul id="sidebarnav">
                        <li class="nav-devider"></li>
                        <li class="nav-label">Home</li>
                        <li> <a class=" has-arrow " href="index.php" aria-expanded="false"><i class="fa fa-tachometer"></i><span class="hide-menu">Dashboard </span></a>
                           <!-- <ul aria-expanded="false" class="collapse">
                                <li><a href="index.html">Ecommerce </a></li>
                                <li><a href="index1.html">Analytics </a></li>
                            </ul>-->
                        </li>
						
						
						 <li> <a class="has-arrow  " href="#" aria-expanded="false"><i class="fa fa-envelope"></i><span class="hide-menu">Master</span></a>
                            <ul aria-expanded="false" class="collapse">
                                <li><a href="add_identity_type.php">Add Identity Type</a></li>
								 <li><a href="add_user_type.php">Add User Type</a></li>
								 <li><a href="create_user.php">Create User</a></li>
								 <li><a href="menu_details2.php">Menu Permission</a></li>
                              
                            </ul>
                        </li>
							
						
                      	<?php 
							$sqlw = "select *from tbl_menu_mtr where under_menu_id = '0' and id in (select under_menu_id from tbl_menu_mtr where under_menu_id <> '0' and id in (select menu_id from tbl_menu_permission where user_type_id = '$type')) order by menu_order asc";
						$result = $objhr->viewdata($sqlw);
							if($result->num_rows > 0){
									while($rows = $result->fetch_assoc()){
									$id= $rows['id'];
									?>
									 <li> <a class="has-arrow  " href="#" aria-expanded="false"><i class="fa fa-envelope"></i><span class="hide-menu"><?php echo $rows['menu_name']; ?></span></a>
                            <ul aria-expanded="false" class="collapse">
                            
                         
          
		  <?php
		  error_reporting(0);
		  $sqlp = "select *from tbl_menu_permission where user_type_id = '$type' and status = '1'";
						$resultp = $objhr->viewdata($sqlp);
							if($resultp->num_rows > 0){
								while(	$rowsp = $resultp->fetch_assoc()){
									
								$menu_id=$rowsp['menu_id'];
									
 $sqlme = "select *from tbl_menu_mtr where id = '$menu_id' and under_menu_id = '$id' order by menu_order asc";
						$resultme = $objhr->viewdata($sqlme);
							if($resultme->num_rows > 0){
									while($rowsme = $resultme->fetch_assoc()){?>
									    <li><a href="<?php echo $rowsme['file_path']; ?>"><?php echo $rowsme['menu_name']; ?></a></li>
									
																		
								<?php }}}}
									?>
		  	

          </ul>
        </li>
								
								<?php }} ?>
                            
                            </ul>
                        </li>
                    </ul>
                </nav>
                <!-- End Sidebar navigation -->
            </div>
            <!-- End Sidebar scroll-->
        </div>
        <!-- End Left Sidebar  -->
        <?PHP
        else{
    echo 'Invalide Ip Address';
}