1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.qrcode.min.js"></script>
<script>
$(document).ready(function() {
$('#output_qrcode').qrcode("https://www.monsite.fr/join.php?idmembre=800");
});
</script>
<?php
include("../mysqlcon.php");
$ans = ["operation" => false,"name" => ""];
$num = (isset($_POST["numero"]) && !empty($_POST["numero"]) && is_numeric($_POST["numero"]))?$_POST["numero"]:false;
$q = "Select COUNT(*) as carteok from commande where numerocarte='$num'";
$q = $conn->query($q);
$f = mysqli_fetch_array($q);
$numok = $f["carteok"];
$dirqr = '<div id="output_qrcode"></div>';
if($numok == 1){
$ans["operation"] = true;
$ans["name"] = createCarte("source.png",$num,"allCarte/",$dirqr);
$qu = "UPDATE commande SET carteok = 'ok', choix='duo' WHERE numerocarte='$num'";
$qu = $conn->query($qu);
}
echo json_encode($ans);
function createCarte($pathSoucre,$number,$cheminSave,$dirqr)
{
$carte = Imagecreatefrompng($pathSoucre);
$textcolor = imagecolorallocate($carte, 225, 29, 72);
$name = "carte_".$number."_.png";
$sizeCenter = (330 - (strlen($number)*10))/2;
imagestring($carte, 5, 700+$sizeCenter, 210, $number, $textcolor);
imagestring($carte, 5, 700+$sizeCenter, 110, $dirqr, $textcolor);
imagepng($carte,$cheminSave.$name);
return $name;
}
?> |
Partager