<?php 
	include_once('../config.php');    
	/*session_start();
	ini_set('date.timezone', 'Asia/Calcutta');
	error_reporting(E_ERROR | E_WARNING);
	#error_reporting(E_ALL);  		 
	ini_set('memory_limit', '512M');
	error_reporting(E_ERROR | E_WARNING | E_PARSE); 	
	$server = $_SERVER['HTTP_HOST']; 
    $SITE_NAME = "Daily Pay";
    $server_url= str_replace("www.","",$server);
    /* // for netbuttrfly.com
    $mail_username="info@kalpanagauritech.com";
    $mail_password="f6!P0n,[S2!0"; 
    */     
    /*
	switch($server)
	{	 
	case "www.dailypayservices.in": 
		define("HST", "localhost"); 
		define("USR", "netbuttr_user1");
		define("PWD", "NetButterfly#@123");
		define("DBN", "netbuttr_dailypaydemo");				 
		define("MAIN_ROOTPATH", "https://www.dailypayservices.in");	
		define("ROOTPATH", "https://www.dailypayservices.in");	
		define("ADMINPATH", "https://www.dailypayservices.in/admin");
		define("ABS_PATH", $_SERVER['DOCUMENT_ROOT']); 
	break;	  
	case "dailypayservices.in": 
		header("Location: https://www.dailypayservices.in"); 
		die;
	break; 
   }   
   
    if(!isset($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on") 
    {
	    header("Location: ".ROOTPATH."");  
	    die;
    }
	    
	$mail_username="admin@travelcreditmaster.com";
    $mail_password="y(E]wpqNk?fq";   
 
    	 
    $conn = new PDO('mysql:host='.HST.';dbname='.DBN.';charset=utf8mb4', USR, PWD);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
      
    $db_host = HST;
    $db_user = USR;
    $db_pass = PWD;
    $db_name = DBN;
    
    $con =  mysqli_connect($db_host,$db_user,$db_pass,$db_name);
    if(mysqli_connect_error())
    {
        echo 'connect to database failed';
    }  
    */
          
    if(!isset($_SESSION['userId']))
    { 
         header("Location: ../");
         die;
    }
                                                      
             
             
            $stmt=$conn->prepare("SELECT id   FROM UI__PoolCoupon100k  where  custId=:custId  and Tdate=:Tdate ");   
            $stmt->bindValue(':custId',  $_REQUEST['poolId'] , PDO::PARAM_STR);  
            $stmt->bindValue(':Tdate',  date("d-M-Y"), PDO::PARAM_STR);     
            $stmt->execute();    
            /*
            if($stmt->rowCount()<1) 
            {  
                $stmt=$conn->prepare("insert into UI__PoolCoupon (custId,Tdate) values(:custId,:Tdate)  ");   
                $stmt->bindValue(':custId',   $_REQUEST['poolId'] , PDO::PARAM_INT);  
                $stmt->bindValue(':Tdate',   date("d-M-Y") , PDO::PARAM_INT);  
                $stmt->execute();    
                LvBal($_SESSION['userId'],1000,1,"Pool Coupon",$_SESSION['userId'] );
                $_SESSION['CoupnAmt'] = "Coupon used successfully";
            }else
                $_SESSION['CoupnAmt'] = "Sorry please try on next month";
            */
            
            $_SESSION['CoupnAmt'] = "Sorry please try on next month"; 
            header("Location: poolPlan100k.php?poolId=".$_REQUEST['poolId']);
            die;
