%PDF- %PDF-
Direktori : /var/www/html/buggydubrovnik.com/buggy-booking/ |
Current File : //var/www/html/buggydubrovnik.com/buggy-booking/checkPromo.php |
<?php /** * Created by PhpStorm. * User: Leo * Date: 20.3.2017. * Time: 17:04 */ function checkPromo($promo){ $servername = "localhost"; $username="buggydubrovnik_app_production"; $password="appr-17"; $db="buggydubrovnik_app_production"; // $username="root"; // $password=""; // Create connection $con = mysqli_connect($servername, $username, $password, $db); mysqli_query($con,"set names 'utf8'"); $promos=$con->query("SELECT * FROM promo_kod WHERE aktivan=1 AND kod ='".$con->real_escape_string($promo)."'"); return $promos->num_rows>0?$promos->fetch_assoc():false; } if(isset($_GET["promo"])){ $promo=$_GET["promo"]; $check=checkPromo($promo); echo json_encode(["check"=>!!$check, "id_promo"=>$check["id_promo_kod"], "amount"=>$check["iznos"]]); }