<?php
include 'krypton.php';

if(isset($_POST['updateprize'])) { 
	
$userid = mysqli_real_escape_string($krypton, $_POST['usesid']);
$username = mysqli_real_escape_string($krypton, $_POST['usernames']);				
$upprize1 = mysqli_real_escape_string($krypton, $_POST['updateprize1']);
$upprize2 = mysqli_real_escape_string($krypton, $_POST['updateprize2']);
$upprize3 = mysqli_real_escape_string($krypton, $_POST['updateprize3']);

		
$sql = "UPDATE justicewonder SET prize1= '".$upprize1."', prize2= '".$upprize2."', prize3= '".$upprize3."', update_oleh = '".$username."' WHERE id= '".$userid."' ";
$chngnmbr = mysqli_query($krypton, $sql);
		
		if($chngnmbr) {
			
			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>