<?php
require 'sessao.php';
level2();
$user_select = $_GET['id_usuario'];


if(isset($_POST['salvar'])){

$id = (int)$_GET['id_usuario'];
$plano_select = (int)$_POST['plano'];
$dias_restantes = (int)$_POST['dias_restantes'];
mysql_query("UPDATE `planos` SET `ip_perso` = $plano_select,`dias_restantes` = '$dias_restantes' WHERE `planos`.`id_user` = $id");


$head = "hostnames_usuario.php?id_usuario=".$id."";
header("Location: $head");

	
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <link rel="shortcut icon" href="img/favicon.png">

    <title>Painel DNS | Editar Plano</title>

    <!-- Bootstrap core CSS -->
    <link href="inc/css/bootstrap.min.css" rel="stylesheet">
    <link href="inc/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="inc/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="inc/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="stylesheet" href="inc/cinc/ss/owl.carousel.css" type="text/css">
    <!-- Custom styles for this template -->
    <link href="inc/css/style.css" rel="stylesheet">
    <link href="inc/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

  <section id="container" >
      <!--header start-->
      <header class="header white-bg">
            <div class="sidebar-toggle-box">
                <div data-original-title="Toggle Navigation" data-placement="right" class="icon-reorder tooltips"></div>
            </div>
            <!--logo start-->
            <a href="index.php" class="logo">Painel<span>DNS</span></a>
            <!--logo end-->
            <div class="nav notify-row" id="top_menu">
                <!--  notification start -->
                <ul class="nav top-menu">
                </ul>
            </div>
            <div class="top-nav ">
                <ul class="nav pull-right top-menu">
                    <?php require'menu2.php'; ?>
                </ul>
            </div>
        </header>
      <!--header end-->
      <!--sidebar start-->
      <aside>
          <div id="sidebar"  class="nav-collapse ">
              <!-- sidebar menu start-->
              <?php require'menu.php'; ?>
              <!-- sidebar menu end-->
          </div>
      </aside>
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
	  
          <section class="wrapper">
		  
		  <?php
										
										// seleciona o banco de dados
										$que_planos = mysql_query("SELECT * FROM planos where `id_user`='$user_select'");
							            $plau = mysql_fetch_assoc($que_planos);
										// mensagem de error com conecxão com o banco de dados
										
										// se o houver conecxão com o banco de dados ele ira seguir em diante
										
										?>

		  
		  <div class="row">
		  <div class="col-lg-6">
                      <section class="panel">
                          <header class="panel-heading">
                              Alterar plano do Usuario (<?php echo $user_select; ?>)
                          </header>
                          <div class="panel-body">
                               <form action="" method="post" id="form1" name="form1">
                                  <div class="form-group">
                                      <label for="exampleInputEmail1">Nº de IPs Personalizados</label>
                                      <input type="text" name="plano" id="domain" class="form-control" placeholder="123" value="<?php echo $plau['ip_perso']; ?>" required="required">
                                      <label for="inputdias">Dias Restantes</label>
                                      <input type="text" name="dias_restantes" id="dias-r" class="form-control" placeholder="123" value="<?php echo $plau['dias_restantes']; ?>" required="required">
                                      <input type="hidden" name="id_usuario" value="<?php echo $user_select; ?>">
                                  </div>
                                  
                                  
                                 
								  
                            
						  
						  <button type="submit" name="salvar" class="btn btn-success"><i class="icon-white icon-ok"></i> Salvar</button>
								 
                                  <button type="reset" class="btn btn-default">Limpar</button>
                              </form>

                          </div>
                      </section>
                  </div>
		  
		  </div>
		  
		  
		  
		  
		  
		  
              <!--state overview end-->
              </section>

            </section>
</section>




     
      <!--main content end-->
      <!--footer start-->






      <footer class="site-footer">
          <div class="text-center">
              <?php require'config.php'; echo rodape(); ?>
              <a href="#" class="go-top">
                  <i class="icon-angle-up"></i>
              </a>
          </div>
      </footer>


      <!--footer end-->

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="inc/js/jquery.js"></script>
    <script src="inc/js/jquery-1.8.3.min.js"></script>
    <script src="inc/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="inc/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="inc/js/jquery.scrollTo.min.js"></script>
    <script src="inc/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="inc/js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="inc/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="inc/js/owl.carousel.js" ></script>
    <script src="inc/js/jquery.customSelect.min.js" ></script>
    <script src="inc/js/respond.min.js" ></script>

    <script class="include" type="text/javascript" src="inc/js/jquery.dcjqaccordion.2.7.js"></script>

    <!--common script for all pages-->
    <script src="inc/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="inc/js/sparkline-chart.js"></script>
    <script src="inc/js/easy-pie-chart.js"></script>

  <script>

      //owl carousel

      $(document).ready(function() {
          $("#owl-demo").owlCarousel({
              navigation : true,
              slideSpeed : 300,
              paginationSpeed : 400,
              singleItem : true,
			  autoPlay:true

          });
      });

      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });

  </script>

  </body>
</html>
