Joywork/robokassa/result.php
2026-05-22 21:21:54 +03:00

54 lines
1.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once("../config.php");
// регистрационная информация (пароль #2)
// registration info (password #2)
$mrh_pass2 = "ouDBf9w9IekYuu9k6R1K";
//установка текущего времени
//current date
$tm=getdate(time()+9*3600);
$date="$tm[year]-$tm[mon]-$tm[mday] $tm[hours]:$tm[minutes]:$tm[seconds]";
// чтение параметров
// read parameters
$out_summ = $_REQUEST["OutSum"];
$inv_id = $_REQUEST["InvId"];
$shp_item = $_REQUEST["Shp_item"];
$crc = $_REQUEST["SignatureValue"];
$crc = strtoupper($crc);
$my_crc = strtoupper(md5("$out_summ:$inv_id:$mrh_pass2:Shp_item=$shp_item"));
// проверка корректности подписи
// check signature
if ($my_crc !=$crc)
{
echo "bad sign\n";
exit();
}
// признак успешно проведенной операции
// success
echo "OK$inv_id\n";
$sql = "UPDATE payments SET status = 1 WHERE id = $inv_id";
mysql_query($sql);
$sql = "SELECT * FROM payments WHERE id = $inv_id";
$rez = mysql_query($sql);
$pay = mysql_fetch_assoc($rez);
$sql = "UPDATE users SET date_tarif=NOW() WHERE id = $pay[id_user]";
mysql_query($sql);
// запись в файл информации о прведенной операции
// save order info to file
$f=@fopen("order.txt","a+") or
die("error");
fputs($f,"order_num :$inv_id;Summ :$out_summ;Date :$date\n");
fclose($f);
?>