<?php include('../data/settings.php');


include('../data/config.php'); include('../data/public_function.php'); include('../data/theclass.php');

$erro="";  $mtype_err=""; $errok=""; $msize_err=""; $messagetitle_err=""; $messagecont_err=""; $post_err=""; $post1_err=""; $post2_err=""; $post3_err=""; $post4_err="";$pa_err=""; $cp_exist=""; $pp_err=""; $ft_err=""; $fj_err=""; $fz_err=""; $fz_err2=""; $pc_err="";$pn_err="";$aa_err=""; $ad_err="";$a_exist="";$pg3="";$pg4=""; $re="";$re3="";$re2="";$reg=""; $erro=""; $imgerr2 ='';

$MyBrowserInfo = $yourbrowser;
$MyIpInfo = khodex_ip();

$BrowserInfo = $MyBrowserInfo;
$IpInfo = $MyIpInfo;


// Approving Document
if(isset($_GET['verify']) ){
	
$update=$mysqli->query("UPDATE documents SET "
						 . "status='active'" . " WHERE docid=" .$_GET['verify']);						 
header('location: ' . $_SERVER['HTTP_REFERER']);
}

// Decline Document
if(isset($_GET['decline']) ){
	
$update=$mysqli->query("UPDATE documents SET "
						 . "status='declined'" . " WHERE docid=" .$_GET['decline']);						 
header('location: ' . $_SERVER['HTTP_REFERER']);
}

// Delete Document

if(isset($_GET['delete'])){
	
	if($clear=$mysqli->query("DELETE FROM documents WHERE docid=".$_GET['delete'])){
	header('location: ' . $_SERVER['HTTP_REFERER']);}}	



if(isset($_SESSION['user']['userid'])){
	
	$query = "SELECT * FROM users WHERE userid='".$_SESSION['user']['userid']."'";
        $result = $mysqli->query($query);
		
	  $adminrow = $result->fetch_array();
			$myadminid=$adminrow['userid'];
			$myusername=$adminrow['username'];
			$myrole=$adminrow['role'];
			$myemail=$adminrow['email'];
			$myfullname=ucwords($adminrow['fullname']);
			
if($myrole!=='admin'){
	header('location: ./logout'); exit(0);
}}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="endless admin is super flexible, powerful, clean &amp; modern responsive bootstrap 5 admin template with unlimited possibilities.">
    <meta name="keywords" content="admin template, endless admin template, dashboard template, flat admin template, responsive admin template, web app">
    <meta name="author" content="pixelstrap">
    <link rel="icon" href="../images/cu.png" type="image/x-icon">
    <link rel="shortcut icon" href="../images/cu.png" type="image/x-icon">
    <meta name="theme-color" content="#247CFD">
    <title>Admin Panel - <?= $sitename;?></title>
    <!-- Google font-->
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link href="css?family=Work+Sans:100,200,300,400,500,600,700,800,900" rel="stylesheet">
    <link href="css-1?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
    <link href="css-2?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
    <!-- Font Awesome-->
    <link rel="stylesheet" type="text/css" href="assets/css/fontawesome.css">
    <!-- ico-font-->
    <link rel="stylesheet" type="text/css" href="assets/css/icofont.css">
    <!-- Themify icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/themify.css">
    <!-- Flag icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/flag-icon.css">
    <!-- Feather icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/feather-icon.css">
    <!-- Plugins css start-->
    <link rel="stylesheet" type="text/css" href="assets/css/datatables.css">
    <!-- Plugins css Ends-->
    <!-- Bootstrap css-->
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.css">
    <link id="bootstrap-file" rel="stylesheet" type="text/css" href="#">
    <!-- App css-->
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <link id="color" rel="stylesheet" href="assets/css/color-1.css" media="screen">
    <!-- Responsive css-->
    <link rel="stylesheet" type="text/css" href="assets/css/responsive.css">
  </head>
  <body>