<?php include("../cn.php");
$fname = $_REQUEST["fname"];
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];
$email = $_REQUEST["email"];
$user_role = $_REQUEST["user_role"];
$address = $_REQUEST["address"];
$phone = $_REQUEST["phone"];
$representative = $_REQUEST["representative"];

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

}
mysqli_query($connect, "INSERT INTO `users`(`FullName`, `Username`, `Password`, `Image`, `Email`, `Type`, `Role`, `Address`, `Phone`, `Representative`) VALUES(
 '$fname','$username','$password','$photo','$email','user', '$user_role', '$address', '$phone', '$representative')");


header("location:../users.php");

?>