<?php
require_once 'sql.php';
require_once 'sessao.php';
require 'config.php';
if (isset($_GET['ip'])){
$id_ = $_GET['ip'];
$query_registro = mysql_query("Select id,INET_NTOA(ipaddress) as ipaddress from ips WHERE id='$id_' and user_id='$id'");
$fetch_reg = mysql_fetch_assoc($query_registro);
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
  
<head>
    <meta charset="utf-8">
    <title>Cadastro IP - TS3 PRO.NET</title>
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">    
    
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
    
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">        
    
    <link href="css/jquery-ui-1.10.0.custom.min.css" rel="stylesheet">
    
    <link href="css/base-admin-3.css" rel="stylesheet">
    <link href="css/base-admin-3-responsive.css" rel="stylesheet">
    
    <link href="css/dashboard.css" rel="stylesheet">   

    <link href="css/custom.css" rel="stylesheet">

    <link rel="shortcut icon" href="jpg/icon.gif" type="image/x-icon" />
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

  </head>

<body>

<nav class="navbar navbar-inverse" role="navigation">

	<div class="container">
  <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      <span class="sr-only">Toggle navigation</span>
      <i class="icon-cog"></i>
    </button>
    <a class="navbar-brand" href="index.php">IP Personalizado - TS3PRO.NET</a>
  </div>

  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
     <!--menu superior-->
    <?php require 'menu2.php';?>

   
  </div><!-- /.navbar-collapse -->
</div> <!-- /.container -->
</nav>
    



    
<div class="subnavbar">

	<div class="subnavbar-inner">
	
		<div class="container">
			
			<a href="javascript:;" class="subnav-toggle" data-toggle="collapse" data-target=".subnav-collapse">
		      <span class="sr-only">Toggle navigation</span>
		      <i class="icon-reorder"></i>
		      
		    </a>

			<div class="collapse subnav-collapse">
			<?php
			require_once 'menu.php';
			require_once 'menu_admin.php';
			?>
			</div> <!-- /.subnav-collapse -->

		</div> <!-- /container -->
	
	</div> <!-- /subnavbar-inner -->

</div> <!-- /subnavbar -->
    
    
<div class="main">

    <div class="container">

      <div class="row">

      	<div class="col-md-6">	
      		
      		
      		<div class="widget stacked">
					
				<div class="widget-header">
					<i class="icon-align-justify"></i>
					<h3>Cadastro IPs</h3>
				</div> <!-- /widget-header -->
				
				<div class="widget-content">
					<?php
					// mensagem de error
			if (isset($_GET['ip'])){
			echo '<div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
								Insira o IP.
								</div>';}
			
			// mensagem de sucesso
			if (isset($_GET['cad_sucesso'])){
			echo'
				<div class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                               IP cadastrado com sucesso!
                            </div>';}
			if (isset($_GET['edit_sucesso'])){
			echo'
				<div class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                               IP editado com sucesso, aguarde 1 minuto para se conectar!
                            </div>';}
            ?>

					<div class="shortcuts">
					<?php if (isset($_GET['ip'])){?>
					<form action="novo_ip_.php?id=<?php echo $id_?>" method="post" id="form1" name="form1">
					<?php } else{?>
					<form action="novo_ip_.php" method="post" id="form1" name="form1">
					<?php } ?>
<fieldset>
                            <?php
							if (isset($_GET['ip'])){
						    echo'<div class="form-group">
						      <label for="name" class="col-lg-4">Endereço IP:</label >
                                
								<div class="col-lg-8">
						        	<input type="text" class="form-control" name="ipaddress" id="ipaddress" value="'.$fetch_reg['ipaddress'].'" required>
						 
								</div>
						    </div>';} else {
						    echo'<div class="form-group">
						      <label for="name" class="col-lg-4">Endereço IP:</label >
                                
								<div class="col-lg-8">
						        	<input type="text" class="form-control" name="ipaddress" id="ipaddress" value="" placeholder="127.0.0.1" required>
						 
								</div>
						    </div>';}
							?>
                            <div class="form-group">
						    	<div class="col-lg-4" align="center"></div>
								
								<br>
						    	<div class="col-lg-12">
								<?php if (isset($_GET['ip'])){
						      echo '<input type="submit" class="btn btn-success" value="Atualizar">&nbsp;';
							  } else{
							  echo '<input type="submit" class="btn btn-success" value="Cadastrar">&nbsp;';
							  }
							  
							  ?>
						  </div>
						    </div>
						  </fieldset>
						</form>
										
					</div> <!-- /shortcuts -->	
				
				</div> <!-- /widget-content -->
				
			</div> <!-- /widget -->
      	 </div> <!-- /span6 -->
	</div> <!-- /container -->

</div> <!-- /extra -->


                                   <br>
    
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation"> 
<div class="footer">
		
	<div class="container">
		
		<div class="row">
			
			<div id="footer-copyright" class="col-md-6">
				 <div align="center"><b>@ 2015 ts3brasil.com | Todos os Direitos Reservados<sup>TM</sup></b></div> <a href="https://ts3pro.net" target="_blank">TS3 Pro.</a>
			</div> <!-- /span6 -->
			
			<div id="footer-terms" class="col-md-6">
				<a href="http://ts3pro.net/termos.php" target="_blank">Termos de serviço</a>
			</div> <!-- /.span6 -->
			
		</div> <!-- /row -->
		
	</div> <!-- /container -->
	
</div> <!-- /footer -->
</nav>



    

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-ui-1.10.0.custom.min.js"></script>
<script src="js/bootstrap.min.js"></script>

<script src="js/application.js"></script>

<script src="js/area.js"></script>
<script src="js/donut.js"></script>

  </body>

</html>