public function authorize($login, $password, $secpin) { $user_id = sql_get(' SELECT id FROM users WHERE login="******" AND password="******" AND status>0' . (LOGIN_PIN ? ' AND secpin="' . $secpin . '"' : '')); if ($user_id) { $_SESSION['CUR_USER']['id'] = $user_id; Project::getInstance()->resetCurUser($user_id); } }
function get_page_link($params) { extract($params); if (Project::getInstance()->getCurUser()->isAdmin() && !sql_get('SELECT id FROM pages WHERE id="' . intval($id) . '"')) { return '/includes/inlines/admin/page.php?position=&id=' . intval($id) . '" target="_blank'; } return '/index.php?page=' . $id; }
SUM(IF(t.type="r", t.amount, NULL)) as referral, SUM(IF(t.type="i", t.amount, NULL)) as reinvest, SUM(IF(t.type="b", t.amount, NULL)) as bonus FROM users LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0 GROUP BY users.id ORDER BY ' . (!empty($_REQUEST['order_by']) ? addslashes($_REQUEST['order_by']) : 'reg_date DESC') . ' ' . get_limit() . ' '); $users = array(); while ($row = mysql_fetch_assoc($result)) { $row['ips'] = isset($ips[$row['id']]) ? $ips[$row['id']] : array(); $row['bads'] = isset($bads[$row['id']]) ? intval($bads[$row['id']]) : 0; $row['ipsec'] = 0; $users[$row['id']] = $row; } foreach ($users_by_ips as $ip => $u_ids) { if (count($u_ids) > 1) { foreach ($u_ids as $u_id) { if (!isset($users[$u_id])) { continue; } $users[$u_id]['ipsec'] = 1; $users[$u_id]['ips'][$ip] = '(' . implode(',', $u_ids) . ')'; } } } Project::getInstance()->getSmarty()->assign('pagination', pagination(sql_get('SELECT FOUND_ROWS()'))); Project::getInstance()->getSmarty()->assign('users', stripslashes_array($users)); Project::getInstance()->getSmarty()->display('../default/admin/users.tpl'); }
public function getAttemptsCount($plan_id) { return sql_get("\n\t\t\tSELECT count(*) FROM translines \n\t\t\tWHERE user_id='{$this->user_id}' and plan_id='{$plan_id}' and type='d' and status='2'\n\t\t"); }
$payment_id = intval($_REQUEST['payment_id']); $line = stripslashes_array(sql_row('select * from translines where id="' . $payment_id . '"')); if ($line['amount'] == $_REQUEST['lr_amnt']) { $query = 'update translines set stamp="' . Project::getInstance()->getNow() . '", status="1", batch="' . $_REQUEST["lr_transfer"] . '" where id="' . $payment_id . '"'; sql_query($query); $user = stripslashes_array(sql_row('SELECT * FROM users WHERE id="' . $line['user_id'] . '"')); if ($user['deposit_notify']) { include_once LIB_ROOT . '/emails.class.php'; $plan = stripslashes_array(sql_row('SELECT * FROM plans WHERE id="' . $line['plan_id'] . '"')); //%user_fullname%, %user_login%, %amount%, %batch%, %access_time%, %account%, %plan_name%, %project_name%, %project_email% $params = array('%user_fullname%' => htmlspecialchars($user['fullname']), '%user_login%' => $user['login'], '%account%' => $_REQUEST['lr_paidby'], '%amount%' => $_REQUEST['lr_amnt'], '%batch%' => $_REQUEST['lr_transfer'], '%plan_name%' => htmlspecialchars($plan['name']), '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow())); $email = new Emails($user['id'], 'deposit_notify', $params); $email->send(); } if (!empty($user['referral'])) { $referral_id = sql_get('select id from users where login="******" limit 1'); if ($referral_id) { $referral_bonus = $line['amount'] * get_setting('referral_bonus') / 100; sql_query('insert into translines values (0, 0, "' . $referral_id . '", "", "r", "' . $referral_bonus . '", "' . Project::getInstance()->getNow() . '", "1", "Bonus from: ' . $user['login'] . '")'); $ref_msg = $user['login'] . '->' . $user['referral'] . ':' . $line['amount'] . "\n"; if (REFERRAL_ONCE) { sql_query('update users set referral="" where id="' . $user['id'] . '"'); } } } $msgBody = "Payment was verified and is successful.\n\n"; } } else { // This block is for the code in case that the payment verification has // failed. // In our example write the response to the body of the email we are
public function getLastVisit() { return sql_get('select max(stamp) from visits where user_id="' . $this->user_id . '"'); }
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> You have already deposited ' . $plan['attempts'] . ' times in this plan!</p>'); } elseif (isset($_POST['amount']) && floatval($_POST['amount']) >= $plan['min'] && floatval($_POST['amount']) <= $plan['max']) { Project::getInstance()->getSmarty()->assign('plan', $plan); Project::getInstance()->getSmarty()->assign('balance', $balance); Project::getInstance()->showPage('user/deposit_confirm.tpl'); } else { location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Incorrect amount has been defined!</p>'); } } else { location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Investment plan does not exist!</p>'); } } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'deposit') { $plan = stripslashes_array(sql_row('SELECT * FROM plans WHERE id="' . intval($_POST['plan_id']) . '"')); if ($plan['id']) { $user_attempts = sql_get(' SELECT count(*) FROM translines WHERE user_id="' . $user['id'] . '" and plan_id="' . $plan['id'] . '" and type="d" and status="2" '); //���� ��������� ���-�� ������� � ���� ���� if ($plan['attempts'] != 0 && $user_attempts >= $plan['attempts']) { location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> You have already deposited ' . $plan['attempts'] . ' times in this plan!</p>'); } elseif (isset($_POST['amount']) && floatval($_POST['amount']) >= $plan['min'] && floatval($_POST['amount']) <= $plan['max']) { if ($_POST['source'] == '0') { if ($_POST['amount'] <= $balance) { sql_query(' INSERT INTO translines SET id=0, parent_id=0, user_id="' . $user['id'] . '", plan_id="' . $plan['id'] . '", type="d",
public function getCountUnread() { return sql_get("SELECT COUNT(id) FROM messages WHERE user_id='{$this->user->id}' AND readed='0'"); }
*/ if (get_setting('daily_limit') == 0 && $user['daily_withdrawal_limit'] == 0) { $daily_limit = 0; } if (get_setting('daily_limit') == 0 && $user['daily_withdrawal_limit'] > 0) { $daily_limit = floatval($user['daily_withdrawal_limit']); } elseif (get_setting('daily_limit') > 0 && $user['daily_withdrawal_limit'] == 0) { $daily_limit = floatval(get_setting('daily_limit')); } elseif (get_setting('daily_limit') > $user['daily_withdrawal_limit']) { $daily_limit = floatval($user['daily_withdrawal_limit']); } else { $daily_limit = floatval(get_setting('daily_limit')); } $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $today_end = mktime(23, 59, 59, date('m'), date('d'), date('Y')); $withdrawnToday = floatval(sql_get('SELECT ABS(SUM(amount)) FROM translines WHERE user_id="' . $user['id'] . '" AND type="w" AND (stamp BETWEEN ' . $today_start . ' AND ' . $today_end . ')')); if ((floatval($_POST['amount']) <= $limit || $limit == 0) && (floatval($_POST['amount']) + $withdrawnToday <= $daily_limit || $daily_limit == 0)) { sql_query(' INSERT INTO translines SET id=0, parent_id=0, user_id="' . $user['id'] . '", plan_id=0, type="w", amount="-' . abs(floatval($_POST['amount'])) . '", stamp="' . Project::getInstance()->getNow() . '", status="0", batch="" '); $payment_id = sql_insert_id();
} if ($_POST['position']) { //если указана позиция то сдвигаем предыдущие на 1 назад sql_query(' UPDATE pages SET position = position+1 WHERE position > ' . intval($_POST['position']) . ' AND lang="' . $_COOKIE['lang'] . '" '); } sql_query('REPLACE pages SET id="' . intval($_POST['id']) . '", position="' . intval($_POST['position'] + 1) . '", home="' . intval($_POST['home']) . '", name="' . $_POST['name'] . '", show_in_menu="' . intval($_POST['menu']) . '", text="' . $_POST['text'] . '", lang="' . $_COOKIE['lang'] . '"'); if (!intval($_POST['id'])) { $_POST['id'] = mysql_insert_id(); } location('/includes/inlines/admin/page.php?id=' . $_POST['id'], '<div class=imp>Page saved</div>'); } else { location('/includes/inlines/admin/page.php', '<div class=imp>Fill all fields</div>'); } } else { $page = sql_row('SELECT * FROM pages WHERE id="' . intval($_REQUEST['id']) . '" AND lang="' . $_COOKIE['lang'] . '"'); if (empty($page)) { $page['position'] = !isset($_REQUEST['position']) ? intval(sql_get('SELECT MAX(position) FROM pages')) : intval($_REQUEST['position']); $page['id'] = intval($_REQUEST['id']); } } Project::getInstance()->getSmarty()->assign('page', $page); Project::getInstance()->getSmarty()->display('../default/admin/page.tpl');