<?php
    include('loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    if (strlen(__FILE__) > 48) {$filename = substr(__FILE__, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
$nama=  $_POST['name']; 
$biaya=  $_POST['biaya'];
$anamnesa=  $_POST['anamnesa'];$sistole=  $_POST['sistole'];$diastole=  $_POST['diastole'];$pulse=  $_POST['pulse'];$weight=  $_POST['weight'];
$tindakan=  $_POST['tindakan']; 

$pin=  $_POST['pin'];
$procain=  $_POST['procain'];
$colagen=  $_POST['colagen'];
$tation=  $_POST['tation'];

$password = $_POST['password'];
if ( $userini_id == "3"){
    $password = 000;
}

	$medrek = $_GET['imr'];
	$medrek1 = substr($medrek,0,5);
	$tanggal_1 = substr($medrek,6,10);
	$id = substr($medrek,17);
	$mr=  $medrek1;

	if ( $password != 000 ) {
        echo "<script>alert('Password Anda Salah');document.location='status-daftar-edit.php?imr=$medrek'</script>";
	  } else { $save=mysqli_query($conn, "UPDATE novia_abc_visit SET mr='$mr', anamnesa='$anamnesa', tindakan='$tindakan', biaya='$biaya', sistole='$sistole', diastole='$diastole', pulse='$pulse', weight='$weight', pin='$pin', procain='$procain', colagen='$colagen', tation='$tation'     where id='$id'");
		if($save){ //jika update berhasil maka muncul pesan dan menuju ke halaman produk
			//echo "<script>alert('Data Produk Berhasil disimpan ke database');document.location='index.php'</script>";
			echo "<script>document.location='visit-daily.php?tanggal=$tanggal_1'</script>";
		}else{  //jika update gagal maka muncul pesan
			 echo "<script>alert('Proses simpan gagal, coba kembali');document.location='status-daftar-edit.php?imr=$medrek'</script>";
		}
	}

?>
