<?php

include_once('db_services.php');
ini_set('max_execution_time', 120);

$code = isset($_GET['code']) ? $_GET["code"]  : "";
if( $code == "" ) 
   $code = isset($_POST['code']) ? $_POST["code"]  : "";

if( $code != "" ) {
   $first = true;
   $q = sprintf( "select sql_no_cache * from gateway_calls where gateway='%s'", $code );
   $result = $conn->query( $q );
   if( $result->num_rows > 0 ) {

      if($row = $result->fetch_assoc()) {
         $cid = $row["cid"];
         echo $cid;
      }
   }
   else echo "-1";
   if( is_resource($result) ) mysql_free_result( $result );
}
else echo "-2";
mysqli_close($conn);
?>

