<?php include("../cn.php");
$id = $_REQUEST["id"];
$email = $_REQUEST["email"];
$name = $_REQUEST["fullname"];

$img_name = date("Ymdis");

$photo=($_FILES["photo"]["name"]!="")?"users/user_".$img_name.".".pathinfo($_FILES['photo']['name'], PATHINFO_EXTENSION):"";
if($_FILES["photo"]["name"]!="")
{
    move_uploaded_file($_FILES["photo"]["tmp_name"],"../../admin/".$photo);
	$imgsql = "Image='$photo',";
}

mysqli_query($connect, "update users set $imgsql FullName = '$name', Email = '$email' where Id='$id'");
$_SESSION["email"] = $email;
$_SESSION["name"] = $name;
$_SESSION["image"] = $imgsql;


header("location:../profile-settings.php");

?>