<?php // 检查用户是否已登录并存在 // 检查用户是否已经抽过奖,如果已经抽过奖则返回兑奖码 // 抽奖库存运算 require_once '../app/common.php'; require_once '../app/gift.php'; $data = []; if (isset($_GET['uid'])) { $uid = $_GET['uid']; $gift = new gift(); $data = $gift->getGift($uid); } else { $data['status'] = -1; $data['data'] = '未登录'; } header('Content-type: application/json'); if (isset($_REQUEST['callback'])) { echo sprintf("%s(%s)", $_REQUEST['callback'], json_encode($data)); } else { echo json_encode($data); } exit;
public function callbackAction() { // Убедимся что кеш выключен Zend_Registry::get('target')->enable_cache(0); // Проверим: а правильно ли пришли данные? $gift = new gift(@$_POST["gift_id"]); if (!$gift->get('id') || !isset($_POST["phone"])) { die(json_encode(array('msg' => 'Извините, заказ звонка не удался'))); } $_POST["email"] = $_POST["email"] == 'Email' ? '' : $_POST["email"]; //Преобразовываем номер телефона к единому виду.В номере телефона оставляем только цифры. $_POST["phone"] = preg_replace("/\\D/", "", $_POST["phone"]); // Расчитаем стоимость заказа обратного звонка $_POST['price_call'] = floor($_POST['gift_price'] * Zend_Registry::get('config')->callback->percent / 25) / 4; //Проверяем что бы цена звонка была не меньше заданой в конфиге минимальной стоимости звонка $_POST['price_call'] = $_POST['price_call'] >= Zend_Registry::get('config')->callback->min_price_call ? $_POST['price_call'] : Zend_Registry::get('config')->callback->min_price_call; $_POST['price_call'] = $_POST['price_call'] <= Zend_Registry::get('config')->callback->max_price_call ? $_POST['price_call'] : Zend_Registry::get('config')->callback->max_price_call; $_POST['ip'] = $_SERVER["REMOTE_ADDR"]; $_POST['user_agent'] = $_SERVER["HTTP_USER_AGENT"]; // Первым делом отправляем письмо юзеру - чтобы не волновался, по идее будем еще ему слать СМС $shops = new shop((int) $_POST['shop_id']); if (!empty($_POST["email"])) { $work_time = $shops->get('work_time'); $et = new email_template('callback_user'); $et->assign('USER_NAME', $_POST["name"])->assign('GIFT_NAME', $gift->get('display_name'))->assign('SHOP_NAME', $shops->get('display_name'))->assign('URL_GIFT', "http://{$_SERVER['SERVER_NAME']}/" . $gift->get('local_url') . '/?utm_source=email&utm_medium=user&utm_campaign=callback_user')->assign('WORK_TIME', !empty($work_time) ? 'Время работы магазина: <strong>' . $work_time . '</strong>' : '')->send($_POST["email"], $_POST["name"])->send('*****@*****.**'); } //Записываем заказ звонка в таблицу p_stat_out в любом случае $stat = new stat(); $stat_id = $stat->insert(array('gift_id' => (int) $_POST["gift_id"], 'category_id' => (int) @$_POST["category_id"], 'gift_name' => $gift->get('display_name'), 'cpc' => (double) $_POST['price_call'], 'price' => (int) $_POST['gift_price'], 'partner_id' => (int) $shops->get('partner_id'), 'ip' => $_POST["ip"], 'user_agent' => $_POST["user_agent"], 'from_url' => $gift->get('local_url'), 'to_url' => $_POST["url"], 'click_type' => 2)); $callback = new p_callback(); //Проверяем наличие одинаковых записей за временный интервал $exist_reserves = $callback->select($count, array('filter' => array('gift_id' => (int) $_POST["gift_id"], 'name' => $_POST["name"], 'phone' => $_POST["phone"], 'email' => $_POST["email"], 'interval' => Zend_Registry::get('config')->callback->interval_order))); if (empty($exist_reserves)) { //Записываем заказ звонка в таблицу p_callback $callback->insert(array('name' => $_POST["name"], 'phone' => $_POST["phone"], 'email' => $_POST["email"], 'stat_id' => (int) $stat_id, 'gift_id' => (int) $_POST["gift_id"], 'gift_name' => $gift->get('display_name'), 'gift_price' => (int) $_POST['gift_price'], 'shop_id' => (int) $_POST['shop_id'], 'partner_id' => (int) $shops->get('partner_id'), 'to_url' => $_POST["url"], 'price_call' => (double) $_POST['price_call'], 'ip' => $_POST["ip"], 'user_agent' => $_POST["user_agent"], 'comment' => !empty($_POST['comment']) ? $_POST['comment'] : '')); //Отправляем письмо партнеру $et = new email_template('callback'); $et->assign('GIFT_NAME', $gift->get('display_name'))->assign('BUYER_NAME', $_POST["name"])->assign('PHONE', $_POST["phone"])->assign('EMAIL', $_POST["email"])->assign('SHOP_NAME', $shops->get('display_name'))->assign('URL_GIFT', $_POST["url"])->assign('STAT_URL', "http://{$_SERVER['SERVER_NAME']}/stat/callback/?utm_source=email&utm_medium=partner&utm_campaign=callback")->assign('COMMENT', !empty($_POST['comment']) ? $_POST['comment'] : '')->send(Zend_Registry::get('config')->server->enviroment == 'live' ? $shops->get('callback_email') : Zend_Registry::get('config')->log->error_email)->send('*****@*****.**'); } die(json_encode(array('msg' => 'Заказ звонка принят, спасибо'))); }
<?php /*! * ifsoft.co.uk v1.0 * * http://ifsoft.co.uk * vsysteme@mail.ru * * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk) */ include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php"; if (admin::isSession()) { header("Location: /"); } $admin = new admin($dbo); $gift = new gift($dbo); if ($admin->getCount() > 0) { header("Location: /"); } include_once $_SERVER['DOCUMENT_ROOT'] . "/core/initialize.inc.php"; $page_id = "install"; $error = false; $error_message = array(); $user_username = ''; $user_fullname = ''; $user_password = ''; $user_password_repeat = ''; $error_token = false; $error_username = false; $error_fullname = false; $error_password = false;
<?php defined('IN_DESTOON') or exit('Access Denied'); $TYPE = get_type('gift', 1); require MD_ROOT . '/gift.class.php'; $do = new gift(); $menus = array(array('添加礼品', '?moduleid=' . $moduleid . '&file=' . $file . '&action=add'), array('礼品列表', '?moduleid=' . $moduleid . '&file=' . $file), array('订单列表', 'javascript:Dwidget(\'?moduleid=' . $moduleid . '&file=' . $file . '&action=order\', \'订单管理\');'), array('更新地址', '?moduleid=' . $moduleid . '&file=' . $file . '&action=update'), array('礼品分类', 'javascript:Dwidget(\'?file=type&item=' . $file . '\', \'礼品分类\');'), array('模块设置', '?moduleid=' . $moduleid . '&file=setting#' . $file)); if ($_catids || $_areaids) { require DT_ROOT . '/admin/admin_check.inc.php'; } switch ($action) { case 'add': if ($submit) { if ($do->pass($post)) { $do->add($post); dmsg('添加成功', $forward); } else { msg($do->errmsg); } } else { foreach ($do->fields as $v) { isset(${$v}) or ${$v} = ''; } $groupid = '5,6,7'; $addtime = timetodate($DT_TIME); $menuid = 0; include tpl('gift_edit', $module); } break; case 'edit': $itemid or msg();
<?php /*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk) */ include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php"; if (!empty($_POST)) { $clientId = isset($_POST['clientId']) ? $_POST['clientId'] : 0; $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0; $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : ''; $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0; $clientId = helper::clearInt($clientId); $accountId = helper::clearInt($accountId); $itemId = helper::clearInt($itemId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $gift = new gift($dbo); $gift->setRequestFrom($accountId); $result = $gift->remove($itemId); echo json_encode($result); exit; }
public function check_decline_price_giftsAction() { $decline = new p_decline_price_gifts(); $decline_price_gifts = $decline->select($count, array('filter' => array('find_decline_prices' => true, 'status' => 0))); if (!empty($decline_price_gifts)) { $i = 1; foreach ($decline_price_gifts as $decline) { $gift = new gift($decline->gift_id); $id[] = $decline->id; $email = new email_template('decline_price_gift'); $email->assign('GIFT_NAME', $gift->get('display_name'))->assign('OLD_PRICE', $decline->old_price)->assign('PRICE', $decline->price)->assign('LINK', "http://{$_SERVER['HTTP_HOST']}/" . $gift->get('local_url') . '/?utm_source=email&utm_medium=user&utm_campaign=decline_price_gifts')->assign('USER_NAME', $decline->user_name)->send($decline->email, $decline->user_name)->send('*****@*****.**'); $list .= $i . '. <a href="http://' . $_SERVER["HTTP_HOST"] . '/' . $gift->get('local_url') . '/"><b>' . $gift->get('display_name') . "</b></a> {$decline->user_name} <{$decline->email}><br>Старая цена: {$decline->old_price} руб.<br>Новая цена: <b>{$decline->price}</b> руб.<br><br>"; $i++; } $decline->set_status(1, $id); $em = new email_template('decline_price_gift_us'); $em->assign('COUNT', count($id))->assign('LIST', !empty($list) ? $list : '')->send('*****@*****.**'); } die('OK'); }
<?php /*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk) */ include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php"; if (!admin::isSession()) { header("Location: /admin/login.php"); } $stats = new stats($dbo); $gift = new gift($dbo); $page_id = "gifts"; $error = false; $error_message = ''; if (isset($_GET['action'])) { $action = isset($_GET['action']) ? $_GET['action'] : ''; $id = isset($_GET['id']) ? $_GET['id'] : 0; $action = helper::clearText($action); $action = helper::escapeText($action); $id = helper::clearInt($id); if (!APP_DEMO) { switch ($action) { case 'remove': $gift->db_remove($id); header("Location: /admin/gifts.php"); break;
$accountId = helper::clearInt($accountId); $giftId = helper::clearInt($giftId); $giftAnonymous = helper::clearInt($giftAnonymous); $giftTo = helper::clearInt($giftTo); $message = helper::clearText($message); $message = preg_replace("/[\r\n]+/", "<br>", $message); //replace all new lines to one new line $message = preg_replace('/\\s+/', ' ', $message); //replace all white spaces to one space $message = helper::escapeText($message); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $gift = new gift($dbo); $gift->setRequestFrom($accountId); $giftInfo = $gift->db_info($giftId); if ($giftInfo['error'] === false && $giftInfo['removeAt'] == 0) { $account = new account($dbo, $accountId); $balance = $account->getBalance(); if ($balance == $giftInfo['cost'] || $balance > $giftInfo['cost']) { $result = $gift->send($giftId, $giftTo, $message, $giftAnonymous); if ($result['error'] === false) { $account->setBalance($balance - $giftInfo['cost']); $result['balance'] = $balance - $giftInfo['cost']; } } } echo json_encode($result); exit;
/*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk) */ include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php"; if (!empty($_POST)) { $clientId = isset($_POST['clientId']) ? $_POST['clientId'] : 0; $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0; $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : ''; $profileId = isset($_POST['profileId']) ? $_POST['profileId'] : 0; $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0; $clientId = helper::clearInt($clientId); $accountId = helper::clearInt($accountId); $profileId = helper::clearInt($profileId); $itemId = helper::clearInt($itemId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $gifts = new gift($dbo); $gifts->setRequestFrom($accountId); $result = $gifts->get($profileId, $itemId); echo json_encode($result); exit; }
<?php defined('IN_DESTOON') or exit('Access Denied'); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MOD['gift_enable'] or dheader(DT_PATH); $TYPE = get_type('gift', 1); require MD_ROOT . '/gift.class.php'; $do = new gift(); $typeid = isset($typeid) ? intval($typeid) : 0; switch ($action) { case 'my': login(); $condition = "username='******'"; $lists = $do->get_my_order($condition); $head_title = $L['gift_my_order'] . $DT['seo_delimiter'] . $L['gift_title']; break; case 'order': login(); $itemid or dheader($MOD['gift_url']); $do->itemid = $itemid; $item = $do->get_one(); $item or dheader($MOD['gift_url']); extract($item); $left = $amount - $orders > 0 ? $amount - $orders : 0; $process = $left ? get_process($fromtime, $totime) : 4; if ($process == 1) { dalert($L['gift_error_1'], $linkurl); } if ($process == 3) { dalert($L['gift_error_3'], $linkurl); }
$data['data'] = $gift->getGiftListAll(); header('Content-type: application/json'); echo json_encode($data); } if ($action == 'getGiftItem') { $gift = new gift(); $data = []; $id = $_GET['id']; $data['status'] = 1; $data['data'] = $gift->getGiftItem($id); header('Content-type: application/json'); echo json_encode($data); } if ($action == 'setGiftItem') { $id = isset($_GET['id']) ? $_GET['id'] : 0; $itemdata = []; $itemdata['total'] = isset($_GET['total']) ? $_GET['total'] : 0; $itemdata['rate'] = isset($_GET['rate']) ? $_GET['rate'] : 0; $gift = new gift(); $data = []; $data['status'] = 1; $data['data'] = "修改完毕"; if ((int) $id == 3 || (int) $id == 4) { $gift->setGiftItem($id, $itemdata); } else { $data['status'] = -1; $data['data'] = "修改失败,已锁定"; } header('Content-type: application/json'); echo json_encode($data); }
<?php /*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk) */ include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php"; if (!empty($_POST)) { $clientId = isset($_POST['clientId']) ? $_POST['clientId'] : 0; $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0; $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : ''; $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0; $clientId = helper::clearInt($clientId); $accountId = helper::clearInt($accountId); $itemId = helper::clearInt($itemId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $gifts = new gift($dbo); $gifts->setRequestFrom($accountId); $result = $gifts->db_get($itemId); echo json_encode($result); exit; }