Показать сообщение отдельно
Старый 28.11.2013, 19:56   #1
Devilry-PvP
На доске почёта
Аватар для Devilry-PvP
OFFLINE
Регистрация: 30.10.2013
Возраст: 44
Сообщений: 120
Благодарностей:
16 всего
Мнения: -825
Репутация: 49
Отправить сообщение для Devilry-PvP с помощью Skype™

Обмен на Кеш шоп


Есть модуль для офис сл который обменивает:

Обмен BP на PvP
Обмен PvP на BP
Обмен GP на PvP
Обмен PvP на GP

А мне надо чтоб было
Обмен BP на PvP
Обмен PvP на BP
Обмен GP на Cash
Обмен Cash на GP

Вот сам пример кода, говорю сразу пытался, ниче не получилось, пытался делать что-то типо mssql_query(sprintf("UPDATE tbl_user SET Cash = Cash ......... WHERE ID = '%s'", $addcash, ........

Цитата:
<?php
// ------------------------------------------------------------------------
/**
* FDCore Studio
*
*
* @package CodeIgniter
* @author NetSoul & SantyFear
* @copyright Copyright (c) 2011, FDCore
* @link http://fdcore.ru
* @since Version 1.0
*/
// ------------------------------------------------------------------------
class convert extends Controller {

var $data = array ();
var $MSSQL;
var $MYSQL;
var $is_logged=false;
var $AccountSerial=0;
var $master_answer=false;

function convert()
{
parent::Controller();
$this->load->helper(array(
'fdcore_framework',
'office_framework',
'rf_framework_helper',
));
$this->load->helper(array('language','url','file','security',' date','form','html','pay'));
$this->load->library(array('session','parser','table','cache', 'ajax','Template'));
$this->lang->load('office', get_lang());
RunFunc('connectdb|connectmydb|allow_ip|check_offl ine|check_sql_inject');
$this->login=xss_clean($this->session->userdata('login'));
if(!is_logged()) redirect( base_url() );
$this->output->enable_profiler(config('profiler','core'));

$this->load->model('Account');
$this->load->library('form_validation');
}
// --------------------------------------------------------------------------
function index()
{
$this->data['title']='';

$this->table->set_template(tpl_table());
if(config('pvp2gp','convert')) $this->table->add_row(anchor('convert/pvp2gp',' PvP GP'));
if(config('gp2pvp','convert')) $this->table->add_row(anchor('convert/gp2pvp',' GP PvP '));
if(config('bp2pvp','convert')) $this->table->add_row(anchor('convert/bp2pvp',' BP PvP '));
if(config('pvp2bp','convert')) $this->table->add_row(anchor('convert/pvp2bp',' PvP BP '));
if(config('bp2gp','convert')) $this->table->add_row(anchor('convert/bp2gp',' BP GP '));

$this->data['content']=heading('',2).br(2).$this->table->generate();
compile();
}
// ------------------------------------------------------------------------
function pvp2gp($err='')
{
$this->data['title']=' PvP GP';
if(config('pvp2gp','convert') == false) redirect( 'main' );

$this->Account->login=get_login();
$array=$this->Account->char_array();

$form=form_dropdown('char', $array);
$this->template->set('charlist',$form);
$this->form_validation->set_rules('pvp', 'PvP', 'required|is_natural');

if($this->input->post('pvp'))
if(!is_numeric($this->input->post('pvp')) || $this->input->post('pvp') < 0) redirect('convert/pvp2gp/num');

if ($this->form_validation->run() == FALSE)
{
//

$this->table->add_row(b(' PvP GP'),validation_errors());
$this->table->add_row(' '.config('pvp2gp_exch','convert').' PvP', b('1 GP'));
$this->table->add_row(form_open('convert/pvp2gp').' '.$form);
$this->table->add_row(' PvP '.form_input('pvp', config('pvp2gp_exch','convert')));
$this->table->add_row(form_submit('mysubmit', '').form_close());
}
else
{
//


$char=(int)office_secure($this->input->post('char'));

if($this->pvp_show($char) < set_value('pvp', '0')) redirect( 'convert/pvp2gp/err' );
if(set_value('pvp', '0') < config('pvp2gp_exch','convert')) redirect( 'convert/pvp2gp/err' );

$securekey=md5($this->pvp_show($char).set_value('pvp', '0'));

$this->table->add_row(b(' PvP GP'),set_value('pvp', '0'));
$this->table->add_row(b(' '), $this->pvp_show($char)-set_value('pvp', '0'));
$this->table->add_row(b(' '), round(set_value('pvp', '0') / config('pvp2gp_exch','convert')).' GP');

$this->table->add_row(
form_open('convert/pvp2gp_proccess').// 3
form_hidden('securekey', $securekey).
form_hidden('pvp', set_value('pvp', '0')),
form_hidden('char', $char),
form_hidden('expire', time()),
form_submit('mysubmit','').form_close()
);
$this->table->add_row(go_back('convert/pvp2gp',true));
}
if($err == 'err') $text=icon('32x32/chart_down.png').' PvP '. go_back(); else $text=$this->table->generate();
if($err == 'num') $text=icon('32x32/chart_down.png').' pvp'. go_back(); else $text=$this->table->generate();
$this->data['content']=$text;
compile();
}

function gp2pvp($err=''){
$this->data['title']=' GP PVP';
if(config('pvp2gp','convert') == false) redirect( 'main' );

$this->Account->login=get_login();
$array=$this->Account->char_array();

$form=form_dropdown('char', $array);
$this->template->set('charlist',$form);
$this->form_validation->set_rules('gp', 'GP', 'required|is_natural');

if($this->input->post('gp'))
if(!is_numeric($this->input->post('gp')) || $this->input->post('gp') < 0) redirect('convert/gp2pvp/num');

if ($this->form_validation->run() == FALSE)
{
//

$this->table->add_row(b(' GP PVP'),validation_errors());
$this->table->add_row(' 1 GP', b(config('gp2pvp_exch','convert').' PvP'));
$this->table->add_row(form_open('convert/gp2pvp').' '.$form);
$this->table->add_row(' GP PvP '.form_input('gp', 1));
$this->table->add_row(form_submit('mysubmit', '').form_close());
}
else
{
//


$char=(int)office_secure($this->input->post('char'));

if(donate_show(Get_AccountSerial()) < set_value('gp', '0')) redirect( 'convert/gp2pvp/err' );
if(set_value('gp', '0') < 1) redirect( 'convert/gp2pvp/err' );

$securekey=md5(donate_show(Get_AccountSerial()).se t_value('gp', '0'));

$this->table->add_row(b(' PvP GP'),set_value('gp', '0'));
$this->table->add_row(b(' '), donate_show(Get_AccountSerial())-set_value('gp', '0'));
$this->table->add_row(b(' '), round(set_value('gp', '0') * config('gp2pvp_exch','convert')).' PvP');

$this->table->add_row(
form_open('convert/gp2pvp_proccess').// 3
form_hidden('securekey', $securekey).
form_hidden('gp', set_value('gp', '0')),
form_hidden('char', $char),
form_hidden('expire', time()),
form_submit('mysubmit','').form_close()
);
$this->table->add_row(go_back('convert/gp2pvp',true));
}
if($err == 'err') $text=icon('32x32/chart_down.png').' GP '. go_back(); else $text=$this->table->generate();
if($err == 'num') $text=icon('32x32/chart_down.png').' GP'. go_back(); else $text=$this->table->generate();
$this->data['content']=$text;
compile();
}
// ------------------------------------------------------------------------
function pvp2gp_proccess()
{
//3
$this->data['title']='PvP GP';
$securekey = office_secure($this->input->post('securekey'));
$pvp = intval($this->input->post('pvp'));
$expire = office_secure($this->input->post('expire'));
$char = (int)office_secure($this->input->post('char'));
$secure_check = md5($this->pvp_show($char).$pvp);

if($pvp <= 0) exit('Hacking Attept!');

if(is_online($char)) {
$this->data['content']=" .";
compile();
return;
}

if(expire_time($expire,30)==''){

if($secure_check===$securekey && $pvp > 0 && $char > 0 && $expire > 0)
{
$need_gp = round( $pvp / config('pvp2gp_exch','convert') );

$this->pvp_edit($char,$this->pvp_show($char)-$pvp);
donate_add(Get_AccountSerial(),$need_gp); //
$this->cache->remove('total_money', get_login());
log_in_history(' '.$pvp.' PvP '.$need_gp .' GP');
$text=icon('32x32/accept.png').' !<br> '.$pvp.' PvP '.$need_gp .' GP';
} else $text=icon('32x32/delete.png').lang('off_no_secure');
} else $text=expire_time($expire,30);

$this->data['content']=$text.go_back('convert/pvp2gp',true);
compile();
}

function gp2pvp_proccess()
{
//3
$this->data['title']='GP PvP';
$securekey = office_secure($this->input->post('securekey'));
$gp = intval($this->input->post('gp'));
$expire = office_secure($this->input->post('expire'));
$char = (int)office_secure($this->input->post('char'));
$secure_check = md5(donate_show(Get_AccountSerial()).$gp);

if($gp <= 0) exit('Hacking Attept!');

if(is_online($char)) {
$this->data['content']=" .";
compile();
return;
}

if(expire_time($expire,30)==''){

if($secure_check===$securekey && $gp > 0 && $char > 0 && $expire > 0)
{
donate_edit(Get_AccountSerial(),donate_show(Get_Ac countSerial())-$gp);
$add = $gp * config('gp2pvp_exch','convert');

$this->pvp_edit($char,$this->pvp_show($char)+$add);
$this->cache->remove('total_money', get_login());
log_in_history(' '.$gp.' GP '.$add .' PvP');
$text=icon('32x32/accept.png').' !<br> '.$gp.' GP '.$add .' PvP';
} else $text=icon('32x32/delete.png').lang('off_no_secure');
} else $text=expire_time($expire,30);

$this->data['content']=$text.go_back('convert/gp2pvp',true);
compile();
}
function pvp_show($char)
{
if($char=='' || $char==0) return 0;
$world = get_world();
$char=xss_clean($char);
$query = $this->MSSQL->query("SELECT PvpCash FROM {$world}.dbo.tbl_pvporderview WHERE serial={$char}");
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
return $row->PvpCash;
}
} else return 0;
}

function pvp_edit($char,$pvp)
{
if($char=='' || $char==0) return 0;
$world = get_world();
$this->MSSQL->query("UPDATE {$world}.dbo.tbl_pvporderview SET PvpCash='{$pvp}' WHERE serial={$char}");
return 1;
}

// ------------------------------------------------------------------------
function pvp2bp($err='')
{
$this->data['title']=' PvP BP';
if(config('pvp2bp','convert') == false) redirect( 'main' );

$this->Account->login=get_login();
$array=$this->Account->char_array();

$form=form_dropdown('char', $array);
$this->template->set('charlist',$form);
$this->form_validation->set_rules('pvp', 'PvP', 'required|is_natural');

if($this->input->post('pvp'))
if(!is_numeric($this->input->post('pvp')) || $this->input->post('pvp') < 0) redirect('convert/pvp2bp/num');

if ($this->form_validation->run() == FALSE)
{
//

$this->table->add_row(b(' PvP BP'),validation_errors());
$this->table->add_row(' '.config('pvp2bp_exch','convert').' PvP', b('1 BP'));
$this->table->add_row(form_open('convert/pvp2bp').' '.$form);
$this->table->add_row(' PvP '.form_input('pvp', config('pvp2bp_exch','convert')));
$this->table->add_row(form_submit('mysubmit', '').form_close());
}
else
{
//


$char=(int)office_secure($this->input->post('char'));

if($this->pvp_show($char) < set_value('pvp', '0')) redirect( 'convert/pvp2bp/err' );
if(set_value('pvp', '0') < config('pvp2bp_exch','convert')) redirect( 'convert/pvp2bp/err' );

$securekey=md5($this->pvp_show($char).set_value('pvp', '0'));

$this->table->add_row(b(' PvP BP'),set_value('pvp', '0'));
$this->table->add_row(b(' '), $this->pvp_show($char)-set_value('pvp', '0'));
$this->table->add_row(b(' '), round(set_value('pvp', '0') / config('pvp2bp_exch','convert')).' BP');

$this->table->add_row(
form_open('convert/pvp2bp_proccess').// 3
form_hidden('securekey', $securekey).
form_hidden('pvp', set_value('pvp', '0')),
form_hidden('char', $char),
form_hidden('expire', time()),
form_submit('mysubmit','').form_close()
);
$this->table->add_row(go_back('convert/pvp2bp',true));
}
if($err == 'err') $text=icon('32x32/chart_down.png').' PvP '. go_back(); else $text=$this->table->generate();
if($err == 'num') $text=icon('32x32/chart_down.png').' pvp'. go_back(); else $text=$this->table->generate();
$this->data['content']=$text;
compile();
}

function pvp2bp_proccess()
{
//3
$this->data['title']='PvP BP';
$securekey = office_secure($this->input->post('securekey'));
$pvp = intval($this->input->post('pvp'));
$expire = office_secure($this->input->post('expire'));
$char = (int)office_secure($this->input->post('char'));
$secure_check = md5($this->pvp_show($char).$pvp);

if($pvp <= 0) exit('Hacking Attept!');

if(is_online($char)) {
$this->data['content']=" .";
compile();
return;
}

if(expire_time($expire,30)==''){

if($secure_check===$securekey && $pvp > 0 && $char > 0 && $expire > 0)
{
$need_bp = round( $pvp / config('pvp2bp_exch','convert') );

$this->pvp_edit($char,$this->pvp_show($char)-$pvp);
bonus_add(Get_AccountSerial(),$need_bp); //
$this->cache->remove('total_money', get_login());
log_in_history(' '.$pvp.' PvP '.$need_bp .' BP');
$text=icon('32x32/accept.png').' !<br> '.$pvp.' PvP '.$need_bp .' BP';
} else $text=icon('32x32/delete.png').lang('off_no_secure');
} else $text=expire_time($expire,30);

$this->data['content']=$text.go_back('convert/pvp2bp',true);
compile();
}
//-------------------------------------------------
function bp2pvp($err=''){
$this->data['title']=' BP PVP';
if(config('pvp2gp','convert') == false) redirect( 'main' );

$this->Account->login=get_login();
$array=$this->Account->char_array();

$form=form_dropdown('char', $array);
$this->template->set('charlist',$form);
$this->form_validation->set_rules('bp', 'bp', 'required|is_natural');

if($this->input->post('bp'))
if(!is_numeric($this->input->post('bp')) || $this->input->post('bp') < 0) redirect('convert/bp2pvp/num');

if ($this->form_validation->run() == FALSE)
{
//

$this->table->add_row(b(' BP PVP'),validation_errors());
$this->table->add_row(' 1 BP', b(config('bp2pvp_exch','convert').' PvP'));
$this->table->add_row(form_open('convert/bp2pvp').' '.$form);
$this->table->add_row(' BP PvP '.form_input('bp', 1));
$this->table->add_row(form_submit('mysubmit', '').form_close());
}
else
{
//


$char=(int)office_secure($this->input->post('char'));

if(bonus_show(Get_AccountSerial()) < set_value('bp', '0')) redirect( 'convert/bp2pvp/err' );
if(set_value('bp', '0') < 1) redirect( 'convert/bp2pvp/err' );

$securekey=md5(bonus_show(Get_AccountSerial()).set _value('bp', '0'));

$this->table->add_row(b(' PvP bp'),set_value('bp', '0'));
$this->table->add_row(b(' '), bonus_show(Get_AccountSerial())-set_value('bp', '0'));
$this->table->add_row(b(' '), round(set_value('bp', '0') * config('bp2pvp_exch','convert')).' PvP');

$this->table->add_row(
form_open('convert/bp2pvp_proccess').// 3
form_hidden('securekey', $securekey).
form_hidden('bp', set_value('bp', '0')),
form_hidden('char', $char),
form_hidden('expire', time()),
form_submit('mysubmit','').form_close()
);
$this->table->add_row(go_back('convert/bp2pvp',true));
}
if($err == 'err') $text=icon('32x32/chart_down.png').' BP '. go_back(); else $text=$this->table->generate();
if($err == 'num') $text=icon('32x32/chart_down.png').' BP'. go_back(); else $text=$this->table->generate();
$this->data['content']=$text;
compile();
}
function bp2pvp_proccess()
{
//3
$this->data['title']='BP PvP';
$securekey = office_secure($this->input->post('securekey'));
$bp = intval($this->input->post('bp'));
$expire = office_secure($this->input->post('expire'));
$char = (int)office_secure($this->input->post('char'));
$secure_check = md5(bonus_show(Get_AccountSerial()).$bp);

if($bp <= 0) exit('Hacking Attept!');

if(is_online($char)) {
$this->data['content']=" .";
compile();
return;
}

if(expire_time($expire,30)==''){

if($secure_check===$securekey && $bp > 0 && $char > 0 && $expire > 0)
{
bonus_edit(Get_AccountSerial(),bonus_show(Get_Acco untSerial())-$bp);
$add = $bp * config('bp2pvp_exch','convert');

$this->pvp_edit($char,$this->pvp_show($char)+$add);
$this->cache->remove('total_money', get_login());
log_in_history(' '.$bp.' BP '.$add .' PvP');
$text=icon('32x32/accept.png').' !<br> '.$bp.' BP '.$add .' PvP';
} else $text=icon('32x32/delete.png').lang('off_no_secure');
} else $text=expire_time($expire,30);

$this->data['content']=$text.go_back('convert/bp2pvp',true);
compile();
}

public function bp2gp($err = '')
{
$this->data['title']=' BP GP';
if(config('bp2gp','convert')==FALSE){ redirect( 'main' ); }
$this->load->library('form_validation');
$this->form_validation->set_rules('pay', 'BP', 'required|is_natural|min_length[1]|max_length[100]');

if ($this->form_validation->run() == FALSE)
{
$this->table->add_row(b(' BP GP'),validation_errors());
$this->table->add_row(' 1 GP', b(config('bp2gp_exch','convert').' BP'));
$this->table->add_row(form_open('convert/bp2gp').' GP'.form_input('pay', '1'),form_submit('mysubmit', '').form_close());
}
else
{
if(bonus_show(Get_AccountSerial()) < set_value('pay', '0')*config('bp2gp_exch','convert')) redirect( 'convert/bp2gp/err' );
if(set_value('pay', '0')==0) redirect( 'convert/bp2gp/err' );

$securekey=md5(bonus_show(Get_AccountSerial()).set _value('pay', '0'));
$this->table->add_row(b(' BP GP'),set_value('pay', '0').' GP');
$this->table->add_row(b(' '),ceil(set_value('pay', '0')*config('bp2gp_exch','convert')).' BP');
$this->table->add_row(
form_open('convert/bp2gp_proccess').
form_hidden('securekey', $securekey).
form_hidden('pay', set_value('pay', '0')),
form_hidden('expire', time()),
form_submit('mysubmit','').form_close()
);
}
if($err<>'') $text=icon('32x32/chart_down.png').lang('off_no_moneygp').go_back('c onvert/bp2gp', true); else $text=$this->table->generate();
$this->data['content']=$text;
compile();

}

function bp2gp_proccess()
{
$this->data['title']=' BP GP';
if(config('bp2gp','convert')==FALSE){ redirect( 'main' ); }

$securekey = office_secure($this->input->post('securekey'));
$pay = office_secure($this->input->post('pay'));
$expire = office_secure($this->input->post('expire'));
$secure_check = md5(bonus_show(Get_AccountSerial()).$pay);

if(expire_time($expire, 30)==''){
if($secure_check===$securekey)
{
$BPPRICE = config('bp2gp_exch','convert') * $pay;

if($BPPRICE > bonus_show(Get_AccountSerial())){

show_error('Incorrect Price');
}

$old = bonus_show(Get_AccountSerial());

$now = $old - $BPPRICE;

bonus_edit(Get_AccountSerial(), $now);

donate_add(Get_AccountSerial(), $pay);

$this->cache->remove('total_money', get_login());

log_in_history(' '.$pay.' BP '.$pay*config('convert_1gp','core').' GP');

$text=icon('32x32/accept.png').lang('off_convert_ok');

} else $text=icon('32x32/delete.png').lang('off_no_secure');
} else $text=expire_time($expire,30);

$this->data['content']=$text.go_back('convert', true);
compile();

}
}
Кто поможет зарание спасибо.
 
Ответить с цитированием