<?php
class Signature {
private $salt = '00f40f6dd20548c514e62b666ebb9e98';
public function setSalt($salt) {
$this->salt = $salt;
}
public function generate($orderNumber, $orderAmount) {
if( !empty($orderNumber) && !empty($orderAmount) && isset($this->salt) ) {
$orderId = htmlentities($orderNumber);
$orderAmount = htmlentities($orderAmount);
$amountSum = floatval(str_replace(array(',', ' ', "'", '`'), array('.', '', '', ''), $orderAmount)) * 100;
$salt = $this->salt;
$signature = md5($orderId.'&'.$orderAmount.'&'.$salt);
return $signature;
} else {
throw new Exception("Ошибка: Не верно переданны параметры для генерации сигнатуры", 1);
return 0;
}
}
}
$signature = new Signature;
$orderNumber = 1;
$orderAmount = 200;
$key = $signature->generate($orderNumber, $orderAmount);
echo 'http://mirusoft.ru/include/payments/aq.php?Signature='.$key.'&Order_ID='.$orderNumber.'&Subtotal='.$orderAmount.'&FirstName=Ivan&LastName=Ivanov&Email=ivan@ivanov.ru&Phone=1234567890'
- Output for 5.4.0 - 5.4.24
- Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/bJDsg on line 31
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/bJDsg on line 31
Process exited with code 255.
preferences:
182.33 ms | 1386 KiB | 61 Q