<?php 
session_start();
include '../Class/CustomerAccount.php';
include "../connection.php";
$Username = mysqli_real_escape_string($conn, $_POST['user']);
$Password = mysqli_real_escape_string($conn, $_POST['pass']);
$Customerid = CustomerAccount::GetID($Username, $Password);
if ($Customerid == null) {
    echo "Invalid your Account";
} else {
    echo "success";
    $_SESSION['Customerid'] = $Customerid;
}
                             if (strlen($Password) < 8 or strlen($Password) > 16) {
                                 echo 'Password must be 8 to 16 characters';
                             } else {
                                 if ($Cpassword == '') {
                                     echo 'ConfirmPassword is required';
                                 } else {
                                     if ($Password != $Cpassword) {
                                         echo 'Password does not match';
                                     } else {
                                         if ($Contact == '') {
                                             echo 'Contact number is required';
                                         } else {
                                             if ($Email == '') {
                                                 echo 'Email Address is required';
                                             } else {
                                                 $acc = new CustomerAccount($FirstName, $LastName, $City, $Address, $Province, $Country, $Username, $Password, $Contact, $Email);
                                                 if ($acc->AddUser()) {
                                                     echo 'success';
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }