<?php
    require_once('session.php');
    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
    header("HTTP/1.1 403 Forbidden");
    echo "Access forbidden. Use HTTPS.";
    exit();
    }
    $postID = $_POST['postID'];
    $pass = password_hash($_POST['pass'],PASSWORD_DEFAULT);
    $re_pass = $_POST['pass'];
    $user = $_POST['user'];
    $email = $_POST['email'];
    $no_hp = $_POST['no_hp'];
    $pemilik = $_POST['pemilik'];
    $akun = $_POST['akun'];
    $no_rek = $_POST['no_rek'];

    if($re_pass == ''){
        $query = mysqli_query($conn,"UPDATE `tb_user` SET `user` = '$user', `no_hp` = '$no_hp', `email` ='$email' WHERE cuid = '$postID'") or die(mysqli_error());
        $query1 = mysqli_query($conn,"UPDATE `tb_bank` SET `akun` = '$akun', `no_rek` = '$no_rek', `pemilik` ='$pemilik' WHERE userID = '$postID'") or die(mysqli_error());
        header('location:../view/?postID='.$postID.'&notif=1');
        exit();
    }
    else {
        $query = mysqli_query($conn,"UPDATE `tb_user` SET `pass` = '$pass', `user` = '$user', `no_hp` = '$no_hp', `email` ='$email' WHERE cuid = '$postID'") or die(mysqli_error());
        $query1 = mysqli_query($conn,"UPDATE `tb_bank` SET `akun` = '$akun', `no_rek` = '$no_rek', `pemilik` ='$pemilik' WHERE userID = '$postID'") or die(mysqli_error());
        header('location:../view/?postID='.$postID.'&notif=1');
        exit();
    }
    
?>