<!-- registration -->
<?php
session_start();
$koneksi = mysqli_connect("localhost", "root", "", "nodemcu3");


// Periksa apakah session 'username' sudah di-set
if (!isset($_SESSION['username'])) {
    // Redirect ke halaman login.php jika belum login
    header('location: login.php');
    exit;
}

// Sekarang konten dari halaman index.php Anda dapat ditampilkan
?>
<?php
	$Write="<?php $" . "UIDresult=''; " . "echo $" . "UIDresult;" . " ?>";
	file_put_contents('UIDContainer.php',$Write);
?>


<!DOCTYPE html>
<html lang="en">
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta charset="utf-8">
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<script src="js/bootstrap.min.js"></script>
		<script src="jquery.min.js"></script>
		<script>
			$(document).ready(function(){
				$("#getUID").load("UIDContainer.php");
				setInterval(function() {
					$("#getUID").load("UIDContainer.php");
				}, 500);
			});
		</script>
		
		<style>
		html {
			font-family: Arial;
			display: inline-block;
			margin: 0px auto;
			
		}
		
		textarea {
			resize: none;
		}

		ul.topnav {
			list-style-type: none;
			margin: auto;
			padding: 0;
			overflow: hidden;
			background-color: #4CAF50;
			width: 70%;
			margin-top: 20px;
		}

		ul.topnav li {float: left;}

		ul.topnav li a {
			display: block;
			color: white;
			text-align: center;
			padding: 14px 16px;
			text-decoration: none;
			
		}

		ul.topnav li a:hover:not(.active) {background-color: #3e8e41;}

		ul.topnav li a.active {background-color: #333;}

		ul.topnav li.right {float: right;}

		@media screen and (max-width: 600px) {
			ul.topnav li.right, 
			ul.topnav li {float: none;}
		}
		</style>
		
		<title>: Registration </title>
	</head>
	
	<body>

		<ul class="topnav">
			<li><a href="rekapdata.php">Rekap Data</a></li>
			<li><a href="user data.php">Data Pasien</a></li>
			<li><a class="active" href="homepage.php">Registrasi</a></li>
			<li><a href="read tag.php">Baca Tag ID</a></li>
			<li><a href="grafik.php">Grafik</a></li>
			<li><a href="logout.php">keluar</a></li>
		</ul>

		<div class="container">
			<br>
			<div class="center" style="margin: 0 auto; width:495px; border-style: solid; border-color: #f2f2f2;">
				<div class="row">
					<h3 align="center">Formulir pendaftaran</h3>
				</div>
				<br>
				<form class="form-horizontal" action="insertDB.php" method="post" >
					<div class="control-group">
						<label class="control-label">ID</label>
						<div class="controls">
							<textarea name="id" id="getUID" placeholder="Please Tag your Card / Key Chain to display ID" rows="1" cols="1" required></textarea>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Nama</label>
						<div class="controls">
							<input id="div_refresh" name="name" type="text" pattern="[A-Za-z\s]+" placeholder="" required>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Jenis Kelamin</label>
						<div class="controls">
							<select name="gender">
								<option value="Pria">Pria</option>
								<option value="Perempuan">Perempuan</option>
							</select>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Umur</label>
						<div class="controls">
							<input name="umur" type="number" placeholder="Umur" required>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">No Hp</label>
						<div class="controls">
							<!-- <input name="mobile" type="text"  placeholder="" required> -->
							<input name="mobile" type="tel"  pattern="\+62[0-9]{10,13}" minlength="13" maxlength="16" placeholder="+62" required>
						</div>
					</div>
					
					<div class="form-actions">
						<button type="submit" class="btn btn-success">simpan</button>
                    </div>
				</form>
				
			</div>               
		</div> <!-- /container -->	
	</body>
</html>
