Olá galera ÉckzTibiana, estou postando umas paradas interessantes aqui na xtibia.
Hoje eu estou trazendo um sistema desenvolvido para servers que possuem shop system, é um sistema simples mas útil. É um sistema o qual registra todas as transações de itens da shop no seu servidor, dando a possibilidade do administrador do server ficar por dentro e de olho nas transações.
- Sreen Shot:
clique na imagem para visualizar
- Observações:
* Este sistema foi eu quem criei, caso quiseres editá-lo, fique a vontade, mas por favor mantenha os créditos.
* É extremamente nescessário um backup do layout.php, index ou home.php e fundamentalmente da sua DataBase.
* Se desejares postar em outro fórum avise-me.
- Explicando oque será feito...
No 1º passo nós prepararemos o shopsystem para registrar os dados extras, no caso o id do item, o nome do item e de quem foi debitado os points.
No 2º passo nós criaremos a página que executará as checagens e mostrará os dados.
No 3º passo nós incluíremos a página trans-admin ao subtopic, para que possa ser visualizada pelo home.php.
No 4º passo nós adicionaremos ao menu Account o link para o Trans Admin, o qual só podera ser acessado por admins.
Mo 5º passo executaremos as SQL Queries.
Bem é isso, vamos trabalhar...
- Como Instalar?
Basta seguir os passos:
1º:
Abra o seu “shopsystem.php” e procure por:
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_accountname, from_account, price, offer_id, offer_name, offer_itemid, 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->getName()).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', \'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="home.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>'; }
Substitua a linha da váriavel $save_transaction por isso:
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_accountname, from_account, price, offer_id, offer_name, offer_itemid, 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->getName()).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
2º:
Crie um documento chamado trans-admin.php e coloque o seguinte nele:
<?PHP //Criado por Dhenyz Shady, XTibia | NO RIP, mantenha os créditos! // http://shadyroom.blogspot.com | dennis_anderson232@hotmail.com if($action == '') { if(!$logged) { $main_content .= 'Please login first.'; } else{ if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { $account_name = $SQL->query('SELECT `id` FROM '.$SQL->tableName('accounts').' WHERE '.$SQL->fieldName('id').' = '.$SQL->fieldName('name').' ;'); $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->fieldName('to_account').' OR '.$SQL->fieldName('from_account').' = '.$SQL->fieldName('from_account').';'); 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 = 'blue'; $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 .= $item_received['from_accountname']; else $items_received_text .= $item_received['from_accountname']; $items_received_text .= '</td><td>'.$item_received['offer_name'].'</td><td>'.$item_received['offer_itemid'].'</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->fieldName('to_account').' OR '.$SQL->fieldName('from_account').' = '.$SQL->fieldName('from_account').';'); 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 = 'blue'; $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>'; } } $main_content .= '<center><h1></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="6"><font color="white" size="4"><b> Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>Comprador:</b></td><td><b>De:</b></td><td><b>Item Comprado:</b></td><td><b>ID:</b></td><td><b>Data de Compra:</b></td><td><b>Recebido no Server:</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="6"><font color="white" size="4"><b> Premium/VIP Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>De:</b></td><td><b>Duracao:</b></td><td><b>Valor:</b></td><td><b>Adicionado:</b></td></tr>'.$paccs_received_text.'</table><br />'; if(empty($paccs_received_text) && empty($items_received_text)) $main_content .= 'Nao ha registros de transasoes.'; } } if(!$logged) $main_content .= 'Voce precisa estar logado e ser da staff.'; } else $main_content .= "You don't have required access!"; ?>
3º:
Vá até o "home.php" ou "index.php" (depende qual vc usa como principal, basta entrar no site e ver) e adicione isso:
case "trans-admin"; $subtopic = "trans-admin"; $topic = "trans-admin"; include("trans-admin.php"); break;
4º:
Abra seu "layout.php", localize
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) echo "<a href='?subtopic=adminpanel'> <div id='submenu_adminpanel' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_adminpanel' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'><font color=\"red\">[Admin Panel]</font></div> <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> </div> </a>";
e acrescente isso logo abaixo do </a>";:
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) echo "<a href='?subtopic=trans-admin'> <div id='submenu_trans-admin' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_trans-admin' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'><font color=\"red\">[Trans Admin]</font></div> <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> </div> </a>";
5º:
Agora voce só precisa das SQL Queries.
Abra o seu gerenciador SQL e execute as seguintes queries:
ALTER TABLE `z_shop_history_item` ADD COLUMN `offer_itemid` INT( 11 ) NOT NULL; ALTER TABLE `z_shop_history_item` ADD COLUMN `from_accountname` VARCHAR( 255 ) NOT NULL; ALTER TABLE `z_shop_history_item` ADD COLUMN `offer_name` VARCHAR( 255 ) NOT NULL;
- Shady Bugo tudo!
Este sistema foi desenvolvido em baso no Gesior 0.38. Mas ele funciona em todos os sites, todos.
Caso ocorra algum bug basta refazer os passos acima com atenção. Caso o problema persistir avise aqui.
- Créditos:
100% meus.
Bom galerinha é isso, espero comentários, e caso o sistema seja aprovado... reputem.
Cya