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


$google_ana	=  addslashes(($_POST[SESS_MASTER.'google_ana']));
$stat	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'stat']);

 if($_POST){
  try{
	   if($stat=='0'){

			$olgaquerys="INSERT INTO google_code SET createdIp='$myIp',datecreated='$dateceated',createdby='$createdby',google_ana='$google_ana',activestatus='0'"; 
		$stmts = $conn->prepare($olgaquerys);
		if($stmts->execute()){

			$_SESSION["google_code"] = '34' ;
			
			 header("location:../google-analytics-code.php");

			}
	   }else{
         	$olgaquerys="UPDATE google_code SET createdIp='$myIp',datecreated='$dateceated',createdby='$createdby',google_ana='$google_ana',activestatus='0'"; 
		$stmts = $conn->prepare($olgaquerys);
		if($stmts->execute()){

			$_SESSION["google_code"] = '34' ;
			
			 header("location:../google-analytics-code.php");
		}
	   }
 
   }
         
        // show error
        catch(PDOException $exception){
            die('ERROR: ' . $exception->getMessage());
        }
    }


?>