?
| Current Path : /home/webyoo/www/hanessiim/site/admin/ |
| Current File : /home/webyoo/www/hanessiim/site/admin/payment_direct.php |
<?php
include_once "start.php";
if (isset($_POST['amount']) && $_POST['amount'] > 0 && $_POST['id_user'] > 0 && isset($_POST['type_payment']) && in_array((int)$_POST['type_payment'], [2, 3, 4, 5, 6], true)) {
$id_user = mysqli_real_escape_string($link, $_POST['id_user']);
$fullname = mysqli_real_escape_string($link, $_POST['fullname']);
$email = mysqli_real_escape_string($link, $_POST['email']);
$tel = mysqli_real_escape_string($link, $_POST['tel']);
$amount = mysqli_real_escape_string($link, $_POST['amount']);
$type_payment = intval($_POST['type_payment']);
$check_number = isset($_POST['check_number']) ? trim($_POST['check_number']) : '';
$check_bank = isset($_POST['check_bank']) ? trim($_POST['check_bank']) : '';
$check_account = isset($_POST['check_account']) ? trim($_POST['check_account']) : '';
if ($type_payment === 6 && ($check_number === '' || $check_bank === '' || $check_account === '')) {
echo "שגיאה: יש למלא את כל פרטי הצ'ק.";
exit;
}
// Générer un numéro de transaction unique
$num_transaction = 'DIR_' . uniqid();
// INSERT dans syna_payments (sans date_payment_update pour que return_page_new.php traite le PDF/email)
$query = mysqli_query($link, "INSERT INTO syna_payments SET
id_user = '".$id_user."',
fullname = '".$fullname."',
email = '".$email."',
tel = '".$tel."',
amount = '".$amount."',
type_payment = '".$type_payment."',
num_transaction = '".$num_transaction."',
date_payment = NOW()");
// Rediriger vers return_page_new.php avec les paramètres simulés
$params = http_build_query([
'PelecardTransactionId' => $num_transaction,
'PelecardStatusCode' => '000',
'ParamX' => $id_user . '~~' . $amount,
'type_payment' => $type_payment,
'check_number' => $type_payment === 6 ? $check_number : '',
'check_bank' => $type_payment === 6 ? $check_bank : '',
'check_account' => $type_payment === 6 ? $check_account : ''
]);
header("Location: return_page_new.php?" . $params);
exit;
} else {
echo "שגיאה: הנתונים שהוזנו אינם תקינים.";
}
?>