Jump to content
×
×
  • Create New...

[Gesior E Modern] Pagseguro Entregando Pontos Automaticamente


lucas502
 Share

Recommended Posts

Olá xtibianos!

Acredito que esse seja meu primeiro tutorial feito por mim mesmo aqui no fórum, espero que gostem e aprovem Rep + happy.png

Introdução:
Nesse tutorial, vou lhes ensinar como instalar e configurar o sistema de PagSeguro automático, para que quando o pagamento for Aprovado pelo PagSeguro, o sistema entregar os pontos automaticamente.
Testado e funcionando em Gesior e Modern Acc.
Funciona para qualquer versão de Tibia, desde que seja em MySQL.

Quando você for testar, pode acontecer que os pontos sejam entregues com um atraso de no máximo 5~10 minutos depois de Aprovado o pagamento, porém, geralmente os pontos são entregues NA HORA do Aprovado pagamento.


Instalação:
Primeiramente vamos adicionar uma tabela na sua DataBase do MySQL,
Executem esta query para criar a tabela:



CREATE TABLE `PagSeguroTransacoes` (
`TransacaoID` varchar(36) NOT NULL,
`VendedorEmail` varchar(200) NOT NULL,
`Referencia` varchar(200) default NULL,
`TipoFrete` char(2) default NULL,
`ValorFrete` decimal(10,2) default NULL,
`Extras` decimal(10,2) default NULL,
`Anotacao` text,
`TipoPagamento` varchar(50) NOT NULL,
`StatusTransacao` varchar(50) NOT NULL,
`CliNome` varchar(200) NOT NULL,
`CliEmail` varchar(200) NOT NULL,
`CliEndereco` varchar(200) NOT NULL,
`CliNumero` varchar(10) default NULL,
`CliComplemento` varchar(100) default NULL,
`CliBairro` varchar(100) NOT NULL,
`CliCidade` varchar(100) NOT NULL,
`CliEstado` char(2) NOT NULL,
`CliCEP` varchar(9) NOT NULL,
`CliTelefone` varchar(14) default NULL,
`NumItens` int(11) NOT NULL,
`Data` datetime NOT NULL,
`status` tinyint(1) unsigned NOT NULL default '0',
UNIQUE KEY `TransacaoID` (`TransacaoID`,`StatusTransacao`),
KEY `Referencia` (`Referencia`),
KEY `status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
[/code]



Feito isso, vamos editar ou adicionar se você já não tiver, essas linhas no seu htdocs/config/config.php :


// PagSeguro Automatico by Lucas502 - xtibia.com
// Seu email cadastrado no pagseguro
$config['pagseguro']['email'] = 'Seu Email do PagSeguro';
// Valor unitario do produto ou seja valor de cada ponto
// Exemplo de valores
// 100 = R$ 1,00
// 235 = R$ 2,35
// 4254 = R$ 42,54
$config['pagseguro']['produtoValor'] = '100';




Depois, vamos adicionar essas linhas no seu htdocs/index.php :


case "pag_retorno";
$topic = "Pag_retorno";
$subtopic = "pag_retorno";
include("pag_retorno.php");
break;




Agora, troque todo o seu htdocs/shopsystem.php (pode variar, mas no gesior geralmente é shopsystem.php)por este:


<?PHP
// ALTER TABLE `z_shop_history_item` CHANGE `offer_id` `offer_id` VARCHAR( 255 ) NOT NULL;
// UPDATE `z_shop_history_item`, `z_shop_offer` SET `z_shop_history_item`.`offer_id` = `z_shop_offer`.`offer_name` WHERE `z_shop_history_item`.`offer_id` = `z_shop_offer`.`id`;
if($config['site']['shop_system'] == 1) {
if($logged)
$user_premium_points = $account_logged->getCustomField('premium_points');
else
$user_premium_points = 'Login first';
function getItemByID($id)
{
$id = (int) $id;
$SQL = $GLOBALS['SQL'];
$data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
if ($data['offer_type'] == 'pacc')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['days'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'item')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'vipdays')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['days'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'itemvip')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'container')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['container_id'] = $data['itemid2'];
$offer['container_count'] = $data['count2'];
$offer['item_id'] = $data['itemid1'];
$offer['item_count'] = $data['count1'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'unban')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'redskull')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
elseif ($data['offer_type'] == 'itemlogout')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['pid'] = $data['pid'];
$offer['count1'] = $data['count1'];
$offer['item_id'] = $data['itemid1'];
$offer['free_cap'] = $data['free_cap'];
}
elseif ($data['offer_type'] == 'changename')
{
$offer['id'] = $data['id'];
$offer['type'] = $data['offer_type'];
$offer['points'] = $data['points'];
$offer['description'] = $data['offer_description'];
$offer['name'] = $data['offer_name'];
}
return $offer;
}
function getOfferArray()
{
$offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';');
$i_pacc = 0;
$i_item = 0;
$i_vipdays = 0;
$i_itemvip = 0;
$i_container = 0;
$i_unban = 0;
$i_redskull = 0;
$i_itemlogout = 0;
$i_changename = 0;
while($data = $offer_list->fetch()) {
if ($data['offer_type'] == 'pacc')
{
$offer_array['pacc'][$i_pacc]['id'] = $data['id'];
$offer_array['pacc'][$i_pacc]['days'] = $data['count1'];
$offer_array['pacc'][$i_pacc]['points'] = $data['points'];
$offer_array['pacc'][$i_pacc]['description'] = $data['offer_description'];
$offer_array['pacc'][$i_pacc]['name'] = $data['offer_name'];
$i_pacc++;
}
elseif ($data['offer_type'] == 'item')
{
$offer_array['item'][$i_item]['id'] = $data['id'];
$offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
$offer_array['item'][$i_item]['item_count'] = $data['count1'];
$offer_array['item'][$i_item]['points'] = $data['points'];
$offer_array['item'][$i_item]['description'] = $data['offer_description'];
$offer_array['item'][$i_item]['name'] = $data['offer_name'];
$i_item++;
}
elseif ($data['offer_type'] == 'vipdays')
{
$offer_array['vipdays'][$i_vipdays]['id'] = $data['id'];
$offer_array['vipdays'][$i_vipdays]['days'] = $data['count1'];
$offer_array['vipdays'][$i_vipdays]['points'] = $data['points'];
$offer_array['vipdays'][$i_vipdays]['description'] = $data['offer_description'];
$offer_array['vipdays'][$i_vipdays]['name'] = $data['offer_name'];
$i_vipdays++;
}
elseif ($data['offer_type'] == 'itemvip')
{
$offer_array['itemvip'][$i_itemvip]['id'] = $data['id'];
$offer_array['itemvip'][$i_itemvip]['item_id'] = $data['itemid1'];
$offer_array['itemvip'][$i_itemvip]['item_count'] = $data['count1'];
$offer_array['itemvip'][$i_itemvip]['points'] = $data['points'];
$offer_array['itemvip'][$i_itemvip]['description'] = $data['offer_description'];
$offer_array['itemvip'][$i_itemvip]['name'] = $data['offer_name'];
$i_itemvip++;
}
elseif ($data['offer_type'] == 'container')
{
$offer_array['container'][$i_container]['id'] = $data['id'];
$offer_array['container'][$i_container]['container_id'] = $data['itemid2'];
$offer_array['container'][$i_container]['container_count'] = $data['count2'];
$offer_array['container'][$i_container]['item_id'] = $data['itemid1'];
$offer_array['container'][$i_container]['item_count'] = $data['count1'];
$offer_array['container'][$i_container]['points'] = $data['points'];
$offer_array['container'][$i_container]['description'] = $data['offer_description'];
$offer_array['container'][$i_container]['name'] = $data['offer_name'];
$i_container++;
}
elseif ($data['offer_type'] == 'unban')
{
$offer_array['unban'][$i_unban]['id'] = $data['id'];
$offer_array['unban'][$i_unban]['points'] = $data['points'];
$offer_array['unban'][$i_unban]['description'] = $data['offer_description'];
$offer_array['unban'][$i_unban]['name'] = $data['offer_name'];
$i_unban++;
}
elseif ($data['offer_type'] == 'redskull')
{
$offer_array['redskull'][$i_redskull]['id'] = $data['id'];
$offer_array['redskull'][$i_redskull]['points'] = $data['points'];
$offer_array['redskull'][$i_redskull]['description'] = $data['offer_description'];
$offer_array['redskull'][$i_redskull]['name'] = $data['offer_name'];
$i_redskull++;
}
elseif ($data['offer_type'] == 'itemlogout')
{
$offer_array['itemlogout'][$i_itemlogout]['id'] = $data['id'];
$offer_array['itemlogout'][$i_itemlogout]['points'] = $data['points'];
$offer_array['itemlogout'][$i_itemlogout]['description'] = $data['offer_description'];
$offer_array['itemlogout'][$i_itemlogout]['name'] = $data['offer_name'];
$offer_array['itemlogout'][$i_itemlogout]['count1'] = $data['count1'];
$offer_array['itemlogout'][$i_itemlogout]['pid'] = $data['pid'];
$offer_array['itemlogout'][$i_itemlogout]['item_id'] = $data['itemid1'];
$offer_array['itemlogout'][$i_itemlogout]['free_cap'] = $data['free_cap'];
$i_itemlogout++;
}
elseif ($data['offer_type'] == 'changename')
{
$offer_array['changename'][$i_changename]['id'] = $data['id'];
$offer_array['changename'][$i_changename]['points'] = $data['points'];
$offer_array['changename'][$i_changename]['description'] = $data['offer_description'];
$offer_array['changename'][$i_changename]['name'] = $data['offer_name'];
$i_changename++;
}
}
return $offer_array;
}
if($action == '') {
unset($_SESSION['viewed_confirmation_page']);
$main_content .= '<h2><center>Bem Vindo ao '.$config['server']['serverName'].' Shop.</center></h2><h2><center><a href="index.php?subtopic=donate">Adquire seus pontos.</a></center></h2>';
$offer_list = getOfferArray();
//show list of vipdays offers
if(count($offer_list['vipdays']) > 0) {
$main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> VIP Days</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
foreach($offer_list['vipdays'] as $vipdays) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$vipdays['days'].'</td><td><b>'.$vipdays['name'].'</b> ('.$vipdays['points'].' points)<br />'.$vipdays['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$vipdays['id'].'"><input type="submit" value="Buy '.$vipdays['name'].'"><br><b>for '.$vipdays['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table><br />';
}
//show list of itemsvip offers
if(count($offer_list['itemvip']) > 0) {
$main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> Items Specials</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
foreach($offer_list['itemvip'] as $itemvip) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvip['id'].'.gif"></td><td><b>'.$itemvip['name'].'</b> ('.$itemvip['points'].' points)<br />'.$itemvip['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvip['id'].'"><input type="submit" value="Buy '.$itemvip['name'].'"><br><b>for '.$item['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table><br />';
}
//show list of items offers
if(count($offer_list['item']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0)
$main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> ITEMS</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
if(count($offer_list['item']) > 0) {
foreach($offer_list['item'] as $item) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$item['id'].'.gif"></td><td><b>'.$item['name'].'</b> ('.$item['points'].' points)<br />'.$item['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$item['id'].'"><input type="submit" value="Buy '.$item['name'].'"><br><b>for '.$item['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table><br />';
}
//show list of containers offers
if(count($offer_list['container']) > 0) {
$main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> CONTAINERS WITH ITEMS</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
foreach($offer_list['container'] as $container) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' points)<br />'.$container['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$container['id'].'"><input type="submit" value="Buy '.$container['name'].'"><br><b>for '.$container['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table><br />';
}
if(count($offer_list['itemlogout']) > 0) {
$main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> Receive Item on Logout</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></font></td><td width="350" align="left"><b>Description</b></font></td><td width="250" align="center"><b>Select product</b></font></td></tr>';
foreach($offer_list['itemlogout'] as $itemlogout) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' points)<br />'.$itemlogout['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemlogout['id'].'"><input type="submit" value="Buy '.$itemlogout['name'].'"><br><b>for '.$itemlogout['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table><br />';
}
if(count($offer_list['changename']) > 0 or count($offer_list['pacc']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 )
$main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b> Others</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>#</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
//Pacc
if(count($offer_list['pacc']) > 0)
foreach($offer_list['pacc'] as $pacc) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$pacc['days'].'</td><td><b>'.$pacc['name'].'</b> ('.$pacc['points'].' points)<br />'.$pacc['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$pacc['id'].'"><input type="submit" value="Buy '.$pacc['name'].'"><br><b>for '.$pacc['points'].' points</b></form>';
}
//Change Name
if(count($offer_list['changename']) > 0)
foreach($offer_list['changename'] as $changename) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Change Name</td><td><b>'.$changename['name'].'</b> ('.$changename['points'].' points)<br />'.$changename['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><input type="submit" value="Buy '.$changename['name'].'"><br><b>for '.$changename['points'].' points</b></form>';
}
//Remove Red Skull
if(count($offer_list['redskull']) > 0)
foreach($offer_list['redskull'] as $redskull) {
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$redskull['id'].'.gif"></td><td><b>'.$redskull['name'].'</b> ('.$redskull['points'].' points)<br />'.$redskull['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><input type="submit" value="Buy '.$redskull['name'].'"><br><b>for '.$redskull['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
//Unban
if(count($offer_list['unban']) > 0)
foreach($offer_list['unban'] as $unban){
$main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' points)<br />'.$unban['description'].'</td><td align="center">';
if(!$logged) $main_content .= '<b>Login to buy</b>'; else
$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Buy '.$unban['name'].'"><br><b>for '.$unban['points'].' points</b></form>';
$main_content .= '</td></tr>';
}
$main_content .= '</table>';
}
elseif($action == 'select_player') {
unset($_SESSION['viewed_confirmation_page']);
if(!$logged) {
$main_content .= 'Please login first.';
} else {
$buy_id = (int) $_REQUEST['buy_id'];
if(empty($buy_id)) {
$main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
} else {
$buy_offer = getItemByID($buy_id);
if(isset($buy_offer['id'])) { //item exist in database
if($buy_offer['type'] != 'changename') {
if($user_premium_points >= $buy_offer['points']) {
$main_content .= '<center><h2>Escolha o Char</h2><table border="0" cellpadding="1" cellspacing="1" width="650">
<tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Item Selecionado</b></font></td></tr>
<tr bgcolor="#F1E0C6"><td width="100"><b>Name:</b></td><td width="550">'.$buy_offer['name'].'</td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Description:</b></td><td width="550">'.$buy_offer['description'].'</td></tr>
</table><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="1" cellspacing="1" width="650">
<tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Receber o item em um char de sua propria conta</b></font></td></tr>
<tr bgcolor="#F1E0C6"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0) {
$players_from_logged_acc->orderBy('name');
foreach($players_from_logged_acc as $player)
$main_content .= '<option>'.$player->getName().'</option>';
} else {
$main_content .= 'You don\'t have any character on your account.';
}
$main_content .= '</select> <input type="submit" value="OK"></td></tr></table>
</form><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="1" cellspacing="1" width="650">
<tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Presentear o Item para um Amigo</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="110"><b>Para o Player:</b></td><td width="550"><input type="text" name="buy_name"> - Char do amigo que ira receber o item</td></tr>
<tr bgcolor="#F1E0C6"><td width="110"><b>De:</b></td><td width="550"><input type="text" name="buy_from"> <input type="submit" value="Presentear"> - Nome do seu Char, \'Em Branco\' = Anonimo</td></tr>
</table><br /></form>';
} else {
$main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points.<br>You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
}
} else {
$main_content .= '<center><h2>Change Name</h2><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
<table border="0" cellpadding="1" cellspacing="1" width="650"><tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Change Name:</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0) {
$players_from_logged_acc->orderBy('name');
foreach($players_from_logged_acc as $player) {
$main_content .= '<option>'.$player->getName().'</option>';
}
} else {
$main_content .= 'You don\'t have any character on your account.';
}
$main_content .= '</select></td></tr><tr bgcolor="#F1E0C6"><td width="110"><b>New name:</b></td><td width="550"><input type="text" name="buy_from"> <input type="submit" value="Change Name"></td></tr></table><br /></form>';
}
} else {
$main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
}
}
}
}
elseif($action == 'confirm_transaction') {
if(!$logged) {
$main_content .= 'Please login first.';
} else {
$buy_id = (int) $_POST['buy_id'];
$buy_name = stripslashes(urldecode($_POST['buy_name']));
$buy_from = stripslashes(urldecode($_POST['buy_from']));
if(empty($buy_id)) {
$main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
} else {
if($buy_offer['type'] == 'changename'){
if(!check_name_new_char($buy_from)) {
$main_content .= 'Invalid name format of new name.';
}
} else {
$buy_offer = getItemByID($buy_id);
$check_name_in_database = $ots->createObject('Player');
$check_name_in_database->find($buy_from);
if($buy_offer['type'] == 'changename'){
if(!$check_name_in_database->isLoaded()) {
}
}
if(isset($buy_offer['id'])) { //item exist in database
if($user_premium_points >= $buy_offer['points']) {
if(check_name($buy_name)) {
$buy_player = new OTS_Player();
$buy_player->find($buy_name);
if($buy_player->isLoaded()) {
$buy_player_account = $buy_player->getAccount();
if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
if($buy_offer['type'] == 'pacc') {
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
$SQL->query($save_transaction);
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];

$main_content .= '<center><h2>VIP account added!</h2><b>'.$buy_offer['days'].' days</b> of VIP account added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
}
elseif($buy_offer['type'] == 'unban') {
$my_acc_id = $account_logged->getCustomField('id');
$datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE value = '.$my_acc_id.';')->fetch();
if($datadata['value'] == $my_acc_id) {
if($SQL->query('DELETE FROM bans WHERE value= '.$my_acc_id.' LIMIT 1;')) {
} else {
$SQL->query('DELETE FROM bans WHERE account= '.$my_acc_id.' LIMIT 1;');
}
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>Ban Deleted!</h2><b>Your account has been unbanned for '.$buy_offer['points'].' premium points</b> from your account.
<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
} else {
$main_content .= '<center><b>You don\'t have any bans in your account!</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
}
}
////////////////////////////////
elseif($buy_offer['type'] == 'itemlogout') {
$my_acc_id = $buy_player->getCustomField('id');
$playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE id = '.$my_acc_id.';')->fetch();
$playerslot = $SQL->query('SELECT * FROM '.$SQL->tableName('player_items').' WHERE player_id = '.$my_acc_id.';')->fetch();
if($playerinfo['online'] == '0') {
if ($playerslot['pid'] != '10') {
if ($datadata['cap'] >= $SQL->quote($buy_offer['free_cap'])) {
$SQL->query('INSERT INTO player_items (player_id, pid, itemtype, count) VALUES ('.$my_acc_id.', '.$SQL->quote($buy_offer['pid']).', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['count1']).');');
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<h2>Item received to player: '.$buy_player->getName().'!</h2><br>Now you have <b>'.$user_premium_points.' premium points</b>.
<br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a>';
} else {
$main_content .= '<b>You need '.$SQL->quote($buy_offer['free_cap']).' or more of cap!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
}
} else {
$main_content .= '<b>Please leave the arrow slot in blank to receive item!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
}
} else {
$main_content .= '<b>You need to be offline!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
}
}
////////////////////////////////
elseif($buy_offer['type'] == 'changename') {
$my_acc_id = $buy_player->getCustomField('id');
$playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
$checkname = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('name').' = '. $SQL->quote($buy_from) .';')->fetch();
if($playerinfo['online'] == '0') {
if($checkname == false) {
$SQL->query('UPDATE `players` SET `name` = '. $SQL->quote($buy_from) .' WHERE `id` = '. $my_acc_id.' ;');
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>Your name has been changed to '.$buy_from.'.</h2><br><b>You have '.$user_premium_points.' premium points left</b>.
<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
} else {
$main_content .= '<center><h2>Sorry, the name "<i>'.$buy_from.'</i>" does already exist.<br>Please select another name.</h2><br>';
}
} else {
$main_content .= '<center><h2>'.$buy_name.' has to be offline to complete transaction.</h2><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
}
}
////////////////////////////////
elseif($buy_offer['type'] == 'redskull') {
$my_acc_id = $buy_player->getCustomField('id');
$playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
if($playerinfo['skull'] == '4' AND $playerinfo['online'] >= '0' AND $playerinfo['skulltime'] > '0') {
$SQL->query('UPDATE killers SET unjustified=0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id='. $my_acc_id .');');
$SQL->query('UPDATE players SET skulltime=0, skull=0 WHERE id='. $my_acc_id .';');
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>RedSkull Removed!</h2><br><b>Your redskull has been removed from the player '.$buy_player->getName().'.</b>
<br>Now you have<b> '.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
} else {
$main_content .= '<center><b>'.$buy_player->getName().' has to be offline or have redskull to complete transaction!.</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
}
}
//////////////////////////
elseif($buy_offer['type'] == 'item') {
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', \'\', \'\', \'item\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
$SQL->query($save_transaction);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
}
if($buy_offer['type'] == 'vipdays') {
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
$SQL->query($save_transaction);
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];

$main_content .= '<center><h2>VIP account added!</h2><b>'.$buy_offer['days'].' days</b> of VIP account added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
}
elseif($buy_offer['type'] == 'itemvip') {
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['megaitems_count']).', \'\', \'\', \'megaitems\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
$SQL->query($save_transaction);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
}
elseif($buy_offer['type'] == 'container') {
$sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', \'container\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
$SQL->query($sql);
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
$SQL->query($save_transaction);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
$main_content .= '<center><h2>Container of items added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
}
} else {
if($buy_offer['type'] != 'changename') {
$set_session = TRUE;
$_SESSION['viewed_confirmation_page'] = 'yes';
$main_content .= '<center><h2>Confirm transaction</h2>
<table border="0" cellpadding="1" cellspacing="1" width="700">
<tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
<tr bgcolor="#F1E0C6"><td width="100"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
<tr bgcolor="#F1E0C6"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
<tr bgcolor="#F1E0C6"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
<form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($new_name).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Aceitar"></form></td>
<td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancelar"></form></td></tr>
</table>';
} else {
$set_session = TRUE;
$_SESSION['viewed_confirmation_page'] = 'yes';
$main_content .= '<center><h2>Confirm Name Changing</h2>
<table border="0" cellpadding="1" cellspacing="1" width="700">
<tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="130"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
<tr bgcolor="#F1E0C6"><td width="130"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
<tr bgcolor="#D4C0A1"><td width="130"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
<tr bgcolor="#F1E0C6"><td width="130"><b>Current Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
<tr bgcolor="#D4C0A1"><td width="130"><b>New Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
<tr bgcolor="#F1E0C6"><td width="130"><b>Change Name?</b></td><td width="275" align="left">
<form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($buy_from).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Accept"></form></td>
<td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
</table>';
}
}
} else {
$main_content .= 'Player with name <b>'.$buy_name.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
}
} else {
$main_content .= 'Invalid name format. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
}
} else {
$main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
}
} else {
$main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
}
}
}
}
if(!$set_session) {
unset($_SESSION['viewed_confirmation_page']);
}
}
elseif($action == 'show_history') {
if(!$logged) {
$main_content .= 'Please login first.';
} else{
$items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
if(is_object($items_history_received)) {
foreach($items_history_received as $item_received) {
if($account_logged->getId() == $item_received['to_account'])
$char_color = 'green';
else
$char_color = 'red';
$items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
if($account_logged->getId() == $item_received['from_account'])
$items_received_text .= '<i>Your account</i>';
else
$items_received_text .= $item_received['from_nick'];
$items_received_text .= '</td><td>'.$item_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
if($item_received['trans_real'] > 0)
$items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
else
$items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
$items_received_text .= '</tr>';
}
}
$paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
if(is_object($paccs_history_received)) {
foreach($paccs_history_received as $pacc_received) {
if($account_logged->getId() == $pacc_received['to_account'])
$char_color = 'green';
else
$char_color = 'red';
$paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
if($account_logged->getId() == $pacc_received['from_account'])
$paccs_received_text .= '<i>Your account</i>';
else
$paccs_received_text .= $pacc_received['from_nick'];
$paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>';
}
}
$pagseguro_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('PagSeguroTransacoes').' WHERE '.$SQL->fieldName('Anotacao').' = '.$SQL->quote($account_logged->getCustomField("name")).';');
if(is_object($pagseguro_history_received)) {
foreach($pagseguro_history_received as $pagseguro_received) {
if($account_logged->getCustomField("name") == $pagseguro_received['Anotacao'])
$char_color = 'green';
else
$char_color = 'red';
$pagseguro_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pagseguro_received['TransacaoID'].'</font></td><td>';

$pagseguro_received_text .= ''.$pagseguro_received['TipoPagamento'].'';

$pagseguro_received_text .= '</td><td>R$'.$pagseguro_received['NumItens'].',00</td><td>'.$pagseguro_received['Extras'].' Points</td><td><b style="color:red;">'.$pagseguro_received['StatusTransacao'].'</b></td></tr>';
}
}
$main_content .= '<center><h1>Transactions History</h1></center>';
if(!empty($items_received_text))
$main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
if(!empty($paccs_received_text))
$main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> Pacc Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />';

if(!empty($pagseguro_received_text))
$main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> PagSeguro Donations</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>ID:</b></td><td><b>Type</b></td><td><b>Cost</b></td><td><b>Points</b></td><td><b>Status</b></td></tr>'.$pagseguro_received_text.'</table><br />';


if(empty($paccs_received_text) && empty($items_received_text))
$main_content .= 'You did not buy/receive any items or PACC.';
}
}
if(!$logged)
$main_content .= 'Please login to see how much points you have.';
else
$main_content .= '<br><b><font color="green">You have premium points: </font></b>'.$user_premium_points;
}
else
$main_content .= '<br><center><b>Shop System is currently disabled for this server.Please ask the admin for more information.</b></center>';
?>




Também troque todo o seu htdocs/donate.php (pode variar, mas no gesior geralmente é donate.php) por este:


<?PHP
if($action == '')
{
$main_content .='
<div id="ProgressBar"> <div id="Headline">Informações Iniciais</div> <div id="MainContainer"> <div id="BackgroundContainer">
<img id="BackgroundContainerLeftEnd" src="layouts/tibiacom/images/vips/stonebar-left-end.gif"> <div id="BackgroundContainerCenter">
<div id="BackgroundContainerCenterImage" style="background-image: url(layouts/tibiacom/images/content/stonebar-center.gif);"></div> </div>
<img id="BackgroundContainerRightEnd" src="layouts/tibiacom/images/vips/stonebar-right-end.gif"> </div>
<img id="TubeLeftEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-left-blue.gif">
<img id="TubeRightEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-right-blue.gif">
<div id="FirstStep" class="Steps">
<div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-0-blue.gif">
<div class="StepText" style="font-weight: bold;">Regras da Doação</div>
</div>
</div>
<div id="StepsContainer1">
<div id="StepsContainer2">
<div class="Steps" style="width: 25%;">
<div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif">
</div>
<div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-1-blue.gif">
<div class="StepText" style="font-weight: normal;">Metodo de Pagamento</div>
</div>
</div>
<div class="Steps" style="width: 25%;">
<div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif">
</div>
<div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-2-blue.gif">
<div class="StepText" style="font-weight: normal;">Informações do Pedido</div>
</div>
</div>
<div class="Steps" style="width: 25%;">
<div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif">
</div>
<div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-3-blue.gif">
<div class="StepText" style="font-weight: normal;">Confirmação</div>
</div>
</div>
<div class="Steps" style="width: 25%;">
<div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-4-blue.gif"> <div class="StepText" style="font-weight: normal;">Pedido Realizado</div>
</div> </div> </div> </div> </div></div><div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer">
<span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
<span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
<span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
<div class="Text">Informações Iniciais para sua doação.</div>
<span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span>
<span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span>
<span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span>
</div>
</div>
<table class="Table1" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<div class="InnerTableContainer">
<table style="width: 100%;"><tbody><tr><td>
Informamos aos jogadores e colaboradores que o '.$config['server']['serverName'].' não tem nenhum interesse financeiro. Toda a renda obtida é diretamente reaplicada para a manutenção do servidor - isto significa que ao fazer uma doação, você está garantindo a estabilidade e aumentando a qualidade do mesmo.</br></br>
Os pontos que são repassados aos jogadores que efetuam as doações não representam nada mais além de nossa gratificação, isto é, você não está comprando pontos e sim recebendo uma gratificação simbólica (em formas de pontos) que te beneficie dentro do jogo; você poderá usar os seus pontos da maneira que desejar.</br></br>
O espírito deste sistema é simples: com o intuito de nos aproximarmos dos jogadores e fazer com que vocês se sintam em casa, entendemos a sua doação como uma via de mão dupla no quesito credibilidade. Ao acreditar que vale a pena investir na manutenção do servidor, nós investimos em vocês creditando-os com pontos, que como já dito anteriormente, podem ser utilizados da maneira que mais os couber.</br></br>
Confira as <a href="?subtopic=beneficiospremium">Vantagens Vips</a> e o <a href="?subtopic=shopsystem">'.$config['server']['serverName'].' Shop</a> e saiba como aproveitar os seus pontos da maneira mais proveitosa à sua situação.</br>
<h3>Dúvidas Frequentes</h3></br>
<b>Mas o que são Premium Points?</b>
Premium Points faz parte do nosso sistema de doação, com eles você pode adquirir uma VIP ou algo mais que esteja disponível no Shopping Online.</br></br>
<b>O que é uma VIP Account?</b>
Uma VIP Account traz habilidades e vantagens adicionais dentro e fora do jogo por um determinado período de tempo. Para saber mais sobre os beneficios por favor visite a seção <a href="?subtopic=beneficiospremium">Vantagens Vips</a>.</br></br>
<b>Como efetuar a doação?</b>
<br>Clique no botão <b>"Continue"</b> e siga todos os procedimentos para realizar sua doação.
</td></tr> </tbody></table> </div>
</td></tr></tbody></table></div><br><center><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="border: 0px none;">
<div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif);"></div>
<a href="?subtopic=donate&action=rules"><input class="ButtonText" name="Continue" alt="Continue" onclick=location.href="index.php?subtopic=donate&action=rules" src="layouts/tibiacom/images/vips/_sbutton_continue.gif" type="image"></a></div></div></td></tr></tbody></table></center>


';
}
elseif($action == 'rules')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$main_content .='<div id="ProgressBar"> <div id="Headline">Regras & Informações</div> <div id="MainContainer"> <div id="BackgroundContainer"> <img id="BackgroundContainerLeftEnd" src="layouts/tibiacom/images/vips/stonebar-left-end.gif"> <div id="BackgroundContainerCenter"> <div id="BackgroundContainerCenterImage" style="background-image: url(layouts/tibiacom/images/content/stonebar-center.gif);"></div> </div> <img id="BackgroundContainerRightEnd" src="layouts/tibiacom/images/vips/stonebar-right-end.gif"> </div> <img id="TubeLeftEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-left-green.gif"> <img id="TubeRightEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-right-blue.gif"> <div id="FirstStep" class="Steps"> <div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-0-green.gif"> <div class="StepText" style="font-weight: bold;">Regras da Doação</div> </div> </div> <div id="StepsContainer1"> <div id="StepsContainer2"> <div class="Steps" style="width: 25%;"> <div class="TubeContainer"> <img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green-blue.gif"> </div> <div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-1-blue.gif"> <div class="StepText" style="font-weight: normal;">Metodo de Pagamento</div> </div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer"> <img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-2-blue.gif"> <div class="StepText" style="font-weight: normal;">Informações do Pedido</div> </div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer"> <img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-3-blue.gif"> <div class="StepText" style="font-weight: normal;">Confirmação</div> </div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer"> <img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-4-blue.gif"> <div class="StepText" style="font-weight: normal;">Pedido Realizado</div> </div> </div> </div> </div> </div></div><div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer"> <span class="CaptionEdgeLeftTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightTop" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span> <span class="CaptionBorderTop" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span> <span class="CaptionVerticalLeft" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span> <div class="Text">Leia as Regras das Doações</div> <span class="CaptionVerticalRight" style="background-image: url(layouts/tibiacom/images/content/box-frame-vertical.gif);"></span> <span class="CaptionBorderBottom" style="background-image: url(layouts/tibiacom/images/content/table-headline-border.gif);"></span> <span class="CaptionEdgeLeftBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightBottom" style="background-image: url(layouts/tibiacom/images/content/box-frame-edge.gif);"></span> </div> </div> <table class="Table1" cellpadding="0" cellspacing="0"> <tbody><tr> <td> <div class="InnerTableContainer"> <table style="width: 100%;"><tbody><tr><td valign="middle" width="25px;">
<B>Antes de fazer uma doação, lembre-se de estar de acordo com as regras vigentes e ciente de todas as informações necessárias.</B><TEXTAREA ROWS="5" WRAP="physical" COLS="80" READONLY="true" style="float:right;">
1. Gerais
a) O '.$config['server']['serverName'].' é um servidor alternativo de Tibia planejado, construído e executado dentro das regras vigentes que possibilitam o funcionamento do mesmo sem infringir nenhuma lei (seja ela nacional ou não).
b) Todo o dinheiro depositado e creditado no servidor é diretamente aplicado em sua própria manutenção, isto é, todo o capital girado em torno do mesmo é diretamente canalizado para o rumo de sua autossuficiência.
c) O '.$config['server']['serverName'].' luta pela sua estabilidade, entretando, não podemos impedir que erros venham a acontecer.
d) O histórico de doações está sendo salvado, ou seja, você nunca será esquecido.
e) O nome designado à central de trocas de pontos - '.$config['server']['serverName'].'Shop - é fictício; o '.$config['server']['serverName'].' não vende nenhum tipo de produto.
e) O '.$config['server']['serverName'].' é uma empresa sem fins lucrativos.
2. Perdas & Danos
a) Guarde o seu comprovante de doação. É o único documento que comprova a sua ajuda para a manutenção do servidor.
b) Em caso de resets, todas as doações que foram realizadas no prazo de dois meses (contando a partir do dia do reset) serão recreditadas integralmente nas contas dos jogadores. Lembrem-se que o histórico de doações está sendo salvo, porém você também precisa comprovar a sua participação nas doações.
c) Em caso de quedas e(ou) problemas que façam com que o '.$config['server']['serverName'].' fique off-line, em modo de segurança ou de espera por três dias consecutivos ou mais, os jogadores que optaram por debitar seus pontos em tempo VIP serão recreditados, da mesma maneira, com os dias perdidos (contando a partir do terceiro dia).
d) Em caso de paralização inesperada das atividades, não haverá reposição ou recreditação de capital investida no servidor, posto que toda doação é diretamente encaminhada à manutenção do mesmo. Neste caso, os jogadores serão comunicados pelos veículos de informação (site oficial ou fórum).
e) Em caso de paralização pré-programada das atividades, os jogadores serão informados através de nossos veículos de informação e a partir da data referida o sistema de doações encontrar-se-á fora do ar.
f) O '.$config['server']['serverName'].' oferece e investe na segurança básica para o servidor, cabe a você mantê-lo seguro; ou seja, não nos responsabilizamos pelos seus pertencens, personagens e contas.
3. Denotação # Doação
a) Ato ou efeito de doar.
b) Aquilo que se doa.
c) Contrato, ou documento que assegura e legaliza a doação simples: a que é feita por exclusiva resolução do doador.
</TEXTAREA>As regras e informações dispostas na caixa de diálogo acima podem ser modificadas sem aviso prévio.<br>
Caso você não concorde com a contratação sobre a doação simples por favor não prossiga.

</tbody></table> </div> </td></tr></tbody></table></div><br><table width="100%"><tbody><tr align="center"><td><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="border: 0px none;">
<a href="javascript:void();" onclick=location.href="?subtopic=donate&action=pag_form">
<div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif);"></div>
<input class="ButtonText" name="Continue" alt="Continue" src="layouts/tibiacom/images/vips/_sbutton_continue.gif" type="image">
</div></div></a></td></tr><tr></tr></tbody></table></td><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: 0px none;">
<a href="javascript:void();" onclick=location.href="?subtopic=donate"><div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif); visibility: hidden;"></div>
<input class="ButtonText" name="Back" alt="Back" src="layouts/tibiacom/images/vips/_sbutton_back.gif" type="image">
</table></td></tr></tbody></table>


';
}
}
elseif($action == 'selectchar')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{

$main_content .= '
<h1>Selecione o player</h1><BR>
<form action="index.php?subtopic=donate&action=pag_form" method=POST>
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr bgcolor="#505050"><td colspan="2"><font color="#FFFFFF"><b>Select the character you want receive the donate.</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="110"><b>Nome:</b></td><td width="550"><select name="buy_name">';
$players_from_logged_acc = $account_logged->getPlayersList();
if(count($players_from_logged_acc) > 0)
{
$players_from_logged_acc->orderBy('name');
foreach($players_from_logged_acc as $player)
{
$main_content .= '<option>'.$player->getName().'</option>';
}
}
else
{
$main_content .= 'Voce não tem nenhum char nessa account.';
}
$main_content .= '</table>
<br><center><input type="image" value="submit" src="layouts/tibiacom/images/buttons/sbutton_submit.gif"/>
</form>';
}
}
elseif($action == 'pag_form')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$buy_name = stripslashes(urldecode($_POST['buy_name']));
$main_content .= '<div id="ProgressBar"> <div id="Headline">Método de Pagamento</div> <div id="MainContainer"> <div id="BackgroundContainer">
<img id="BackgroundContainerLeftEnd" src="layouts/tibiacom/images/vips/stonebar-left-end.gif"> <div id="BackgroundContainerCenter">
<div id="BackgroundContainerCenterImage" style="background-image: url(layouts/tibiacom/images/content/stonebar-center.gif);"></div>
</div> <img id="BackgroundContainerRightEnd" src="layouts/tibiacom/images/vips/stonebar-right-end.gif"> </div>
<img id="TubeLeftEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-left-green.gif">
<img id="TubeRightEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-right-blue.gif"> <div id="FirstStep" class="Steps">
<div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-0-green.gif">
<div class="StepText" style="font-weight: normal;">Regras da Doação</div> </div> </div> <div id="StepsContainer1">
<div id="StepsContainer2"> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-1-green.gif"> <div class="StepText" style="font-weight: bold;">Metodo de Pagamento</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-2-blue.gif"> <div class="StepText" style="font-weight: normal;">Informações do Pedido</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-3-blue.gif"> <div class="StepText" style="font-weight: normal;">Confirmação</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-4-blue.gif"> <div class="StepText" style="font-weight: normal;">Pedido Realizado</div>
</div> </div> </div> </div> </div></div>Você está prestes a escolher um método de pagamento para fazer a sua doação!<br><br>

<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<form action="index.php?subtopic=donate&action=tipo" method="POST"><input type="hidden" name="char_name" value="">
<TR BGCOLOR="#505050">
<TD CLASS=white COLSPAN=3><B>Escolha o Método de Pagamento</B></TD>
</TR>
<TR BGCOLOR=#D4C0A1>
<TD><input type="radio" name="method" value="1" checked="checked"> PagSeguro - Cartão de crédito/Boleto</TD>
</TR>
<TR BGCOLOR="#505050">
<TR BGCOLOR=#D4C0A1>

<TD><input type="radio" name="method" value="3"> Banco do Brasil - Depósitos/DOCS/Transferencias Bancárias</TD>
</TR>
<TR BGCOLOR="#505050">
<TR BGCOLOR=#D4C0A1>

</TR>
</TABLE>
</tbody></table> <br><table width="100%"><tbody><tr align="center"><td><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="border: 0px none;">
<a href="javascript:void();" onclick=location.href="?subtopic=donate&action=pag_form">
<div class="BigButton" style="background-image: url(layouts/tibiacom/images/buttons/sbutton.gif);">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image: url(layouts/tibiacom/images/buttons/sbutton_over.gif);"></div>
<input class="ButtonText" name="Continue" alt="Continue" src="layouts/tibiacom/images/vips/_sbutton_continue.gif" type="image">
</table></td></tr></tbody></table>';
}$_SESSION["nome"] = stripslashes(urldecode($_POST['method']));
}
elseif($action == 'tipo')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$buy_tipo = stripslashes(urldecode($_POST['method']));
if($buy_tipo == 1) {
$main_content .= '
<form target="pagseguro" method="post" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml">
<input type="hidden" name="email_cobranca" value="'. $config['pagseguro']['email']. '">
<input type="hidden" name="tipo" value="CP">
<input type="hidden" name="moeda" value="BRL">
<input type="hidden" name="item_id_1" value="1">
<input type="hidden" name="item_descr_1" value="' . $config['pagseguro']['produtoNome'] . '">
<input type="hidden" name="item_frete_1" value="0">
<input type="hidden" name="item_quant_1" value="1">
<input type="hidden" name="item_peso_1" value="0">
<input type="hidden" name="ref_transacao" value="'.$account_logged->getCustomField("name").'-points">
<table border="0" cellpadding="4" cellspacing="1" width="100%" id="#estilo"><tbody>
<div id="ProgressBar"> <div id="Headline">Informações do Pedido</div> <div id="MainContainer"> <div id="BackgroundContainer">
<img id="BackgroundContainerLeftEnd" src="layouts/tibiacom/images/vips/stonebar-left-end.gif"> <div id="BackgroundContainerCenter">
<div id="BackgroundContainerCenterImage" style="background-image: url(layouts/tibiacom/images/content/stonebar-center.gif);"></div>
</div> <img id="BackgroundContainerRightEnd" src="layouts/tibiacom/images/vips/stonebar-right-end.gif"> </div>
<img id="TubeLeftEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-left-green.gif">
<img id="TubeRightEnd" src="layouts/tibiacom/images/vips/progress-bar-tube-right-blue.gif"> <div id="FirstStep" class="Steps">
<div class="SingleStepContainer"> <img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-0-green.gif">
<div class="StepText" style="font-weight: normal;">Regras da Doação</div> </div> </div> <div id="StepsContainer1">
<div id="StepsContainer2"> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-1-green.gif"> <div class="StepText" style="font-weight: normal;">Metodo de Pagamento</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-2-green.gif"> <div class="StepText" style="font-weight: bold;">Informações do Pedido</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-green-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-3-blue.gif"> <div class="StepText" style="font-weight: normal;">Confirmação</div>
</div> </div> <div class="Steps" style="width: 25%;"> <div class="TubeContainer">
<img class="Tube" src="layouts/tibiacom/images/vips/progress-bar-tube-blue.gif"> </div> <div class="SingleStepContainer">
<img class="StepIcon" src="layouts/tibiacom/images/vips/progress-bar-icon-4-blue.gif"> <div class="StepText" style="font-weight: normal;">Pedido Realizado</div>
</div> </div> </div> </div> </div></div>Escolha quantos pontos deseja comprar:<br><br>
</tr>
<tr>
<td width="10%">Sua conta</td>
<td><strong>'.$account_logged->getCustomField("name").'</strong></td>
</tr>
<tr>
<td width="10%">Pontos</td>
<td>
<select name="item_valor_1">
<option value="1000">10</option>
<option value="1500">15</option>
<option value="2000">20</option>
<option value="2500">25</option>
<option value="3000">30</option>
<option value="3500">35</option>
<option value="4500">45</option>
<option value="5500">55</option>
<option value="6000">60</option>
<option value="7500">75</option>
<option value="9000">90</option>
<option value="11500">115</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="image" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/carrinhoproprio/btnFinalizar.jpg" name="submit" alt="Pague com PagSeguro - é rápido, grátis e seguro!" />
</td>
</tr>
</tbody></table></form><p style="font-size: 18px">Ao doar pelo PagSeguro você não precisa confirmar seu pagamento, assim que PagSeguro aprovar o pagamento, os pontos serão adicionados automaticamente na sua conta.</p>'; }
if($buy_tipo == 3) {
$main_content .= '
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="#505050"><td colspan="1" class="white"><b>Banco do Brasil</b></tr></td>
<tr bgcolor="#D4C0A1"><td><img src="http://img526.imageshack.us/img526/2645/bancodobrasil2300x300.jpg"><br>
<br>
Favorecido: Nome Favorecido<br>
Conta Corrente: xxx.xxx <br>
Agência: xxx-xxx<br>
<br>
*O Pagamento pode ser feito através de Deposito ou Transferência Bancária (Não esqueça de confirmar a doação no link "Confirmar Doação").
</td></tr>
</table><br/>';
$main_content .= '
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="#505050"><td colspan="1" class="white"><b>Informações sobre Valores</b></td></tr>
<tr bgcolor="#D4C0A1"><td>R$ 5,00: 5 Premium Points<br>
R$ 10,00: 10 Premium Points<br>
R$ 20,00: 20 Premium Points<br>
R$ 30,00: 35 Premium Points*<br>
<br>
*O valor de cada Premium Point é de R$ 1,00. Porém, se a compra for acima de R$ 30,00 você ganha um bonus de + 15% em Premium Points de acordo com o valor comprado.<br>
Exemplo: Na compra de R$ 50,00 em Premium Points, você leva 58 Premium Points ao invés de 50 Premium Points. (Bonus de +15% em cima do valor).<br>
</td></tr>
</table><br/>';

}
if($buy_tipo == 4) {
$main_content .= '
<center><h1>Onebip - Sistema de Pagamento pelo celuar via SMS</center></h1>
';

$main_content .= '<center>
<table border="0" cellspacing=1 cellpadding=4 width="80%">
<tr bgcolor="'.$config['site']['vdarkborder'].'">
<center><th width="100%"><font class=black><b>Planos disponíveis</b></font></th>
</tr>
</table>
<table border="0" cellspacing=1 cellpadding=4 width="80%">
<tr>
<center><td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Doação - 5R$</center></b></td>
<td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Doação - 10R$</center></b></td>
<td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Doação - 20R$</center></b></td>
<td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Doação - 30R$</center></b></td>
<td bgcolor="'.$config['site']['darkborder'].'" witdh="2%"><center><b>Doação - 50R$</center></b></td>
</tr>
<tr>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b><a href="https://www.onebip.com/tinyurl/a1197d7b3e9048f56a29f82569a5d7aa" title="Mobile payment: send and receive money with your mobile phone">
<img src="http://www.onebip.com/tools/bts/btn04.gif" alt="Transfer money with your mobile phone credit" border="0"/>
</a></center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b><a href="https://www.onebip.com/tinyurl/78232439f44d5cba6ff3a5873dd59472" title="Mobile payment: send and receive money with your mobile phone">
<img src="http://www.onebip.com/tools/bts/btn04.gif" alt="Transfer money with your mobile phone credit" border="0"/>
</a></center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b><a href="https://www.onebip.com/tinyurl/a9f667a07c3e3719be57381b4910898e" title="Mobile payment: send and receive money with your mobile phone">
<img src="http://www.onebip.com/tools/bts/btn04.gif" alt="Transfer money with your mobile phone credit" border="0"/>
</a></center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b><a href="https://www.onebip.com/tinyurl/af26c76894856e21393b672ad4043076" title="Mobile payment: send and receive money with your mobile phone">
<img src="http://www.onebip.com/tools/bts/btn04.gif" alt="Transfer money with your mobile phone credit" border="0"/>
</a></center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b><a href="https://www.onebip.com/tinyurl/81fe3a8e3d6148bd733134f55c615ed8" title="Mobile payment: send and receive money with your mobile phone">
<img src="http://www.onebip.com/tools/bts/btn04.gif" alt="Transfer money with your mobile phone credit" border="0"/>
</a></center></b></td>
</tr>
<tr>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Faça sua Doação</center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Faça sua Doação</center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Faça sua Doação</center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Faça sua Doação</center></b></td>
<td bgcolor="'.$config['site']['lightborder'].'" witdh="2%"><center><b>Faça sua Doação</center></b></td></center>
</tr>
</table>
<table border="0" cellspacing=1 cellpadding=4 width="80%">
<tr bgcolor="'.$config['site']['vdarkborder'].'">
<td width="100%"></td>
</tr>
</table>
<br>
';

$main_content.='
<table border="0" cellspacing=1 cellpadding=4 width="100%">
<tr bgcolor="'.$config['site']['vdarkborder'].'">
<th width="100%"><font class=black>Observações</b></th>
</tr>
</table>
<table border="0" cellspacing=1 cellpadding=4 width="100%">
<tr bgcolor="'.$config['site']['darkborder'].'">
<td width="100%"><ul><li>Para efetuar com sucesso sua doação utilizando o sistema <b>Onebip</b> é necessário de atenção: Ao enviar a mensagem você recebera os créditos em sua conta Onebip e depois transferir para a conta do servidor, caso não seja feito isso seus pontos não vão chegar.</li></ul></td>
</tr>
<tr bgcolor="'.$config['site']['darkborder'].'">
<td width="100%"><ul><li>Todas as doações efetuadas no sistema <b>Onebip</b> precisam ser <a href="http://tibera-world.com/index.php?subtopic=confirmacao">Confirmadas</a> para serem creditas em sua account, caso contrário seus pontos não serão creditados</li></ul></td>
</tr>
</table>';
}
elseif($buy_tipo == 2)
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$main_content .= '<center>Ao clicar no botão submit você será redirecionado para a página de doações do PayPal, onde você deverá preencher os dados e concluir a doação.</center>
<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Pedido</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Método de pagamento:</b></td><td width="550" colspan="2">PayPal</TD></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Account:</b></td><td width="550" colspan="2">'.$account_logged->getName().'</td></tr>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<tr bgcolor="#D4C0A1"><td width="100"><b>Pontos:</b></td><td width="550" colspan="2"><select name="amount">
<option value="10.00">10 R$</option>
<option value="20.00">20 R$</option>
<option value="30.00">30 R$</option>
<option value="40.00">40 R$</option>
<option value="50.00">50 R$</option>
</select></td></tr>
</TABLE><BR>
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="EMAILPAYPALAQUI">
<input type="hidden" name="lc" value="BR">
<input type="hidden" name="item_name" value="Pontos na account de nome: '.$account_logged->getCustomField("name").'">
<input type="hidden" name="custom" value="'.$account_logged->getCustomField("name").'">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="currency_code" value="BRL">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="notify_url" value="http://tibera-world.com/ipn/ipn.php">
<input type="hidden" name="return" value="http://tibera-world.com">
<input type="hidden" name="rm" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG_global.gif:NonHosted">
<BR>
<table style="width:100%;" ><tr align="center" ><td>
<a href="index.php?subtopic=donate"><img border="0" src="layouts/tibiacom/images/buttons/sbutton_back.gif"></a> </TD>
<td><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."></TR>
</TABLE></form>';
}
}
}
}
elseif($action == 'finalps')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$buy_quant = stripslashes(urldecode($_POST['quant']));
$main_content .= '<center>Ao clicar no botão submit você será redirecionado para a página de doações do PagSeguro, onde você deverá preencher os dados e concluir a doação.</center>
<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<form target="pagseguro" action="https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx" method="post"><input type="hidden" name="char_name" value="">
<tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirme seus dados</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Método de pagamento:</b></td><td width="550" colspan="2">PagSeguro</TD></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Account:</b></td><td width="550" colspan="2">'.$account_logged->getName().'</td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Pontos:</b></td><td width="550" colspan="2">'.$buy_quant.'</td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Valor:</b></td><td width="550" colspan="2">'.$buy_quant.',00</td></tr>
</TABLE><BR>
<center>
<!-- INICIO FORMULARIO BOTAO PAGSEGURO -->
<form target="pagseguro" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml" method="post">
<input type="hidden" name="email_cobranca" value="daniel_freire2109@hotmail.com" />
<input type="hidden" name="tipo" value="CP" />
<input type="hidden" name="moeda" value="BRL" />
<input type="hidden" name="item_id_1" value="'.$buy_quant.'" />
<input type="hidden" name="item_descr_1" value="Pontos" />
<input type="hidden" name="item_quant_1" value="'.$buy_quant.'" />
<input type="hidden" name="item_valor_1" value="100" />
<input type="hidden" name="item_peso_1" value="0" />
<input type="hidden" name="ref_transacao" value="'.$account_logged->getName().'" />
<!-- FINAL FORMULARIO BOTAO PAGSEGURO -->
<BR>
<table style="width:100%;" ><tr align="center" ><td>
<a href="index.php?subtopic=donate"><img border="0" src="layouts/tibiacom/images/buttons/sbutton_back.gif"></a> </TD>
<td><input type="image" src="layouts/tibiacom/images/buttons/sbutton_submit.gif" name="submit" alt="Pague com PagSeguro - é rápido, grátis e seguro!" /></TR>
</TABLE></form>';
}
}
elseif($action == 'finalpp')
{
if(!$logged) {
$main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate..';
}
else
{
$main_content .= '<center>Ao clicar no botão submit você será redirecionado para a página de doações do PayPal, onde você deverá preencher os dados e concluir a doação.</center>
<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Pedido</b></font></td></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Método de pagamento:</b></td><td width="550" colspan="2">PayPal</TD></tr>
<tr bgcolor="#D4C0A1"><td width="100"><b>Account:</b></td><td width="550" colspan="2">'.$account_logged->getName().'</td></tr>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<tr bgcolor="#D4C0A1"><td width="100"><b>Pontos:</b></td><td width="550" colspan="2"><select name="amount">
<option value="10.00">10 R$</option>
<option value="20.00">20 R$</option>
<option value="30.00">30 R$</option>
<option value="40.00">40 R$</option>
<option value="50.00">50 R$</option>
</select></td></tr>
</TABLE><BR>
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="frizman@o2.pl">
<input type="hidden" name="lc" value="BR">
<input type="hidden" name="item_name" value="Pontos na account de nome: '.$account_logged->getCustomField("name").'">
<input type="hidden" name="custom" value="'.$account_logged->getCustomField("name").'">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="currency_code" value="BRL">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="notify_url" value="http://tibera-world.com/ipn/ipn.php">
<input type="hidden" name="return" value="http://tibera-world.com">
<input type="hidden" name="rm" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG_global.gif:NonHosted">
<BR>
<table style="width:100%;" ><tr align="center" ><td>
<a href="index.php?subtopic=donate"><img border="0" src="layouts/tibiacom/images/buttons/sbutton_back.gif"></a> </TD>
<td><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."></TR>
</TABLE></form>';
}
}
?>




Agora, crie um novo arquivo .php com o nome pag_retorno.php com este conteúdo:


<?
##############################################################
# CONFIGURAÇÕES PAGSEGURO AUTOMATICO LUCAS502 - XTIBIA.COM
##############################################################
$retorno_site = 'http://SEUSITE.COM'; // Site para onde o usuário vai ser redirecionado
$retorno_token = 'xxxxxxxxxxx'; // Token gerado pelo PagSeguro
if (empty($_POST['Referencia'])) { header("Location http://pagseguro.com.br"); }
list($accname, $world) = explode('-', $_POST['Referencia']);
if ($world=='alunia') {
$retorno_host = '127.0.0.1'; // Local da base de dados MySql
$retorno_database = 'Nome da Sua DB'; // Nome da base de dados MySql
$retorno_usuario = 'Usuario mysql'; // Usuario com acesso a base de dados MySql
$retorno_senha = 'Senha mysql'; // Senha de acesso a base de dados MySql
}

###############################################################
# ALTERE APENAS O QUE FOR PEDIDO DESTA LINHA PRA BAIXO
################################################################
$lnk = mysql_connect("127.0.0.1", "Usuario MYSQL", "Senha MYSQL") or die ('Nao foi possível conectar ao MySql: ' . mysql_error());
mysql_select_db("Nome da sua DB", $lnk) or die ('Nao foi possível ao banco de dados selecionado no MySql: ' . mysql_error());
// Validando dados no PagSeguro
$PagSeguro = 'Comando=validar';
$PagSeguro .= '&Token=' . $retorno_token;
$Cabecalho = "Retorno PagSeguro";
foreach ($_POST as $key => $value)
{
$value = urlencode(stripslashes($value));
$PagSeguro .= "&$key=$value";
}
if (function_exists('curl_exec'))
{
$curl = true;
}
elseif ( (PHP_VERSION >= 4.3) && ($fp = @fsockopen ('ssl://pagseguro.uol.com.br', 443, $errno, $errstr, 30)) )
{
$fsocket = true;
}
elseif ($fp = @fsockopen('pagseguro.uol.com.br', 80, $errno, $errstr, 30))
{
$fsocket = true;
}
if ($curl == true)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://pagseguro.uol.com.br/Security/NPI/Default.aspx');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $PagSeguro);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, 'https://pagseguro.uol.com.br/Security/NPI/Default.aspx');
$resp = curl_exec($ch);
curl_close($ch);
$confirma = (strcmp ($resp, "VERIFICADO") == 0);
}
elseif ($fsocket == true)
{
$Cabecalho = "POST /Security/NPI/Default.aspx HTTP/1.0\r\n";
$Cabecalho .= "Content-Type: application/x-www-form-urlencoded\r\n";
$Cabecalho .= "Content-Length: " . strlen($PagSeguro) . "\r\n\r\n";
if ($fp || $errno>0)
{
fputs ($fp, $Cabecalho . $PagSeguro);
$confirma = false;
$resp = '';
while (!feof($fp))
{
$res = @fgets ($fp, 1024);
$resp .= $res;
if (strcmp ($res, "VERIFICADO") == 0)
{
$confirma=true;
break;
}
}
fclose ($fp);
}
else
{
echo "$errstr ($errno)<br />\n";
}
}

if ($confirma) {
// Recebendo Dados
$TransacaoID = $_POST['TransacaoID'];
$VendedorEmail = $_POST['VendedorEmail'];
$Referencia = $_POST['Referencia'];
$TipoFrete = $_POST['TipoFrete'];
$ValorFrete = $_POST['ValorFrete'];
$Extras = $_POST['Extras'];
$Anotacao = $_POST['Anotacao'];
$TipoPagamento = $_POST['TipoPagamento'];
$StatusTransacao = $_POST['StatusTransacao'];
$CliNome = $_POST['CliNome'];
$CliEmail = $_POST['CliEmail'];
$CliEndereco = $_POST['CliEndereco'];
$CliNumero = $_POST['CliNumero'];
$CliComplemento = $_POST['CliComplemento'];
$CliBairro = $_POST['CliBairro'];
$CliCidade = $_POST['CliCidade'];
$CliEstado = $_POST['CliEstado'];
$CliCEP = $_POST['CliCEP'];
$CliTelefone = $_POST['CliTelefone'];
$NumItens = $_POST['ProdValor_1'];
$ProdQuantidade_x = $POST['ProdQuantidade_1'];

// Gravando Dados
mysql_query("INSERT into PagSeguroTransacoes SET
TransacaoID='$TransacaoID',
VendedorEmail='$VendedorEmail',
Referencia='$Referencia',
TipoFrete='$TipoFrete',
ValorFrete='$ValorFrete',
Extras='$Extras',
Anotacao='$accname',
TipoPagamento='$TipoPagamento',
StatusTransacao='$StatusTransacao',
CliNome='$CliNome',
CliEmail='$CliEmail',
CliEndereco='$CliEndereco',
CliNumero='$CliNumero',
CliComplemento='$CliComplemento',
CliBairro='$CliBairro',
CliCidade='$CliCidade',
CliEstado='$CliEstado',
CliCEP='$CliCEP',
CliTelefone='$CliTelefone',
NumItens='$NumItens',
Data=now(),
ProdQuantidade_x='$ProdQuantidade_x';");
if ($NumItens >= 60) {
$pontosadd = $NumItens;
} else {
$pontosadd = $NumItens;
}
if ($StatusTransacao == "Aprovado") {
mysql_query("UPDATE accounts SET premium_points = premium_points + '$pontosadd' WHERE name = '".htmlspecialchars($accname)."'");
mysql_query("UPDATE PagSeguroTransacoes SET StatusTransacao = 'Entregue' WHERE CONVERT( `PagSeguroTransacoes`.`TransacaoID` USING utf8 ) = '$TransacaoID' AND CONVERT( `PagSeguroTransacoes`.`StatusTransacao` USING utf8 ) = 'Aprovado' LIMIT 1 ;");
}
}
Header("Location: $retorno_site"); exit();
?>




Por último mas não menos importante, entre no site do PagSeguro e logue, após logar, vai aparecer várias opções na parte inferior do site do PagSeguro, clique em "Retorno Automático".
Nesta página, é onde você gera o seu Token PagSeguro e configura sua URL de retorno.
Você deve ativar a URL de retorno, e colocar este link na URL de Retorno:

http://SEUSITE.COM/index.php?subtopic=pag_retorno




Pronto, já está tudo OK, agora vou ensinar como configurar algumas partes de alguns arquivos que citei acima.


Configuração Adicional:
Depois que você já alterou as informações no config.php no que é pedido, algumas alterações devem ser feitas também no arquivo htdocs/pag_retorno.php :
(não esqueça de editar as partes que pedem informações sobre usuario, senha, nome db do MYSQL)

1 - Nas linhas:


$lnk = mysql_connect("127.0.0.1", "Usuario MYSQL", "Senha MYSQL") or die ('Nao foi possível conectar ao MySql: ' . mysql_error());
mysql_select_db("Nome da sua DB", $lnk) or die ('Nao foi possível ao banco de dados selecionado no MySql: ' . mysql_error());



Você deve alterar o que está sendo pedido, e no "127.0.0.1", se você usa seu site no mesmo PC ou Dedicado/VPS que o seu Server, pode deixar "127.0.0.1" mesmo, se não (no caso de usar domínio), deve colocar ali o seu IP Externo Numérico do Server.


2 - Nas linhas:

ProdQuantidade_x='$ProdQuantidade_x';");
if ($NumItens >= 60) {
$pontosadd = $NumItens;
} else {
$pontosadd = $NumItens;




Esta parte é a que entrega os pontos automaticamente pra account, se você tem algum tipo de promoção no seu server, deve alterar aqui conforme sua promoção, exemplo:
Se você tem a promoção de Double Points no seu Server, deve alterar:

$pontosadd = $NumItens;
} else {
$pontosadd = $NumItens;



Por este:

$pontosadd = $NumItens + $NumItens;
} else {
$pontosadd = $NumItens + $NumItens;



Para que os pontos sejam DOBRADOS na hora de entregar automaticamente, entendeu? rolleyes.gif


Bom Galera, é isso aí, espero que gostem.

Dúvidas, Sugestões ou Críticas, postem aqui para que eu possa atender a todos.


Créditos: Tutorial feito 100% por mim (Lucas502 - xtibia.com)

Te Ajudei? Então REP+ aew! plink.gif

EDIT: Adicionados Spoilers para melhor visualização do tópico.

Edited by Bennyyw
Link to post
Share on other sites

Voce ja testou isso? Eu uso modern acc, ele entrega os points automaticamente, mas eu tive que fazer o script, porque o que ta aqui no forum nao funciona.

Link to post
Share on other sites

Sim foi testado, eu mesmo tive que fazer o script também pra funcionar, e realmente o do fórum não funciona, por isso eu trouxe o meu pro xtibia.

 

Eu citei no tópico que foi testado, você leu? '-'

Link to post
Share on other sites

Sem problemas.

 

Sim, o botão curtir funciona sim, depois eu faço um tutorial explicando ou te mando uma mp explicando.

 

Edit ----

 

Legal que todos olham o tópico, mas ninguém comenta...

Link to post
Share on other sites

  • Administrador

Muito bom amigo, vou testar aqui e se tiver funcionando certinho vai receber fixed :D

 

Já lhe dei rep+ pela organização do tópico e vontade de contribuir!

Link to post
Share on other sites

É muito gratificante pra mim receber elogios, realmente muito obrigado!

 

Fico feliz em ajudar o xtibia :)

 

 

Espero pelo seu test e fixed :D

Edited by Lucas502
Link to post
Share on other sites

O conteúdo é bom, muita gente quer um sistema desse.

E logo o pessoal ta comentando aí pra você ficar feliz :p

 

Só uma coisa, o segundo e terceiro spoiler estão bugados, acho que é porque tão no "meio" do negrito (pelo menos aqui).

Link to post
Share on other sites

A propósito, quanto tempo leva pra sair da "Aprovação" ?

 

-- EDIT

 

Aff, double post ¬¬,

 

Maldito Chrome

Edited by Lucas502
Link to post
Share on other sites

muito bom cara!

se der certo aki vo te dar rep todos os dias

XD

 

awe amigo!

tentando adicionar aki no meu site fikei com umas duvidas

vc manda editar o arquivo que fica em htdocs/config/config.php

mas o meu n fica ai...

tenhu um em htdocs/config.php

e outro fica em htdocs/Web Poketibia 1.0/config.php

 

agradeço desde jha!

Edited by Foxkbt
Link to post
Share on other sites

Aqui ta dando isso sabe o que pode ser?

 

Erro 140 - A DESCRIÇÃO do item 1 nÃo foi informada.

 

e nesta linha "<input type="hidden" name="moeda" value="BRL">"

eu devo deixar BRL ou BR?

 

Vlw

Edited by Igor6
Link to post
Share on other sites

@Foxkbt

Edita o config.php que contém o seu email do pagseguro, mas pra garantir edita os 2..

 

 

@Igor6

Pode deixar BRL mesmo, (aqui ta BRL e funfando certinho), e verifica se fez tudo certinho. (provavelmente esse erro esteja na DB, verifica se criou a table PagSeguroTransacoes com a query que citei no tutorial.)

A propósito, ta usando Gesior ou Modern?

Link to post
Share on other sites

Já executei a tabela, #1050 - Table 'pagsegurotransacoes' already exists

Estou usando gesior.

Devo alterar em mais algum lugar? ou so ali onde coloquei os "x"? Tirando colocar o e-mail no config.php

 

ALTERE APENAS O QUE FOR PEDIDO DESTA LINHA PRA BAIXO

################################################################

$lnk = mysql_connect("127.0.0.1", "root", "xxxxxxxxxx") or die ('Nao foi possível conectar ao MySql: ' . mysql_error());

mysql_select_db("xxxxxxxxx", $lnk) or die ('Nao foi possível ao banco de dados selecionado no MySql: ' . mysql_error());

 

 

 

# CONFIGURAÇÕES PAGSEGURO AUTOMATICO LUCAS502 - XTIBIA.COM

##############################################################

$retorno_site = 'xxxxxxxxxxxxxxx'; // Site para onde o usuário vai ser redirecionado

$retorno_token = 'xxxxxxxxxxxxxxxxxxx'; // Token gerado pelo PagSeguro

if (empty($_POST['Referencia'])) { header("Location http://pagseguro.com.br"); }

list($accname, $world) = explode('-', $_POST['Referencia']);

if ($world=='alunia') {

$retorno_host = '127.0.0.1'; // Local da base de dados MySql

$retorno_database = 'xxxxxxxxx'; // Nome da base de dados MySql

$retorno_usuario = 'root'; // Usuario com acesso a base de dados MySql

$retorno_senha = 'xxxxxxxx'; // Senha de acesso a base de dados MySql

 

Obs: Ali onde coloca site pra onde ele vai ser redirecionado, eu ainda estou com server no pc e uso ele pelo ip ou localhost, devo deixar assim?

localhost/index.php?subtopic=pag_retorno

 

Vlw

Edited by Igor6
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share