<?php session_start();
require_once("../config/config.php");
//require_once("../config/commonsetting.php");

$myformId=SESS_MASTER;
$myIp= ipCheck() ;
$dateceated=date("Y-m-d G:i:s");
$createdby='0';
$full_name		=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'full_name']);
$company_name		=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'company_name']);
$mobileno	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'mobileno']);
$phone	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'phone']);
$emailid	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'emailid']);
$userpass		=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'userpass']);

$hash = password_hash($userpass,PASSWORD_DEFAULT);

 if($_POST){
  try{
		$olgaquery="INSERT INTO user_master SET createdIp='$myIp',datecreated='$dateceated',createdby='$createdby', userpass='$hash',emailid='$emailid'"; 
		$stmt = $conn->prepare($olgaquery);
		if($stmt->execute()){
			$last_insert_id = $conn->lastInsertId();

			$_SESSION["createds"] = $last_insert_id ;
			
			 echo "<script>window.location='../login-role/user';</script>";;
		}
 
 
   }
         
        // show error
        catch(PDOException $exception){
            die('ERROR: ' . $exception->getMessage());
        }
    }


?>