<?php

//$gpaCode = "7325537931655986301.7733974102916927";
//$purchaseToken = "vniwlhupshekbklkspltafwf.AO-J1ONzkbyJcntUcVoBPYzzJATQHzbfLpDyDxhmiVVZjNe-sHJkTzi_xnmTCWxlrWFIroTRjnDuSmqASnpVOLrRbagzeURKIChNFqNFCLrhOsoUIBDscwQqRfrrGfLSxPCLXDhgAYeP";

$gpaCode = "GPA.3380-7702-3487-25462";
$purchaseToken = "goakpmobbjficffimbgimgdc.AO-J1Oww6HeeBxZEf_tbGsDIwne2mk6r4SCoQlT7Z-tiWVM4qE8hoy7zvu-SVcD46NTIjjbFOIwTEUVStJM2918YTdpZg04yogZD3LOYiFx4dkRFVJ6OFlY";


    $pattern = '/^GPA\.\d{4}-\d{4}-\d{4}-\d{5}$/';
    $purchaseTokenLength = 144;

echo preg_match($gpaPattern, $gpaCode);



    // Veriyi şablona uygunluğunu kontrol et
if (!preg_match($gpaPattern, $gpaCode) || strlen($purchaseToken) !== $purchaseTokenLength) {
    $array = array("result" => "HATA - KOD: 2","type" => "0"); // GPA GELMEMİŞ.
            echo json_encode($array);
            exit;
    }