<?php 

include '../../../config/koneksi.php';


$id_adminu = $_POST['id_adminu'];
$user1u = $_POST['user1u'];
$password1v= $_POST["password1v"];
$password1u = password_hash($_POST['password1u'], PASSWORD_DEFAULT) ;
$halamanu = $_POST['halamanu'];
$id_opdu = $_POST['id_opdu'];

if ($password1u==="" & $password1v==="")
{
 echo 'Data Gagal Berubah';  
}
else
{
 $sql = "SELECT user1, password1, halaman,id_opd,id_admin FROM admin WHERE user1 = '$user1u'";
    $result=mysqli_query($koneksi, $sql);
    list($username, $password, $halaman,$id_opd,$id_admin) = mysqli_fetch_array($result);

     if (mysqli_num_rows($result) > 0) {
   if (password_verify($password1v, $password)) {
mysqli_query($koneksi,"UPDATE admin set user1='$user1u',password1='$password1u',halaman='$halamanu',id_opd='$id_opdu' where id_admin='$id_adminu' ");
echo ' <h4 style=color:green><i class=fa fa-edit></i>Data Berhasil  Dirubah</h4>'; 
}
else
{
	echo ' <h4 style=color:red>Peringatan Password Salah Data Gagal Berubah</h4>'; 
}
}
else
{
	echo ' <h4 style=color:red>Peringatan  Password Salah  Data Gagal Berubah</h4>'; 
}
}
?>
