<?php

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

// dados sessao

$adminid = (int) $_SESSION['adminid'];
$adminLevel = (int) $_SESSION['adminlevel'];
?>
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

// ve quantidade de logins disponiveis

/*
  id	int(11)	Não
  id_revenda	int(11)	Não
  desc_plano	tinytext	Não
  qtd_login	int(11)	Não
  valor_cobrado	decimal(10,2)	Não
  data_cad	date	Não
  status	 tinyint(4)	Não
 */


$SQL = "SELECT * FROM cmum_planos_pre WHERE id_revenda = {$adminid} AND status = 1 ORDER BY valor_cobrado ASC";

$con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);

$rs = $con->query($SQL);

$planos = array();

if ($rs->num_rows > 0) {
    while ($row = $rs->fetch_assoc()) {
        $planos[] = $row;
    }
}

$html = "<fieldset>"
        . "<legend>Planos Disponiveis</legend>";

if (count($planos) > 0) {

    $html .= "<p><input type='radio' value='0' name='id_plano' id='id_plano' class='id_plano' checked/>&nbsp;<span style='color: red;'>Revenda irá logar pra escolher o plano.</span></p>";

    /*foreach ($planos as $plano) {
        $html .= "<p><input type='radio' value='{$plano['id']}' name='id_plano' id='id_plano' class='id_plano'/>&nbsp;{$plano['desc_plano']} - <span>({$plano['qtd_login']} Logins)</span></p>";
    }*/
    
} else {
    
    $html .= "<p><input type='radio' value='0' name='id_plano' id='id_plano' class='id_plano' checked/>&nbsp;<span style='color: red;'>Revenda irá logar pra escolher o plano.</span></p>";
    
}

$html .= "</fieldset><hr>";

echo $html;








