Dont scam hackers.
vclub.shop's source code.
Enjoy
sample:
vclub.shop's source code.
Enjoy
sample:
PHP:
<?php
class ManagmentController extends Controller
{
public function init()
{
Yii::import('application.models.admincp.reseller.*');
}
final public function accessRules()
{
return [
[
'allow',
'roles' => ['admin'],
], [
'allow',
'actions' => [
'updateInfo',
'updatesList',
'addDatabase',
'ccsPrices',
'getPriceList',
'index',
'ajax',
],
'roles' => ['manager'],
], [
'deny',
'users' => ['*'],
],
];
}
public function actionUpdateInfo()
{
$actionText = ' has changed database ';
$db_id = getParam('database_id');
$db_name = getParam('database_name');
$db_status = getParam('database_status');
$db_checker = getParam('database_checker');
$db_checkerchange = getParam('database_checkerchange');
$db_cvv = getParam('database_cvv');
$db_checker = (key_exists($db_checker, Yii::app()->params['checker'])) ? $db_checker : '';
$db_rare = getParam('database_rare');
$db_refunds = getParam('database_refunds');
//UPDATE INFO
if (!empty($db_id) && !empty($db_name) && in_array($db_status, array(0, 1))) {
$model = R_Bases::model()->findByPk($db_id);
if (!empty($model)) {
$actionText .= $model->name . '. ';
if ($model->name != $db_name) {
$actionText .= 'Name: ' . $model->name . ' -> ' . $db_name . '; ';
$model->name = $db_name;
}
if ($model->active != $db_status) {
$actionText .= 'Status: ' . $model->active . ' -> ' . $db_status . '; ';
$model->active = $db_status;
}
if ($model->checker != $db_checker) {
$actionText .= 'Checker: ' . $model->checker . ' -> ' . $db_checker . '; ';
$model->checker = $db_checker;
}
if ($model->checkerchange != $db_checkerchange) {
$actionText .= 'CheckerChange: ' . $model->checkerchange . ' -> ' . $db_checkerchange . '; ';
$model->checkerchange = $db_checkerchange;
}
if ($model->rare != $db_rare) {
$actionText .= 'Rare: ' . $model->rare . ' -> ' . $db_rare . '; ';
$model->rare = $db_rare;
}
if ($model->refunds != $db_refunds) {
$actionText .= 'Refunds: ' . $model->refunds . ' -> ' . $db_refunds . '; ';
$model->refunds = $db_refunds;
}
if ($model->withcvv != $db_cvv) {
$actionText .= 'With CVV: ' . $model->withcvv . ' -> ' . $db_cvv . '; ';
$model->withcvv = $db_cvv;
}
$model->price_approve = ($model->active == 1) ? 1 : 0;
$model->save();
switch ($model->type) {
case 1:
DAO()->update(
'{{ccs}}',
array('base_status' => $db_status, 'base_name' => $db_name),
'base_id=:db_id',
array(':db_id' => $db_id)
);
break;
case 2:
DAO()->update(
'{{dumps}}',
array('enabled' => $db_status, 'base_name' => $db_name),
'base_id=:db_id',
array(':db_id' => $db_id)
);
$this->actionRebuildDumpSection();
break;
case 3:
DAO()->update(
'{{accounts}}',
[
'base_status' => $db_status,
'base_name' => $db_name
],
'base_id=:db_id',
[':db_id' => $db_id]
);
break;
}
}
//ADDING PRICELIST:
$priceList = arrayPath($_REQUEST, 'priceList', array());
$priceList = json_decode($priceList, true);
$priceListOld = arrayPath($_REQUEST, 'priceListOld', array());
if (!empty($priceList)) {
//MODIFY INCOME DATA:
$searcharray = array();
parse_str($priceListOld, $searcharray);
$priceListOld = mergeArrayByKeys($searcharray['priceList']);
//$actionText .= "Price List: " . json_encode($priceList) . "; ";
//UPDATE PRICE LIST:
$price = new R_Price();
if (getParam('type') == 1) {
$model->updatePriceListInDb(getParam('database_id'), $priceList, 1);
$price->CCS_rebuildPrice(getParam('database_id'));
} elseif (getParam('type') == 2) {
$model->updatePriceListInDb(getParam('database_id'), $priceListOld, 2);
$price->DUMPS_rebuildPrice(getParam('database_id'));
} elseif (getParam('type') == 3) {
$model->updatePriceListInDb(getParam('database_id'), $priceListOld, 3);
$price->ACCS_rebuildPrice(getParam('database_id'));
}
}
log($actionText);
noty('Information was updated', 'success');
}
}
public function actionAddDatabase()
{
Yii::import('application.models.admincp.users.*');
$db_name = getParam('database_name');
$db_type = getParam('database_type');
$db_cvv = getParam('database_cvv');
$username = getParam('username');
$seller_id = (empty($username)) ? UID() : AUsers::model()->findByAttributes(array('username' => $username))->id;
DAO()->insert(
'{{bases}}',
[
'name' => $db_name,
'type' => $db_type,
'withcvv' => $db_cvv,
'seller_id' => $seller_id,
'active' => 0
]
);
noty('Database was created', 'success');
}
public function actionAddPayout()
{
Yii::import('application.models.admincp.users.AUsers');
$username = getParam('username');
$amount = getParam('amount');
$comment = getParam('comment');
$base_id = getParam('base_id');
if ($amount < 0) {
noty('Minimum $0', 'warning');
return false;
}
if ($amount > 1000) {
noty('Maximum $1000', 'warning');
return false;
}
$userInfo = Users::model()->findByAttributes(array('username' => $username));
if (empty($userInfo)) {
noty('Selected account not found', 'error');
}
DAO()->insert('{{payouts}}', array(
'amount' => $amount,
'base_id' => $base_id,
'user_id' => $userInfo->id,
'comment' => $comment,
'username' => $userInfo->username,
'created_at' => expr('NOW()'),
));
logSupportAction('created payout. Amount ' . $amount . ', base ID: ' . $base_id . ' user ID: ' . $userInfo->id
. ', comment: ' . $comment . ' user name: ' . $userInfo->username);
noty('Payout was added', 'success');
}
public function actionDisplayPayoutsInfoByDatabase()
{
$modelPayouts = new R_Payouts();
$modelPayouts->FilterByUserId(UID());
$database_id = getParam('database_id');
$this->render('_payoutStats', array(
'database_id' => $database_id,
'modelPayouts' => $modelPayouts,
));
}
public function actionAddPartner()
{
Yii::import('application.models.admincp.users.AUsers');
$username = getParam('username');
$percent = getParam('percent');
$base_id = getParam('base_id');
$userInfo = Users::model()->findByAttributes(array('username' => $username));
if (empty($userInfo)) {
noty('Selected account not found', 'error');
}
DAO()->insert('{{partners}}', array(
'percent' => $percent,
'base_id' => $base_id,
'user_id' => $userInfo->id,
'username' => $userInfo->username,
'created_at' => expr('NOW()'),
));
logSupportAction('added new partner ' . $userInfo->username . '(' . $userInfo->id . ') with '
. $percent . '% and base ID ' . $base_id);
noty('Partner was added', 'success');
}
public function actionRemovePartner()
{
return DAO()->delete(
'{{partners}}',
'user_id=:user_id AND base_id=:base_id',
array(
':user_id' => getParam('user_id'),
':base_id' => getParam('base_id'),
)
);
}
public function actionCCSPrices()
{
$prices = new R_Prices('search');
$prices->unsetAttributes();
if (isset($_GET[$prices->name()])) {
$prices->attributes = $_GET[$prices->name()];
}
$this->render('/admincp/reseller/managment/prices/ccs_prices', array(
'model' => $prices,
));
}
public function actionCCSAlias()
{
$prices = new R_Alias('search');
$prices->unsetAttributes();
if (isset($_GET[$prices->name()])) {
$prices->attributes = $_GET[$prices->name()];
}
$this->render('/admincp/reseller/managment/alias/alias_list', array(
'model' => $prices,
));
}
public function actionAddPriceCountry()
{
$price = getParam('price');
$fullz = getParam('fullz');
$country_name = getParam('country_name');
$timeout = getParam('timeout');
//ADDING PRICE
$prices = new R_Prices();
$prices->price = $price;
$prices->country_name = $country_name;
$prices->fullz = $fullz;
$prices->timeout = $timeout;
$prices->save();
$priceRules = new R_Price();
$priceRules->CCS_updatePriceByCountry($country_name, $price, $fullz);
$priceRules->CCS_rebuildPriceAll();
noty('Country was added', 'success');
}
public function actionUpdateProfitAllCache()
{
Yii::import('application.models.admincp.reseller.*');
$data = SQL('SELECT `id` FROM {{bases}};')->query();
$total_profit_all = 0;
foreach ($data as $row) {
$data2 = SQL("SELECT `user_id` FROM {{partners}} WHERE `base_id` = '" . $row['id'] . "';")->query();
if ($data2) {
foreach ($data2 as $row2) {
$total_profit_all += R_Partners::model()->getCurrentProfit($row2['user_id'], $row['id']);
}
}
}
Yii::app()->cache->set('total_profit_all', $total_profit_all);
Yii::import('application.models.admincp.operations.*');
Yii::import('application.models.admincp.operations.bitcoin.*');
Yii::import('application.models.admincp.operations.bitcoin.forms.*');
$bitcoinModel = new Bitcoin();
$btc_rate = $bitcoinModel->getBTC_rate(true);
$info = $bitcoinModel->connection->getwalletinfo();
$balance = $info['balance'] * $btc_rate;
$total_profit_all = round($total_profit_all, 2);
$balance = round($balance, 2);
$free_balance = round(($balance - $total_profit_all), 2);
if ($free_balance <= 0) {
$free_balance = '<b style="color:red">' . $free_balance . '</b>';
}
$total_users_balance = DAO()
->select("SUM(amount)")
->from("{{operations}}")
->where("status=1")
->queryScalar();
$line = '| Balance: $' . $balance . ' | Total users profit: $' . $total_profit_all . ' <br>| Free balance: $' . $free_balance . ' | Total users balance: $' . $total_users_balance;
noty($line, 'success');
}
public function actionGetPriceList()
{
$model = new R_Bases();
$list = $model->getPriceListInDb(getParam('id'), getParam('type'));
echo CJSON::encode($list);
}
public function actionRebuildDumpSection()
{
$model = new R_Bases();
$priceRules = new R_Price();
$model->rebuildBinlistAll();
$priceRules->DUMPS_rebuildPriceAll();
}
public function actionUpdatesList()
{
//BASES INFO
$modelBases = new R_Bases();
//CCS UPDATES:
$modelUpdatesCCS = new R_Updates_CCS();
//DUMPS UPDATES:
$modelUpdatesDUMPS = new R_Updates_Dumps();
//ACCS UPDATES:
$modelUpdatesACCS = new R_Updates_ACCS();
$this->render('/admincp/reseller/managment/updates/updateslist', array(
'modelUpdatesCCS' => $modelUpdatesCCS,
'modelUpdatesDUMPS' => $modelUpdatesDUMPS,
'modelUpdatesACCS' => $modelUpdatesACCS,
'modelBases' => $modelBases,
));
}
public function actionRemoveMultipleBases()
{
$bases = getParam('bases');
if (count($bases) == 0) {
noty('Check bases', 'warning');
}
if (strlen(getParam('resellerPWD')) == 0) {
noty('Insert password', 'warning');
}
foreach ($bases as $base) {
$base = preg_replace('#[^0-9]+#', '', $base);
$_GET['method'] = 'removeBase';
$_GET['database_id'] = $base;
$this->actionAjax();
}
noty('Success remove ' . count($bases) . ' base(s)', 'success');
}
public function actionMassChangeChecker()
{
$checkers = Yii::app()->params['checker'];
unset($checkers['default']);
unset($checkers['default_dumps']);
$checker = getParam('massChangeChecker');
if (!key_exists($checker, $checkers)) {
noty('Select checker from list', 'warning');
}
SQL("update {{bases}} set checker='" . $checker . "' where checker<>'' and (checker='" . implode("' or checker='", array_keys($checkers)) . "')")->query();
noty('Success setting "' . $checkers[$checker]['name'] . '" checker on all bases', 'success');
}
public function actionMassMergeBases()
{
$bases = getParam('bases');
$mainBase = getParam('massMergeBases');
$baseIn = DAO()->select('*')->from('{{bases}}')->where("id='" . $mainBase . "'")->queryRow();
while (list($k, $v) = each($bases)) {
$baseOut[] = $v;
}
$sql = array();
$res = SQL('select * from tbl_bases where ' . (count($baseOut) > 0 ? 'id in (' . implode(',', $baseOut) . ')' : '') . '')->queryAll();
while (list($k, $row) = each($res)) {
if ($row['id'] == $baseIn['id']) {
continue;
}
if ($baseIn['type'] != $row['type']) {
noty('Base ' . $row['name'] . '. Missmatched types.', 'warning');
}
if ($baseIn['seller_id'] != $row['seller_id']) {
noty('Base ' . $row['name'] . '. Missmatched owners ( ' . $baseIn['seller_id'] . ':' . $mainBase . ' <=> ' . $row['seller_id'] . ' ).', 'warning');
}
$sql[$k][0] = 'update tbl_' . ($baseIn['type'] == '1' ? 'ccs' : ($baseIn['type'] == '2' ? 'dumps' : 'accounts')) . " set base_id='" . $baseIn['id'] . "',base_name='" . $baseIn['name'] . "'" . ($baseIn['type'] != '2' ? ",base_status='" . $baseIn['active'] . "'" : ",enabled='" . $baseIn['active'] . "'") . " where base_id='" . $row['id'] . "'";
$sql[$k][1] = "update tbl_bases set name='[REMOVED]" . str_replace(array('[REMOVED]', "'"), array('', "\'"), $row['name']) . "',active='0' where id='" . $row['id'] . "'";
}
while (list($k, $sql1) = each($sql)) {
if (!SQL($sql1[0])->query()) {
noty('Error merging ' . $row['name'] . '.', 'warning');
}
if (!SQL($sql1[1])->query()) {
noty('Error removing ' . $row['name'] . '.', 'warning');
}
}
noty('Success merging to "' . $checkers[$checker]['name'] . '" checker on all bases', 'success');
}
public function actionIndex()
{
//+T
$model = new R_Bases();
$modelPayouts = new R_Payouts();
$modelPartners = new R_Partners();
$database_id = getParam('database_id');
$import = getParam('import');
$export = getParam('export');
$new_import = getParam('new_import');
$database_info = $model->getInfoAboutDBbyID($database_id);
$password = getParam('resellerPWD');
Yii::import('application.models.admincp.reseller.*');
$total_profit_all = SQL(
'SELECT SUM(total) FROM (
SELECT SUM(IFNULL(total_income, 0) * percent / 100 - IFNULL(total_amounts, 0)) as total FROM
(
(SELECT b.id as base_id, p.user_id, p.percent FROM {{bases}} b, {{partners}} p WHERE b.id = p.base_id AND b.type = 1) bases
LEFT JOIN
(SELECT SUM(IFNULL(total_price, 0)) as total_income, base_id FROM {{ccs_history}} WHERE is_moneyback = 0 GROUP BY base_id) income ON bases.base_id = income.base_id
LEFT JOIN
(SELECT SUM(amount) as total_amounts, user_id, base_id FROM {{payouts}} GROUP BY user_id, base_id) payouts ON payouts.user_id = bases.user_id AND payouts.base_id = bases.base_id
)
UNION ALL
SELECT SUM(IFNULL(total_income, 0) * percent / 100 - IFNULL(total_amounts, 0)) as total FROM
(
(SELECT b.id as base_id, p.user_id, p.percent FROM {{bases}} b, {{partners}} p WHERE b.id = p.base_id AND b.type=2) bases
LEFT JOIN
(SELECT SUM(IFNULL(total_price, 0)) as total_income, base_id FROM {{dumps_history}} WHERE is_moneyback = 0 GROUP BY base_id) income ON bases.base_id = income.base_id
LEFT JOIN
(SELECT SUM(amount) as total_amounts, user_id, base_id FROM {{payouts}} GROUP BY user_id, base_id) payouts ON payouts.user_id = bases.user_id AND payouts.base_id = bases.base_id
)
UNION ALL
SELECT SUM(IFNULL(total_income, 0) * percent / 100 - IFNULL(total_amounts, 0)) as total FROM
(
(SELECT b.id as base_id, p.user_id, p.percent FROM {{bases}} b, tbl_partners p WHERE b.id = p.base_id AND b.type=3) bases
LEFT JOIN
(SELECT SUM(IFNULL(total_price, 0)) as total_income, base_id FROM {{accounts_history}} WHERE is_moneyback = 0 GROUP BY base_id) income ON bases.base_id = income.base_id
LEFT JOIN
(SELECT SUM(amount) as total_amounts, user_id, base_id FROM {{payouts}} GROUP BY user_id, base_id) payouts ON payouts.user_id = bases.user_id AND payouts.base_id = bases.base_id
)) t'
)->queryScalar();
Yii::import('application.models.admincp.operations.*');
Yii::import('application.models.admincp.operations.bitcoin.*');
Yii::import('application.models.admincp.operations.bitcoin.forms.*');
try {
$bitcoinModel = new Bitcoin();
$btc_rate = $bitcoinModel->getBTC_rate(true);
$info = $bitcoinModel->connection->getwalletinfo();
$balance = $info['balance'] * $btc_rate;
} catch (Exception $e) {
$balance = null;
}
$model->unsetAttributes();
if (isset($_GET[$model->name()])) {
while (list($k, $v) = each($_GET[$model->name()])) {
if ($v != '') {
$model->$k = $v;
}
}
}
if (getParam('removed') == 1) {
$model_bases = $model;
} else {
$model_bases = $model->withoutDeleted();
}
$total_users_balance = DAO()->select("SUM(amount)")->from("{{operations}}")->where("status=1")->queryScalar();
$dataArray = array(
'database_id' => $database_id,
'database_info' => $database_info,
'model' => $model_bases,
'modelPartners' => $modelPartners,
'modelPayouts' => $modelPayouts,
'import' => $import,
'export' => $export,
'new_import' => $new_import,
'importDataErrors' => '',
'importDataSuccess' => '',
'countryWithoutPrice' => '',
'total_profit_all' => round($total_profit_all, 2),
'balance' => $balance ? round($balance, 2) : '<span style="color:#FF0000">BTC Server Error</span>',
'free_balance' => $balance ? round(($balance - $total_profit_all), 2) : '<span style="color:#FF0000">BTC Server Error</span>',
'total_users_balance' => round($total_users_balance, 2),
);
//IF DATABASE WAS SELECTED
Yii::import('application.models.admincp.import.*');
if (!empty($database_id) && !empty($database_info)) {
switch ($database_info['type']) {
case 1:
$modelUpdates = new R_Updates_CCS($database_info['type']);
$modelUpdates = $modelUpdates->selectedBase($database_info['id']);
break;
case 2:
$modelUpdates = new R_Updates_Dumps($database_info['type']);
$modelUpdates = $modelUpdates->selectedBase($database_info['id']);
break;
case 3:
$modelUpdates = new R_Updates_ACCS($database_info['type']);
$modelUpdates = $modelUpdates->selectedBase($database_info['id']);
break;
default:
break;
}
$dataArray['modelUpdates'] = $modelUpdates;
//SET DEFAULT TABLE:
switch ($database_info['type']) {
case 1:
$table_name = 'ccs';
break;
case 2:
$table_name = 'dumps';
break;
case 3:
$table_name = 'accounts';
break;
default:
break;
}
Yii::app()->clientScript->registerScriptFile(
Yii::app()->baseUrl . '/js/charts/highcharts.js',
CClientScript::POS_END
);
Yii::app()->clientScript->registerScriptFile(
Yii::app()->baseUrl . '/js/charts/modules/exporting.js',
CClientScript::POS_END
);
Yii::app()->clientScript->registerScriptFile(
Yii::app()->baseUrl . '/js/admincp/stats/countries_profit.js',
CClientScript::POS_END
);
$dataArray['countryList'] =
SQL('
SELECT c.country_name, count( * ) as country_count
FROM {{' . $table_name . '}} as c
WHERE base_id=:base_id
GROUP BY c.country_name
ORDER BY count( * ) DESC
')->bindParam(':base_id', $database_id)->queryAll();
}
if ($new_import == 1) {
$updateCode = mb_strtoupper(getParam('updateCode'));
$columns = json_decode(getParam('columns', ''), true);
$rows = json_decode(getParam('rows', ''), true);
if (sizeof($rows) > 0) {
Yii::import('application.models.admincp.import.ImportNew');
$model = new ImportNew();
echo json_encode($model->loadItems($database_id, $columns, $rows, $updateCode, 1));
die();
}
}
//CHECK IMPORT
if ($import == 1 || ($export == 1 && $password == 'eU93W2XFMorBpvQj')) {
//DEFAULT ARRAY:
$dataArray['importDataErrors'] = '';
$dataArray['importDataSuccess'] = '';
$dataArray['countryWithoutPrice'] = '';
$importData = (!empty($_POST['importData'])) ? $_POST['importData'] : null;
$importData = str_replace('\\', '', $importData);
$importType = (!empty($_POST['importType'])) ? $_POST['importType'] : null;
switch ($importType) {
case 1:
$importFormat = (!empty($_POST['importFormatCC'])) ? $_POST['importFormatCC'] : null;
break;
case 2:
$importFormat = (!empty($_POST['importFormatFullz'])) ? $_POST['importFormatFullz'] : null;
break;
case 3:
$importFormat = (!empty($_POST['importFormatDumps'])) ? $_POST['importFormatDumps'] : null;
break;
case 4:
$importFormat = (!empty($_POST['importFormatACCS'])) ? $_POST['importFormatACCS'] : null;
break;
default:
break;
}
if (!empty($importFormat) && $importFormat != 0) {
Yii::import('application.models.admincp.bases.*');
switch ($importType) {
case 1:
$model = new ImportCCS();
$result = $model->loadCCS($importData, $importFormat, $database_id, $export);
$dataArray['importDataErrors'] = $result['importDataErrors'];
$dataArray['importDataSuccess'] = $result['importDataSuccess'];
$dataArray['countryWithoutPrice'] = $result['countryWithoutPrice'];
break;
case 2:
$model = new ImportCCS();
$result = $model->loadFullz($importData, $importFormat, $database_id, $export);
$dataArray['importDataErrors'] = $result['importDataErrors'];
$dataArray['importDataSuccess'] = $result['importDataSuccess'];
$dataArray['countryWithoutPrice'] = $result['countryWithoutPrice'];
break;
case 3:
$model = new ImportDumps();
$model->database_id = getParam('database_id');
$model->code = rand_str(10);
$result = $model->loadDumps($importData, $export);
if (!empty($result['success'])) {
$price = new R_Price();
$base = new R_Bases();
$base->rebuildBinlist(getParam('database_id'));
$price->DUMPS_rebuildPrice(getParam('database_id'));
}
$dataArray['importDataErrors'] = implode("\r\n", $result['errors']);
$dataArray['importDataSuccess'] = implode("\r\n", $result['success']);
break;
case 4:
$model = new ImportACCS();
$importData = preg_split('/\r\n/', $importData);
$result = $model->loadAccs($importData, $importFormat, $database_id, $export);
$dataArray['importDataErrors'] = $result['importDataErrors'];
$dataArray['importDataSuccess'] = $result['importDataSuccess'];
$dataArray['countryWithoutPrice'] = $result['countryWithoutPrice'];
break;
default:
break;
}
}
}
$this->render('/admincp/reseller/managment/form', $dataArray);
//+E
}
public function checkIsAdminOrDie()
{
if (!checkAccess('admin')) {
throw new Exception('You are not allowed to access this action.');
}
}
public function actionAjax()
{
//+T
$item_id = getParam('id');
$method = getParam('method');
switch ($method) {
case 'removePriceCountry':
$country = R_Prices::model()->findByPk($item_id);
$country->delete();
$priceRules = new R_Price();
$priceRules->CCS_rebuildPriceAll();
noty('Country was removed', 'success');
break;
case 'updatePriceCountry':
$price = getParam('price');
$fullz = getParam('fullz');
$country_name = getParam('country_name');
$timeout = getParam('timeout');
//ADDING PRICE
$prices = R_Prices::model()->findByAttributes(array('country_name' => $country_name));
$prices->price = $price;
$prices->country_name = $country_name;
$prices->fullz = $fullz;
$prices->timeout = $timeout;
$prices->save();
$priceRules = new R_Price();
$priceRules->CCS_updatePriceByCountry($country_name, $price, $fullz);
$priceRules->CCS_rebuildPriceAll();
noty('Country was added', 'success');
break;
case 'updateAlias':
$this->checkIsAdminOrDie();
$search = getParam('search');
$replace = getParam('replace');
//UPDATE ALIAS
$alias = R_Alias::model()->findByAttributes(array('search' => $search));
$alias->replace = $replace;
$alias->save();
noty('Alias was updated', 'success');
break;
case 'removeAlias':
$this->checkIsAdminOrDie();
$search = getParam('search');
$replace = getParam('replace');
//UPDATE ALIAS
$alias = R_Alias::model()->findByPk($item_id);
$alias->delete();
noty('Alias was deleted', 'success');
break;
case 'addAlias':
$this->checkIsAdminOrDie();
$search = getParam('search');
$replace = getParam('replace');
//UPDATE ALIAS
$alias = new R_Alias();
$alias->search = $search;
$alias->replace = $replace;
$alias->save();
noty('Alias was added', 'success');
break;
case 'removeBase':
$this->checkIsAdminOrDie();
$base_id = getParam('database_id');
$password = getParam('resellerPWD');
if ($password == '2faD4PHzMuZ') {
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) {
return;
}
//REMOVE EVERYTHING FROM STOCK:
switch ($base->type) {
case 1:
DAO()->delete('{{ccs}}', 'base_id=:base_id', array(':base_id' => $base_id));
break;
case 2:
DAO()->delete('{{dumps}}', 'base_id=:base_id', array(':base_id' => $base_id));
break;
case 3:
DAO()->delete('{{accounts}}', 'base_id=:base_id', array(':base_id' => $base_id));
break;
default:
break;
}
//CHANGE STATUS ABOUT DB:
$base->name = '[REMOVED]' . $bases->name;
$base->active = 0;
$base->visible = 0;
$base->save();
}
break;
case 'activate':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->active = 1;
$base->price_approve = 1;
$base->save();
switch ($base->type) {
case 1:
DAO()->update(
'{{ccs}}',
['base_status' => 1],
'base_id=:db_id',
[':db_id' => $base->id]
);
break;
case 2:
DAO()->update(
'{{dumps}}',
['base_status' => 1],
'base_id=:db_id',
[':db_id' => $base->id]
);
$this->actionRebuildDumpSection();
break;
case 3:
DAO()->update(
'{{accounts}}',
['base_status' => 1],
'base_id=:db_id',
[':db_id' => $base->id]
);
break;
}
break;
case 'deactivate':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->active = 0;
$base->price_approve = 0;
$base->save();
switch ($base->type) {
case 1:
DAO()->update(
'{{ccs}}',
['base_status' => 0],
'base_id=:db_id',
[':db_id' => $base->id]
);
break;
case 2:
DAO()->update(
'{{dumps}}',
['base_status' => 0],
'base_id=:db_id',
[':db_id' => $base->id]
);
$this->actionRebuildDumpSection();
break;
case 3:
DAO()->update(
'{{accounts}}',
['base_status' => 0],
'base_id=:db_id',
[':db_id' => $base->id]
);
break;
}
break;
case 'enable_refunds':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->refunds = 1;
$base->save();
break;
case 'disable_refunds':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->refunds = 0;
$base->save();
break;
case 'activate_autopost':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->autopost = 1;
$base->save();
break;
case 'deactivate_autopost':
$base_id = getParam('database_id');
$base = R_Bases::model()->findByPk($base_id);
if (empty($base)) return;
$base->autopost = 0;
$base->save();
break;
case 'confirm_update':
$ucode = getParam('ucode');
$db_type = getParam('db_type');
$actionText = 'confirmed update ';
$wrongType = false;
switch ($db_type) {
case 1:
R_Updates_CCS::model()->confirmUpdate($ucode, 1);
R_Updates_CCS::model()->moderateUpdate($ucode, 1);
$actionText .= 'of CCS Base (' . $ucode . ')';
Yii::app()->getModule('preorder')->proceedByCode($ucode);
break;
case 2:
R_Updates_Dumps::model()->confirmUpdate($ucode, 1);
R_Updates_Dumps::model()->moderateUpdate($ucode, 1);
$price = new R_Price();
$model = new R_Bases();
$model->rebuildBinlist($item_id);
$price->DUMPS_rebuildPrice($item_id);
$actionText .= 'of Dumps Base (' . $ucode . ')';
break;
case 3:
R_Updates_ACCS::model()->confirmUpdate($ucode, 1);
R_Updates_ACCS::model()->moderateUpdate($ucode, 1);
$actionText .= 'of ACCs Base (' . $ucode . ')';
break;
default:
$wrongType = true;
break;
}
if (!$wrongType) {
logSupportAction($actionText);
}
break;
case 'unconfirm_update':
$ucode = getParam('ucode');
$db_type = getParam('db_type');
switch ($db_type) {
case 1:
R_Updates_CCS::model()->confirmUpdate($ucode, 0);
R_Updates_CCS::model()->moderateUpdate($ucode, 1);
break;
case 2:
R_Updates_Dumps::model()->confirmUpdate($ucode, 0);
R_Updates_Dumps::model()->moderateUpdate($ucode, 1);
$price = new R_Price();
$model = new R_Bases();
$model->rebuildBinlist($item_id);
$price->DUMPS_rebuildPrice($item_id);
break;
case 3:
R_Updates_ACCS::model()->confirmUpdate($ucode, 0);
R_Updates_ACCS::model()->moderateUpdate($ucode, 1);
break;
default:
break;
}
break;
case 'checkUpdate':
Yii::import('application.components.checker.*');
$ucode = (string)arrayPath($_POST, 'ucode');
$base_id = (string)arrayPath($_POST, 'baseId');
$base_type = (string)arrayPath($_POST, 'baseType');
$ccnum = (string)arrayPath($_POST, 'ccnum');
switch ($base_type) {
case 1:
$modelUpdates = new R_Updates_CCS();
break;
case 2:
$modelUpdates = new R_Updates_Dumps();
break;
default:
break;
}
if (empty($ccnum)) {
$checkLimit = $modelUpdates->getCheckLog($ucode);
}
if ($checkLimit <= 35) {
//GET RANDOM CARD:
$record = !empty($ccnum) ? $modelUpdates->getCard($ucode, $ccnum) : $modelUpdates->getRandomCard($ucode);
if (!empty($record)) {
//GET CHECKER FOR CARD
$checkerName = DAO()->select('checker')
->from('{{bases}}')->where('id=:base_id', array(':base_id' => $base_id))
->queryScalar();
$checkerName = (!empty($checkerName)) ? $checkerName : Yii::app()->params['checker']['default'];
if ($base_type == 1) {
$checker = new CCS_Checker(Yii::app()->params['checker'], $checkerName);
$checker->cards[] = array(
'data' => $record['ccnum'] . ' ' . $record['exp_m'] . '/' . $record['exp_y'],
'cc_info' => array(
'cvv2' => decrypt($record['cvv']),
'country_name' => $record['country_name'],
'zip' => trim(decrypt($record['zip'])),
'avs_address' => 'UNKNOWN',
'avs_zip' => 'UNKNOWN',
),
);
} elseif ($base_type == 2) {
$checker = new Dump_Checker(Yii::app()->params['checker'], $checkerName);
$checker->format_list = 1;
$checker->check_t1 = 0;
$checker->check_t2 = 1;
$checker->amount = 1;
$checker->amount_fixed = '';
$checker->void = 0;
$checker->merchant = 0;
$checker->cards[0]['data'] = decrypt($record['track2']);
}
$checkInfo = $checker->execute();
$checkInfo = arrayPath($checkInfo, 'response.card1', array());
if (!empty($checkInfo['auth_code']) && $checkInfo['auth_code'] != 'RE') {
$modelUpdates->addCheckLog(array(
'ucode' => $ucode,
'ccnum' => $record['ccnum'],
'auth_code' => $checkInfo['auth_code'],
'auth_result' => $checkInfo['auth_result'],
'checker_used' => $checkerName
));
switch ($base_type) {
case 1:
$_tableName = '{{ccs}}';
break;
case 2:
$_tableName = '{{dumps}}';
break;
case 3:
$_tableName = '{{accounts}}';
break;
default:
break;
}
if (!in_array($checkInfo['auth_code'], ['00', '10', '85', '28', '91'])) {
DAO()->delete($_tableName, 'id=:id', array(':id' => $record['id']));
}
}
if ($checkInfo['auth_code'] == 'RE') {
die(json_encode(
array(
'ucode' => $ucode,
'ccnum' => $record['ccnum'],
'auth_code' => $checkInfo['auth_code'],
'auth_result' => $checkInfo['auth_result'],
'msg' => 'Batch created, waiting for result',
)
));
}
die(
json_encode(
[
'msg' => CHtml::link('CHECKED TIMES: ' . $modelUpdates->getCheckLog($ucode) . ' | APPROVAL: '
. $modelUpdates->getCheckLogApproval($ucode) . ' times', '/reseller/updates/index/ucode/'
. $ucode) . '<br/><span style="color:'
. (in_array($checkInfo['auth_code'], array('00', '10', '85', '28', '91')) ? 'green' : 'red')
. ';">' . ($checkInfo['auth_code'] . ' ' . $checkInfo['auth_result'] . ' | '
. rand_str(3)) . '</span>'
]
)
);
} else {
die(json_encode(array('msg' => 'REQUEST ERROR')));
}
} else {
die(json_encode(array('msg' => 'TOO MANY CHECKS ON THIS UPDATE')));
}
break;
case 'publish_news':
$baseId = getParam('base_id');
$this->publishNews($baseId);
break;
default:
break;
}
//+E
}
public function actions()
{
return array(
'autocomplete' => array(
'class' => 'application.extensions.EAutoCompleteAction',
'model' => 'R_Bases', //My model's class name
'limit' => 25,
'whitelist' => array('name'),
'whitelist_vars' => array('id', 'name'),
'extended' => 1,
'attribute' => (!empty($_GET['attr'])) ? $_GET['attr'] : '', //The attribute of the model i will search
),
);
}
public function publishNews($baseId)
{
Yii::import("application.models.admincp.news.*");
$baseType = DAO()->select('type')->from('{{bases}}')->where('id=:base_id', [':base_id' => $baseId])->queryScalar();
$mainCountryRow = DAO()
->select('country_name, COUNT(*) as country_count')
->from('{{ccs}}')
->where('base_id = :base_id', [':base_id' => $baseId])
->group('country_name')
->order('country_count DESC')
->LIMIT('1')
->queryRow();
$mainCountry = $mainCountryRow['country_name'];
$lastNewsId = DAO()
->select('id')
->from('{{news}}')
->where('binded_db = :base_id', [':base_id' => $baseId])
->limit(1)
->queryScalar();
$firstNews = $lastNewsId <= 0;
switch ($baseType) {
case 1:
$title = "CC UPDATE/ОБНОВЛЕНИЕ СС";
break;
case 2:
$title = "DUMPS UPDATE/ОБНОВЛЕНИЕ DUMPS";
break;
case 3:
$title = "ACCOUNTS UPDATE/ОБНОВЛЕНИЕ ACCOUNTS";
break;
default:
die();
}
$bodyPrefix = $firstNews ? "ADDED NEW" : "UPDATED";
$body = "<p style=\"text-align: center; color: #ff6600;\">{$bodyPrefix} {$mainCountry} BASE</p>";
$newsModel = new ANews();
$newsModel->title = $title;
$newsModel->article_prev = $body;
$newsModel->enabled = 1;
$newsModel->binded_db = $baseId;
$newsModel->is_flash = 1;
$newsModel->is_sticky = 0;
$newsModel->access_group = 'customer';
$newsModel->save();
DAO()->update("{{news}}", ['is_flash' => 0], 'is_flash = 1');
DAO()->update("{{users}}", ['read_news' => 0]);
require __DIR__ . '/../../../extensions/telegrambot/TelegramBot.php';
$telegram = new TelegramBot();
$telegram->sendNews(
$this->renderPartial(
'/news/telegram',
[
'title' => $title,
'binded_db' => $baseId,
'body' => $body,
],
true
),
'markdown'
);
}
public function actionGetCountriesStats()
{
$database_id = $_REQUEST['base_id'];
$base = DAO()->select('*')->from('{{bases}}')->where('id=:id', [':id' => $database_id])->queryRow();
if ($base['type'] == 1) {
$table_name = 'ccs';
} elseif ($base['type'] == 2) {
$table_name = 'dumps';
} elseif ($base['type'] == 3) {
$table_name = 'accounts';
}
$statsA = DAO()->select('c.country_name, count(*) as country_count')->from('{{' . $table_name . '_history}} as c')
->where('base_id=:base_id AND created_at BETWEEN :from AND :to', array(
':base_id' => $database_id,
':from' => $_REQUEST['from'] . ' 0:0:0', ':to' => $_REQUEST['to'] . ' 23:59:59',
))
->group('c.country_name')->order('count(*) DESC')->queryAll();
while (list($k, $row) = each($statsA)) {
$stats[$row['country_name']] = $row['country_count'];
}
header('Content-type: application/json');
echo json_encode($stats);
Yii::app()->end();
}
public function actionGetBinStats()
{
$database_id = $_REQUEST['base_id'];
$base = DAO()->select('*')->from('{{bases}}')->where('id=:id', [':id' => $database_id])->queryRow();
if ($base['type'] == 1) {
$table_name = 'ccs';
} elseif ($base['type'] == 2) {
$table_name = 'dumps';
} elseif ($base['type'] == 3) {
$table_name = 'accounts';
}
$statsA = DAO()->select('c.bin as bin, count( * ) as bins_count')->from('{{' . $table_name . '_history}} as c')
->where('base_id=:base_id AND created_at BETWEEN :from AND :to', array(
':base_id' => $database_id,
':from' => $_REQUEST['from'] . ' 0:0:0', ':to' => $_REQUEST['to'] . ' 23:59:59',
))
->group('c.bin')->order('count(*) DESC')->limit(50)->queryAll();
$stats = array();
while (list($k, $row) = each($statsA)) {
$stats['data'] .= '<li class="innerli">' . $row['bin'] . ': <b>' . $row['bins_count'] . '</b></li>';
}
$stats['data'] = '<ul style="display:block;"><b>Top bins:</b><br />' . $stats['data'] . '</ul>';
header('Content-type: application/json');
echo json_encode($stats);
Yii::app()->end();
}
}