<?php
 
 
require_once("header.php");
 
if($_POST["submit"])

{

	$fname= $_POST['fname'];

	 $mname=$_POST['mname'];

	 $lname=$_POST['lname']; 

	 $email=$_POST['email']; 

	 $phoneno=$_POST['phoneno']; 

	 $pobox=$_POST['pobox'];

	 $street=$_POST['street'];

	 $ward=$_POST['ward'];

	 $district=$_POST['district'];

	 $region=$_POST['region'];

	 $country=$_POST['country'];

	 $gender=$_POST['gender'];

	 $dob=$_POST['dob'];

	 $occupation=$_POST['occupation'];

	 $password = md5($_POST['password']);
	 $cpassword = md5($_POST['cpassword']);

     $rg=Date("Ymdhis").substr(10,2);
     $reg=md5(substr($rg,1,11));
     $regdate=Date("Y-m-d");


	                                                       //CHECK IF THE POST IS MADE THROUGH ROOM BOOKING
if(isset($_POST['roomNo']) && isset($_POST['hotel']))
         {
	$roomNO=$_POST['roomNo'];
	$hotel=$_POST['hotel'];
         }

else     {
	$roomNO="";
	$hotel="";
         }
 

                                                             //CHECKING ENDS HERE

 require_once"buda_connect.php";
  $con=new connect_class();

  if(!$con->vFname($fname) || !$con->vMname($mname) || !$con->vLname($lname) || !$con->vStreet($street) || !$con->vWard($ward) || !$con->vDistrict($district) || !$con->vRegion($region) || !$con->vCountry($country) || !$con->vPhoneno($phoneno) || !$con->vEmail($email) || !$con->vGender($gender) || !$con->vDate($dob) || !$con->vOccupation($occupation) ||!$con->vPassword($password) || !$con->vCpassword($password,$cpassword))
          
          {
               require_once"repostRegform.php";
          }
 
  else    {
               $re= $afRo=$con->registerOwner($phoneno,$reg,$fname, $mname, $lname, $gender, $occupation, $email,$pobox, $password,$district,$country, $street ,$ward, $region, $dob, $regdate);
                //print_r($re->ErrorInfo());
                require_once("dBconn.php");
                $dBcon= new  dBconn();
                $pwd=$password;
                $date=$reg;
                $rQ=$dBcon->addClient($fname,$lname,$phoneno,$email,$pwd,$date);

          }
   
 
}



?>