69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
/**
|
|
* оформление заказа
|
|
*/
|
|
|
|
function checkout_kuri($priceslug, $buy_type = 1){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$price_id = db_get("SELECT * FROM `price` WHERE `priceslug` = '$priceslug' LIMIT 1");
|
|
|
|
if (isset($price_id['price_id'])) {
|
|
|
|
|
|
if ($buy_type == 1){ // тип товара
|
|
$price = $price_id['price']; // электронная книжка
|
|
}
|
|
else {
|
|
$price = $price_id['offline_price']; // бумажная книжка
|
|
}
|
|
|
|
|
|
if (defined('CLIENT_ID')){
|
|
|
|
$client = client_find_id(CLIENT_ID);
|
|
|
|
if (isset($client['result']['client_id'])){
|
|
$clienthash = $client['result']['clienthash'];
|
|
}
|
|
|
|
}
|
|
|
|
if (isset($_POST['clientmail'])){
|
|
|
|
$clientmail = $_POST['clientmail'];
|
|
|
|
if (!filter_var($clientmail, FILTER_VALIDATE_EMAIL)){
|
|
$error_mail = True;
|
|
}
|
|
else {
|
|
# получаем хэш клиента чтобы отправить на оплату
|
|
$clienthash = api_add_client($clientmail);
|
|
|
|
}
|
|
}
|
|
|
|
if (isset($clienthash) and $clienthash) {
|
|
$paylink = PAYSITE."anpay/$priceslug/$clienthash";
|
|
header("Location: $paylink");
|
|
return True;
|
|
}
|
|
|
|
|
|
}
|
|
else {
|
|
$error_price = True;
|
|
}
|
|
|
|
$submit_link = SITE."checkout/$priceslug/$buy_type";
|
|
|
|
include VIEWPATH.'checkout.phtml';
|
|
|
|
|
|
} |