<?php
require("config.php");
require("includes/debug.php");
require("includes/functions.php");
require("includes/logincheck.php");
require("includes/settings.php");

//$opc_rev = unserialize($_SESSION["_opcoes_rev"]);
$opc_log = unserialize($_SESSION["_opcoes_log"]);
if(is_null($opc_log)){
    $opc_log = array();    
}
//var_dump($opc_log);

if (isset($_GET["p"]) and $_GET["p"] <> "") {
    //exit("IF 1");
	//$adminid = $_GET["id"];
    $params = json_decode(base64_decode($_GET["p"]),true);
    $uid = $params["id"];
    if($_SESSION["adminlevel"] != "0"){
        //exit("IF 2 - {$_SESSION["adminlevel"]}");
        if($params["aid"] != $_SESSION["adminid"]){
            header("Location: manusers.php");
            exit();
        }
        if($_SESSION['adminlevel'] != "0" && (empty($opc_log) || array_search('6', $opc_log) === false)){
            exit('Voce nao tem permissao para excluir.');                                    
        }
    }
} else {    
	header("Location: manusers.php");
        exit();
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=<?php print($charset); ?>" />
<title><?php print($longtitle); ?></title>
<link rel="shortcut icon" href="favicon.ico"/>
<link rel="apple-touch-icon" href="favicon.png"/> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="css/main.css" rel="stylesheet" type="text/css">
    
</head>

<body>
<!--<table width="980" border="0" align="center" valign="top" cellpadding="0" cellspacing="0" style="border-left: 1px solid #DDDDDD; border-right: 1px solid #DDDDDD; text-align: left;">
  <tr bgcolor="#006699">
    <td height="22" colspan="6">&nbsp;</td>
  </tr>
  <tr bgcolor="#006699">
    <td width="15" bgcolor="#006699">&nbsp;</td>
    <td width="751" height="120" bgcolor="#006699"><?php //require("includes/header.php"); ?></td>
    <td width="15" bgcolor="#006699">&nbsp;</td>
  </tr>
  <tr bgcolor="#006699">
    <td height="18">&nbsp;</td>
    <td height="18"><center><?php //require("includes/menu.php"); ?></center></td>
    <td height="18">&nbsp;</td>
  </tr>
    <tr bgcolor="#006699">
    <td height="18">&nbsp;</td>
    <td height="18">&nbsp;</td>
    <td height="18">&nbsp;</td>
  </tr>
</table>-->
<?php require_once 'topo.php';?>
<table width="980" height="20" border="0" align="center" valign="top" cellpadding="0" cellspacing="0" style="border-left: 0px solid #DDDDDD; border-right: 0px solid #DDDDDD; text-align: left;">
  <tr >
    <td width="15" height="20">&nbsp;</td>
    <td height="20" colspan="4">
    <?php
	//$userid = $_GET["id"];
	$conn = @mysql_connect($dbhost,$dbuser,$dbpass) or sqlerror();
	mysql_select_db($dbname, $conn);
	$sql = mysql_query("SELECT * FROM cmum_udb WHERE id='".$uid."'") or sqlerror();
	$line=mysql_fetch_array($sql);
	mysql_close($conn);
	?>
    <form name="deluser" action="manusers.php" method="post">
    <fieldset>
    <legend>Deletar usuario</legend>
    <input type="hidden" name="uid" value="<?php print($uid); ?>">
    <input type="hidden" name="username" value="<?php print($line["name"]); ?>">
        Tem Certeza Que Deseja Excluir?&nbsp;<strong><?php print($line["name"]); ?></strong>?&nbsp;&nbsp;<input type="submit" name="bdel" value="Sim" id="submit">&nbsp;<input type="submit" name="bdel" value="Não" id="submit">
    </fieldset>
    </form>
    </td>
    <td width="15" height="20">&nbsp;</td>
  </tr>
</table>
<table width="980" height="20" border="0" align="center" valign="top" cellpadding="0" cellspacing="0" style="border-left: 1px solid #DDDDDD; border-right: 0px solid #DDDDDD; border-bottom: 0px solid #DDDDDD; text-align: left;">
    <tr >
    <td height="20" width="780">&nbsp;</td>
  </tr>
</table>
<?php
require("includes/footer.php");
?>
</body>
</html>
