<?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';

$contact=   $_REQUEST[SESS_MASTER.'contact'];
if(!empty($_REQUEST[SESS_MASTER.'contact'])){



    
  $sql = "SELECT * FROM contact_master ";
   
    $myquery=$conn->query($sql);
  $mydara= $myquery->fetchAll()  ;
  
  $rows_found = $myquery->rowCount();
   


    if($_POST){
  try{
     if($rows_found=='0'){
      
      $olgaquerys="INSERT INTO contact_master SET createdIp='$myIp',datecreated='$dateceated',email_hubspot='$contact'"; 
    $stmts = $conn->prepare($olgaquerys);
    if($stmts->execute()){

      $_SESSION["contact_status"] = '34' ;
      
       header("location:../email-hubspot-subscriber.php");

      }
     }else{
          $olgaquerys="UPDATE contact_master SET createdIp='$myIp',datecreated='$dateceated',email_hubspot='$contact' "; 
    $stmts = $conn->prepare($olgaquerys);
    if($stmts->execute()){

      $_SESSION["contact_status"] = '34' ;
      
         header("location:../email-hubspot-subscriber.php");
    }
     }
 
   }
         
        // show error
        catch(PDOException $exception){
            die('ERROR: ' . $exception->getMessage());
        }
    }
  	     
}

 


?>