<?php
include 'krypton.php';

if(isset($_POST['updateconsols'])) { 
	
$userids = mysqli_real_escape_string($krypton, $_POST['usesid']);
$username = mysqli_real_escape_string($krypton, $_POST['usernames']);		
$upspeciala1 = mysqli_real_escape_string($krypton, $_POST['updatespeciala1']);
$upspeciala2 = mysqli_real_escape_string($krypton, $_POST['updatespeciala2']);
$upspeciala3 = mysqli_real_escape_string($krypton, $_POST['updatespeciala3']);
$upspeciala4 = mysqli_real_escape_string($krypton, $_POST['updatespeciala4']);
$upspeciala5 = mysqli_real_escape_string($krypton, $_POST['updatespeciala5']);
	
$upconsola1 = mysqli_real_escape_string($krypton, $_POST['updateconsola1']);
$upconsola2 = mysqli_real_escape_string($krypton, $_POST['updateconsola2']);
$upconsola3 = mysqli_real_escape_string($krypton, $_POST['updateconsola3']);
$upconsola4 = mysqli_real_escape_string($krypton, $_POST['updateconsola4']);
$upconsola5 = mysqli_real_escape_string($krypton, $_POST['updateconsola5']);
		
$sqls = "UPDATE justicewonder SET speciala1= '".$upspeciala1."', speciala2= '".$upspeciala2."', speciala3= '".$upspeciala3."', speciala4= '".$upspeciala4."', speciala5= '".$upspeciala5."', consola1= '".$upconsola1."', consola2= '".$upconsola2."', consola3= '".$upconsola3."', consola4= '".$upconsola4."', consola5= '".$upconsola5."', update_oleh = '".$username."' WHERE id= '".$userids."' ";
$chngnmbrs = mysqli_query($krypton, $sqls);
		
		if($chngnmbrs) {
			
			echo '<script> 
			alert("Periode Berhasil diubah!!")
			window.setTimeout(function() {
				window.location = "../dashboard.php";
			  }, 2000);
			</script>';

		}else {

				// Message Error
		echo '<script> 
			alert("Periode Gagal diubah!!")
			window.setTimeout(function() {
				window.location = "../dashboard.php";
			  }, 2000);
			</script>';

			}
		
	}

?>

<style>
.loader {
  border: 16px solid #f3f3f3; /* Light grey */
  border-top: 16px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: spin 2s linear infinite;
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

</style>

<div class="loader"></div>