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

$opc_rev = unserialize($_SESSION["_opcoes_rev"]);

if (isset($_GET["p"]) and $_GET["p"] <> "") {
	//$adminid = $_GET["id"];
    $params = json_decode(base64_decode($_GET["p"]),true);
    $id = $params["id"];
    //exit(var_dump($params));
    if($_SESSION["adminlevel"] != "0"){
        if($params["aid"] != $_SESSION["adminid"]){
            header( "Location: admins.php" );
            exit();
        }
        if(array_search('8', $opc_rev) === false){
            exit('Voce nao tem permissao para excluir.');                                    
        }
    }
} else {
	header( "Location: admins.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="//netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/css/bootstrap.min.css">
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>

<body>
<?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
	$adminid = $params["id"];
	$conn = @mysql_connect($dbhost,$dbuser,$dbpass) or sqlerror();
	mysql_select_db($dbname, $conn);
	$sql = mysql_query("SELECT * FROM cmum_admins WHERE id='".$id."'") or sqlerror();
	$line=mysql_fetch_array($sql);
	mysql_close($conn);
	?>
    <form name="deladmin" action="admins.php" method="post">
    <fieldset>
    <legend>Excluir Admin/Revendas</legend>
    <input type="hidden" name="adminid" value="<?php print($adminid); ?>">
    <input type="hidden" name="username" value="<?php print($line["username"]); ?>">
   Tem certeza de que deseja excluir <strong><?php print($line["username"]); ?></strong>?&nbsp;&nbsp;<input type="submit" name="baction" class="btn btn-default" value="Yes" id="submit">&nbsp;<input type="submit" name="baction" class="btn btn-default" value="Nao" 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: 0px 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>
