<?php
session_start();

if (!isset($_SESSION['userID'])) {
    header("Location: sign-in.php");
    exit();
}
require_once "SqlConnection/MySqlConnection.php";


$userID= $_SESSION['userID'];

$password = $_POST['password'];

$sql = "Update login set password='".$password."' where id='".$userID."'";
$result = mysqli_query($conn,$sql);
if($result){
    header("Location: logout.php");
}
else{
    echo "Error while updating password";
}
?>