<?php
include 'conn.php';
//Select data from database

include 'funciones.php';


session_start();
$_SESSION['database'] = $_GET['database'];
$_SESSION['numero'] = $_GET['numero'];

$_SESSION['gift_monto'] ="";

$hoynow = getdate();


 if ($_SESSION['numero']==""){
$_SESSION['numero']="0";

}
 




   $timeStamp= $hoynow["year"]."-".$hoynow["mon"]."-".$hoynow["mday"]." ".$hoynow["hours"] .":".$hoynow["minutes"].":".$hoynow["seconds"] ;

   $timeStamp2= $hoynow["year"]."-".$hoynow["mon"]."-01 00:00:01";
//echo $timeStamp;


  $montoesql="select concat(ifnull(gift_certificate.gift_monto_ref,0),'-',ifnull(gift_certificate.gift_monto,0),'-',gift_certificate.gift_usado) as   gift_monto FROM ".$_SESSION['database'].".gift_certificate where gift_certificate.gift_number='".$_SESSION['numero']."' limit 1";
 


logs($montoesql);


$qur = $connection->query($montoesql);

while($r = mysqli_fetch_assoc($qur)){

$_SESSION['gift_monto'] = $r['gift_monto'];

 echo $_SESSION['gift_monto'];
}
	

if ($_SESSION['gift_monto']==""){
 echo "false";

}
 	   


@mysqli_close($conn);

?>
