<?php
include"../../../../inc/conn.php";

// CEK HAK AKSES DISINI

$id_siswa			= str_replace("'","`",(isset($_POST['id_siswa'])) ? $_POST['id_siswa'] : "");
$password1			= str_replace("'","`",(isset($_POST['password1'])) ? $_POST['password1'] : "");
$password2			= str_replace("'","`",(isset($_POST['password2'])) ? $_POST['password2'] : "");

if($password1!=$password2){
	echo"<script>alert('Kedua password harus sama !');history.go(-1)</script>";
}else{

	$update = mysqli_query($connect,"update tb_siswa set 

		password 			= '".$password1."'

	where id_siswa='$id_siswa'")or die(mysqli_error($connect));


	if($update){
		echo"<script>alert('Password berhasil diganti !');history.go(-1)</script>";
	}else{
		echo"<script>alert('Gagal mengeksekusi perintah ini !');history.go(-1)</script>";
	}


}
?>