File "omgpm.php"

Full Path: /home/u165092617/domains/tadzz.com/public_html/admin/backend/omgpm.php
File size: 1.85 KB
MIME-type: text/x-php
Charset: utf-8

<?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';
$api_key		=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'api_key']);
//$private_key		=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'private_key']);
$network_id	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'network_id']);
$stat	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'stat']);
$api_type	=   secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'api_type']);


 if($_POST){
  try{
      if($stat=='0'){
          $olgaquery="INSERT INTO api_coupan SET createdIp='$myIp',datecreated='$dateceated',api_key='$api_key', network_id='$network_id',api_type='$api_type'"; 
          
		$stmt = $conn->prepare($olgaquery);
		if($stmt->execute()){
			$last_insert_id = $conn->lastInsertId();
            var_dump($olgaquery);
			$_SESSION["created"] = $last_insert_id ;

			$json['status'] = true;
            $json['message'] =  "Save Successfully";
			// echo "<script>window.location='../cpages/coupon_api_config/omgpm.php';</script>";
		}
          
      }else{
          $olgaquery="UPDATE api_coupan SET createdIp='$myIp',datecreated='$dateceated',api_key='$api_key', private_key='$private_key',network_id='$network_id' WHERE api_type='$api_type' "; 
		$stmt = $conn->prepare($olgaquery);
		if($stmt->execute()){
			$last_insert_id = $conn->lastInsertId();
            
			$_SESSION["created"] = $last_insert_id ;
			$json['status'] = true;
            $json['message'] =  "Save Successfully";
			// echo "<script>window.location='../cpages/coupon_api_config/omgpm.php';</script>";
		}
          
      }
		
 
 
   }
         
        // show error
        catch(PDOException $exception){
            die('ERROR: ' . $exception->getMessage());
        }
    }

    echo json_encode($json);
?>