include 'includes/asslinks.php'; } elseif ($itemID_ == 2212) { include 'includes/paylinks.php'; } elseif ($itemID_ == 3212) { include 'includes/rellinks.php'; } elseif ($itemID_ == 5212) { include 'includes/applinks.php'; } else { if ($selMode == ebpls_nbusiness) { include 'includes/eNature-inc.php'; } } } //end while // Figure out the total number of results in DB: $total_results = Result($dbtype, Query1($dbtype, $dbLink, $cntsql), 0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks ?> <!--<table border=0 width=100%> <tr><td>--> <?php echo "<div align=left> <br />"; // Build Previous Link if ($selMode == 'ebpls_nbusiness') { if ($page > 1) { $prev = $page - 1; echo "<a href={$PHP_SELF}?part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&action_={$action_}&page={$prev}&ascdesc1={$ascdesc1}&reftype={$reftype}&searcheenat={$searcheenat}><< Prev</a> "; } for ($i = 1; $i <= $total_pages; $i++) {
$Name = $_POST['Name']; $Email = $_POST['Email']; $DateTime = $_POST['DateTime']; $IpAddress = $_POST['IpAddress']; $CardLastFour = $_POST['CardLastFour']; $CardType = $_POST['CardType']; $Token = $_POST['Token']; include_once '_class/mysql.php'; $DB = new DB(); if (!$DB->link) { die(Result()); } // проверяем есть ли оплата с такой транзакцией $sql = 'select a.ID from ' . $TABLE_PAY . ' a ' . 'where a.transaction_id = "' . $DB->escape_string($TransactionId) . '" and a.waiting = 1'; $result = $DB->query($sql) or die(Result()); if ($DB->num_rows($result) == 0) { die(Result()); } $id_pay = mysql_result($result, 0); foreach ($_POST as $key => $value) { // на всякий случай сохраняем все переданные параметры в строку $data_post .= ' "' . $key . '" => "' . $value . '",'; } $sql = "update {$TABLE_PAY} " . "set " . "`dor_id` = '" . $DB->escape_string($dor_id) . "', " . "`contr_id` = '" . $DB->escape_string($contr_id) . "', " . "`amount` = " . $DB->escape_string(floatval($Amount)) . ", " . "`datetime_load_server` = CURRENT_TIMESTAMP(), " . "`datetime_load` = '" . $DB->escape_string($DateTime) . "', " . "`datetime_unloading` = null, " . "`token` = '" . $DB->escape_string($Token) . "', " . "`card_last_four` = '" . $DB->escape_string($CardLastFour) . "', " . "`card_type` = '" . $DB->escape_string($CardType) . "', " . "`user_name` = '" . $DB->escape_string($Name) . "', " . "`ip_address` = '" . $DB->escape_string($IpAddress) . "', " . "`transaction_id` = '" . $DB->escape_string($TransactionId) . "', " . "`email` = '" . $DB->escape_string($Email) . "', " . '`is_loaded` = 0,' . "`query_string` = '" . $DB->escape_string($data_post) . "', " . "`waiting` = 0" . "where `id` = " . $id_pay; $DB->query($sql) or die(Result()); echo Result(); function Result() { return '{"code":0}'; // система оплаты всегда ждет этот ответ исходя из документации }
function fetchResult() { $res = Query(func_get_args()); if ($res->num_rows == 0) { return -1; } return Result($res, 0, 0); }
$Amount = $_POST['Amount']; $Name = $_POST['Name']; $Email = $_POST['Email']; $DateTime = $_POST['DateTime']; $IpAddress = $_POST['IpAddress']; $CardLastFour = $_POST['CardLastFour']; $CardType = $_POST['CardType']; // проверяем есть ли оплата с такой транзакцией, хотя ее быть еще и так не должно. $sql = 'select a.ID from ' . $TABLE_PAY . ' a ' . 'where a.transaction_id = "' . $DB->escape_string($TransactionId) . '"'; $result = $DB->query($sql) or die(Result(13)); if ($DB->num_rows($result) > 0) { die(Result(13)); } $sql = "insert into {$TABLE_PAY}(" . "`dor_id`, " . "`contr_id`, " . "`amount`, " . "`datetime_load_server`, " . "`datetime_load`, " . "`datetime_unloading`, " . "`card_last_four`, " . "`card_type`, " . "`user_name`, " . "`ip_address`, " . "`transaction_id`, " . "`email`, " . "`is_loaded`, " . "`query_string`, " . "`waiting`" . ")" . "values(" . "'" . $DB->escape_string($dor_id) . "', " . "'" . $DB->escape_string($contr_id) . "', " . $DB->escape_string(floatval($Amount)) . ", " . "CURRENT_TIMESTAMP(), " . "'" . $DB->escape_string($DateTime) . "', " . "null, " . "'" . $DB->escape_string($CardLastFour) . "', " . "'" . $DB->escape_string($CardType) . "', " . "'" . $DB->escape_string($Name) . "', " . "'" . $DB->escape_string($IpAddress) . "', " . "'" . $DB->escape_string($TransactionId) . "', " . "'" . $DB->escape_string($Email) . "', " . "0, " . "'" . $DB->escape_string($data_post) . "'," . "1" . ")"; $DB->query($sql) or die(Result(13)); echo Result(0); break; case 1: echo Result(10); break; } } else { echo Result(10); } } else { echo Result(13); } function Result($code) { return '{"code":' . $code . '}'; }
die("No user specified!"); } $u = (int) $_GET['u']; $user = Fetch(Query("select regdate from {users} where id = {0}", $u)); $vd = date("m-d-y", $user['regdate']); $dd = mktime(0, 0, 0, substr($vd, 0, 2), substr($vd, 3, 2), substr($vd, 6, 2)); $dd2 = mktime(0, 0, 0, substr($vd, 0, 2), substr($vd, 3, 2) + 1, substr($vd, 6, 2)); $nn = Query("select from_unixtime(date, '%Y%m%d') ymd, floor(date / 86400) d, count(*) c, max(num) m from {posts} where user = {0} group by ymd order by ymd", $u); while ($n = Fetch($nn)) { $p[$n[$d]] = $n[c]; $t[$n[$d]] = $n[m]; } for ($i = 0; $dd + $i * 86400 < time(); $i++) { $ps = Query("select count(*),max(num) from {posts} where user = {3} and date >= {0} + {1} * 86400 and date < {2} + {1} * 86400", $dd, $i, $dd2, $u); $p[$i] = Result($ps, 0, 0); $t[$i] = Result($ps, 0, 1); } $days = floor((time() - $dd) / 86400); $m = max($p); header('Content-type:image/png'); $img = imagecreatetruecolor($days, $m); imagesavealpha($img, true); $c['bk'] = imagecolorallocatealpha($img, 0, 0, 0, 127); $c['bg1'] = imagecolorallocatealpha($img, 0, 0, 0, 127); $c['bg2'] = imagecolorallocatealpha($img, 0, 0, 0, 100); $c['bg3'] = imagecolorallocatealpha($img, 0, 0, 0, 64); $c['mk1'] = imagecolorallocate($img, 110, 110, 160); $c['mk2'] = imagecolorallocate($img, 70, 70, 130); $c['bar'] = imagecolorallocatealpha($img, 250, 190, 40, 64); $c['pt'] = imagecolorallocate($img, 250, 190, 40); imagefill($img, 0, 0, $c['bk']);