<?php
// Konfigurasi database
$servername = "localhost";
$database = "u645251767_stesbn";
$username = "u645251767_stesbn";
$password = "Stesbn@2025";

date_default_timezone_set('Asia/Jakarta');
 $tgl_time = date("Y-m-d h:i:sa");
 
function url()
{
return sprintf(
"%s://%s%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['SERVER_NAME'],
$_SERVER['REQUEST_URI']
);
}

// Koneksi
$conn = mysqli_connect($servername, $username, $password, $database);
if (!$conn) {
    die("Koneksi gagal: " . mysqli_connect_error());
}

$jurusanQuery = "SELECT * FROM biaya ORDER BY kategori ASC, jurusan ASC";
$jurusanResult = mysqli_query($conn, $jurusanQuery);
if (!$jurusanResult) {
    die("Query Gagal (jurusan): " . mysqli_error($conn));
}

$jurusanByKategori = [];
while ($row = mysqli_fetch_assoc($jurusanResult)) {
    $kategori = $row['kategori'];
    $jurusanByKategori[$kategori][] = $row;
}
?>
<!DOCTYPE html>
<html lang="en">
        <!-- Meta tags -->
        <meta charset="utf-8">
        <meta name="description"
            content="Sekolah Tinggi Ekonomi Syariah Bhakti Nugraha atau dikelas STESBN merupakan kampus dengan jurusan s1 perbankan syariah dan s1 manajemen yang berada di tangerang selatan dengan biaya murah terjangkau dan jam kuliah sabtu minggu." />
        <meta name="keywords"
            content="Kelas karyawan, Kuliah karyawan, stesbn, kampus yappera, kampus syariah jakarta, kampus manajemen di tangsel, kampus tangsel, s1 perbankan syariah, biaya kuliah kampus stesbn, sekolah tinggi ekonomi syariah bhakti nugraha, s1 manajemen" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="google-site-verification" content="--6vJJLs1uQPRQ-ePd_xAqk9wU2f7hRUCy8DqF9VDsA" />
    
        <meta property="og:title" content="STES Bhakti Nugraha (Kelas Karyawan)">
        <meta property="og:type" content="website">
        <meta property="og:url" content="https://stesbn.info">
        <meta property="og:image" content="https://stesbn.info/images/background/hero1.png" />
        <meta property="og:description"
            content="Sekolah Tinggi Ekonomi Syariah Bhakti Nugraha atau dikelas STESBN merupakan kampus dengan jurusan s1 perbankan syariah dan s1 manajemen yang berada di tangerang selatan dengan biaya murah terjangkau dan jam kuliah sabtu minggu.">
        <meta name="twitter:card" content="summary_large_image">
        <meta name="twitter:creator" content="@_kuliahkaryawan">
        <meta name="twitter:site" content="@_kuliahkaryawan">
        <meta name="twitter:title" content="STES Bhakti Nugraha (Kelas Karyawan)">
        <meta name="twitter:description"
            content="Sekolah Tinggi Ekonomi Syariah Bhakti Nugraha atau dikelas STESBN merupakan kampus dengan jurusan s1 perbankan syariah dan s1 manajemen yang berada di tangerang selatan dengan biaya murah terjangkau dan jam kuliah sabtu minggu.">
        <meta name="twitter:domain" content="https://stesbn.info">
        <meta name="twitter:image:src" content="https://stesbn.info/images/background/hero1.png">
    
        <meta name="author" content="Kuliah Karyawan Team" />
        <meta http-equiv="cache-control" content="public" />
        <meta name="application-name" content="STES Bhakti Nugraha | Kuliah Karyawan K2" />

    <link rel="apple-touch-icon" sizes="57x57" href="https://stesbn.info//images/favicons/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="https://stesbn.info//images/favicons/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="https://stesbn.info//images/favicons/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="https://stesbn.info//images/favicons/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="https://stesbn.info//images/favicons/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="https://stesbn.info//images/favicons/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="https://stesbn.info//images/favicons/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="https://stesbn.info//images/favicons/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="https://stesbn.info//images/favicons/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192"  href="https://stesbn.info//images/favicons/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="https://stesbn.info//images/favicons/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="https://stesbn.info//images/favicons/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="https://stesbn.info//images/favicons/favicon-16x16.png">
    <link rel="manifest" href="https://stesbn.info//images/favicons/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="https://stesbn.info//images/favicons/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">
	
<script src='https://www.google.com/recaptcha/api.js'></script>
	</head>
	
	<style>
		@import url("https://fonts.googleapis.com/css?family=Poppins:200i,400&display=swap");
		*,
		*::before,
		*::after {
			box-sizing: border-box;
		}
		body {
			font-family: "Poppins", sans-serif;
			font-size: 1rem;
			font-weight: 400;
			line-height: 1.5;
			background-color: #f2f1f7;
			margin: 0;
		}
		h1 {
			font-weight: 400;
			line-height: 1.5;
		}
		p {
			font-size: 1.2rem;
		}
		h1,
		p {
			margin-top: 0;
			margin-bottom: 1rem;
		}
		label {
			display: flex;
			align-items: center;
			font-size: 1.2rem;
			margin-bottom: 0.8rem;
		}
		input,
		button,
		select,
		textarea {
			margin: 0;
			font-family: inherit;
			font-size: inherit;
			line-height: inherit;
		}
		button {
			border: none;
			border: 1px solid #868686;
		}
		.container {
			width: 83%;
			margin: 3.125rem auto 0 auto;
		}
		@media (min-width: 576px) {
			.container {
				max-width: 540px;
			}
		}

		@media (min-width: 768px) {
			.container {
				max-width: 720px;
			}
		}
		.header {
			padding: 0 0.8rem;
			margin-bottom: 1.875rem;
		}
		.description {
			font-style: italic;
			font-weight: 200;
		}
		.clue {
			margin-left: 0.25rem;
			font-size: 0.9rem;
			color: #c2c2c2;
		}

		.text-center {
			text-align: center;
		}

		/* form */

		form {
			background: #fff;
			padding: 2.5rem 0.625rem;
			border-radius: 0.25rem;
		}

		@media (min-width: 480px) {
			form {
				padding: 2.5rem;
			}
		}

		.form-group {
			margin: 0 auto 1.25rem auto;
			padding: 0.25rem;
		}

		.form-control {
			display: block;
			width: 100%;
			height: 2.4rem;
			padding: 0.375rem 0.75rem;
			color: #91918f;
			background-color: #e4e3ea;
			background-clip: padding-box;
			border: 0;
			border-radius: 0.25rem;
			transition: border 0.8s ease-in-out;
		}

		.form-control:focus {
			border: 1px solid #868686;
			outline: 0;
		}

		.input-radio,
		.input-checkbox {
			display: inline-block;
			margin-right: 0.6rem;
			min-height: 1.5rem;
			min-width: 1.25rem;
		}

		.input-textarea {
			min-height: 120px;
			width: 100%;
			padding: 0.625rem;
			resize: vertical;
			border: 0;
			border: 1px solid #868686;
			outline: none;
		}

		.submit-button {
			display: block;
			width: 100%;
			padding: 0.75rem;
			background: #e7e7e7;
			color: inherit;
			border-radius: 2px;
			cursor: pointer;
		}
		
		   /* already defined in bootstrap4 */
	    .text-xs-center {
	        text-align: center;
	    }

	    .g-recaptcha {
	        display: inline-block;
	    }
	</style>
	<body>
		<div class="container">
			<header class="header">
				<h1 id="title" class="text-center">Form Pendaftaran Online</h1>
				
			</header>
			<form  method="POST" action="proses-pendaftaran.php">
			    
			<div class="form-group">
            <input
            type="text"
            name="nama_kampus"
            value="<?= url() ?>"
            class="form-control"
            readonly
            />
            </div>
						<div class="form-group">
					<label id="number-label" for="email"
						>Pilih Jurusan<span style="color: #ff0000">*</span></label
					>
				<select class="form-control" name="jurusan" required>
           <option value="">-- Pilih Jurusan --</option>
             <?php foreach ($jurusanByKategori as $kategori => $jurusanList): ?>
                <option disabled><?= htmlspecialchars($kategori) ?></option>
              <?php foreach ($jurusanList as $j): ?>
               <option 
                value="<?= htmlspecialchars($j['jurusan'] . '|' . $j['kategori']) ?>"
                data-biaya-awal="<?= htmlspecialchars($j['biaya_awal']) ?>"
                data-biaya-spp="<?= htmlspecialchars($j['biaya_spp']) ?>"
            >
                 <?= htmlspecialchars($j['jurusan']) ?>
                 </option>
               <?php endforeach; ?>
             <?php endforeach; ?>
           </select>
				</div>
				
				
				<div class="form-group">
					<label id="name-label" for="name"
						>Nama Lengkap
						<span style="color: #ff0000">*</span></label
					>
					<input
						type="text"
						name="nama"
						id="name"
						class="form-control"
						placeholder="Nama Sesuai KTP"
						required
					/>
				</div>
				<div class="form-group">
					<p>Jenis Kelamin</p>
					<label>
						<input
							name="jk"
							value="laki-laki"
							type="radio"
							class="input-radio"
							checked
						/>Laki-laki</label
					>
					<label>
						<input
							name="jk"
							value="perempuan"
							type="radio"
							class="input-radio"
						/>Perempuan</label
					>
				</div>
			
				<div class="form-group">
					<label id="number-label" for="number"
						>Alamat<span style="color: #ff0000">*</span></label
					>
					<input
						type="text"
						name="alamat"
						id="number"
					
						class="form-control"
						placeholder="Sesuai KTP"
					/>
				</div>
				<div class="form-group">
					<label id="number-label" for="number"
						>Tempat Lahir<span style="color: #ff0000"
							>*</span
						></label
					>
					<input
						type="text"
						name="tempat_lahir"
						id="number"
						
						class="form-control"
						placeholder=""
					/>
				</div>
				<div class="form-group">
					<label id="number-label" for="number"
						>Tanggal Lahir<span style="color: #ff0000"
							>*</span
						></label
					>
					<input
						type="date"
						name="tanggal_lahir"
						id="number"
						
						class="form-control"
						placeholder=""
					/>
				</div>
			
				<div class="form-group">
					<label id="number-label" for="no_war"
						>Nomor WhatsApp/HP<span style="color: #ff0000"
							>*</span
						></label
					>
					<input
						type="number"
						name="no_wa"
						class="form-control"
						placeholder=""
						required
					/>
				</div>
				<div class="form-group">
					<label id="number-label" for="email"
						>Email<span style="color: #ff0000">*</span></label
					>
					<input
						type="email"
						name="email"
					
						class="form-control"
						placeholder="Email"
					/>
				</div>
		
			
				<div class="form-group">
					<p>Lulusan<span style="color: #ff0000">*</span></p>
					<select
						id="dropdown"
						name="lulusan"
						class="form-control"
						required
					>
						<option disabled selected value>
							-- Pilih Lulusan --
						</option>
						<option value="SMA/MA/SMK/Sederajat">SMA/MA/SMK/Sederajat</option>
						<option value="D3/Sederajat">D3/Sederajat</option>
						<option value="Paket C">Paket C</option>
						<option value="S1/D4/Sederajat">S1/D4/Sederajat</option>
					</select>
				</div>
					<input
						type="hidden"
						name="tgl_daftar"
						value="<?= $tgl_time?>"
					
					
					/>
					<div class="form-group col-sm-12 text-center">
					    
					<!--<div class="g-recaptcha" data-sitekey="6LcXEmYrAAAAAC3Pj9RavaCFS-atJshxWZx8OteJ"></div>-->
					</div>
				
				
				<div class="form-group">
				<button type="submit" name="daftar" value="daftar" class="submit-button" />Daftar</button>
				</div>
			</form>
		</div>
	</body>
</html>
