• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

WebATS Manager

treta

pegael.gringo
Joined
Sep 13, 2008
Messages
17
Reaction score
0
Hello, I'm Brazilian and programmer, I'm at a certain time developing a Web Manager, is something different in this area have seen a totally different logic.

The WebATS will work with modules, for those who have messed with magento and forums will better understand what I explain.
The aim of the manager is not WebATS be more of a project site of ATS, but have a differential. And what would it be? I thought no more as, from innovative systems to different layouts, but the key topic was the development, so I thought of a way to make life easier for those who use, and those who program. So I devised a system that is accessible to any lay person modify your site, and any programmer codar on the site with ease.

The site will be launched already with some very innovative systems standards.
The differential as already said, is the engine.

Example: If someone makes a language pack to the site, and available for download, you just download the package that will extract the package to the root of the site and update the site (F5) the site will take care of all the rest, He will check the module, install the language pack, simplifying, will do all the heavy lifting alone. This I call the global-autoloader modules are modules that load automatically to the site, without any need for user intervention.

System widgets.
System are widgets for users who like many changes in its layout, so can install widgets on your layout with ease.

Exemple of widget loginBox code:

Code:
<?php if (!defined('_VALID_'))die ('Unauthorized Access'); ?><!-- LOAD ALL GLOBAIS VARIAVEIS -->
<!-- MODULO NAME: widget/LoginBoxMenu -->
<!-- MODULO AUTOR: WEB ATS -->
<!-- CHECK: TRUE -->
<!-- CHECK EXIST DB: accounts -->
<!-- CHECK EXIST DB: web_ats_langs -->
<!-- CHECK EXIST DB: web_ats_traducoes -->
<!-- CHECK ARQUIVO: includes/pt-br.php -->
<!-- CHECK ARQUIVO: includes/en.php -->
<!-- CHECK DB: * FROM web_ats_traducoes WHERE lang = 'pt-br' and sistema = 'widgets/loginBoxMenu'  -->
<!-- CHECK DB: * FROM web_ats_traducoes WHERE lang = 'en' and sistema = 'widgets/loginBoxMenu'  -->
<!-- UPDATE DB LANG: pt-br -->
<!-- UPDATE DB LANG: en -->


{if page protect}
<h2>{lang WELCOME}, {AccountLogged realname}.</h2>
        <ul class="sidemenu">
            {if page protect level 6}
                <li>
                    <a href='admin.php'>Painel Admin</a>
                </li>                
            {/if}
            <li>
                <a href='{path}account/painel'>{lang MENU_HOMEACC1}</a>
            </li>
            <li>
                <a href='{path}account/players'>{lang ACC_INFOTAB11}</a>
            </li>
            <li>
                <a href='{path}account/alterar-info'>Change Password</a>
            </li>            
            <li>
                <a href='{path}account/painel/logout'>Logout</a>
            </li>
        </ul>
{if else}
<h2>{lang TITLE.LOGINBOX}</h2>
<ul class="sidemenu">    
        <form action="{path}account/login" method="post">
        <ul id="loginBoxMenu"><p>
                {lang USER.LOGINBOX}: <br>
                <input type="password" name="account"><p>
                {lang PASS.LOGINBOX}: <br>
                <input type="password" name="password">
                <?php $Token->create(); ?>
                <input name="doLogin"  type="submit" value="{lang SUBMIT.LOGINBOX}">
        </ul>
        </ul>
</form>
{/if}

if you need call widget make a code:
Code:
<!-- LOAD MODULO: widgets/loginboxmenu -->
In any part of your layout, the module will be called and included on page.
So a module is called if it has language pack will be automatically identified and installed prior to running the same.
All lines that are in the code above as comment lines are commands to verify that the system was given, return an error if the user is notified and is barred the operation of the module.

Multi-system layout.
The layout is as simple as possible, facilitated much thus facilitating the creation of new layouts for the site.

System security risk.
I'm using lib PHPIDS.
I had a hard work in the security issue, so the result is very visible, any kind of attack is minimal, will be identified and notified to the administrator, because all user actions before the site are monitored, and any type of suspicious action is barred and created a log.

System & token cache.
Also present these systems, the same systems znoteacc, I asked the same and I was given permission to use base-code, then the code usuflui and implemented the POO site.

These are just some site systems, among many others, I specified only the most important, I hope to have a good response from the public. This project will be an open sourc.


For now I schedule all alone, this is the big problem of delay in completion of the project, but I predict that by January finish a version beta.


For those interested in learning more about the project, please visit the link: WebATS Manager - P�gina Inicial
You can better visualize the project's progress.

Sorry for bad english, I'm using google translator, so it's expected poor result

If you have a question, just ask me I will answer :$

For the curious:
Example of code of system shop list:


Code:
<?php if (!defined('_VALID_'))die ('Unauthorized Access'); ?>
<!-- LOAD ALL GLOBAIS VARIAVEIS --> 
{if page protect}
<!-- CHECK: TRUE -->
<!-- CHECK EXIST DB: web_ats_shop -->
<!-- CHECK EXIST DB: web_ats_shop_compras -->
<!-- CHECK EXIST DB: web_ats_shop_cupons -->
<!-- CHECK EXIST DB: web_ats_shop_historico -->
<!-- CHECK DB: produto_id from web_ats_shop -->
<!-- CHECK DIRETORIO: includes -->
<!-- CHECK ARQUIVO: includes/functions.php -->
<!-- LOAD MODULO INCLUDE: functions.php -->
<?php 
if(ShopStatus == 'open'){
$Get = $user->filter($user->getParam(3)); 
if ($Token->isValid($_POST['token'])) {
	foreach($_POST as $key => $value) {
		$_POST[$key] = $user->filter(($value));
	}
}

if (isset($_POST['ConfirmBuy'])) {
	$postID = (int)$_POST['ConfirmBuy'];
	}elseif(isset($_POST['buy'])) {
	$postID = (int)$_POST['buy'];
}


if({Session GET cupomProdutoID} != $postID){
	{Session DROP cupomShop}
	{Session DROP cupomDesconto}
	{Session DROP cupomProdutoID}
}
if (isset($_POST['CupomDesconto'])) {
	if(!{Session GET cupomShop}){
		$erromsg = array();
		
		$Cupom = $user->filter($_POST['CupomDesconto']);
		$query = mysql_query("SELECT * FROM web_ats_shop_cupons WHERE cupom_key = '$Cupom' ");
			if($query){
				$erroInvalid=true;
				while($row = mysql_fetch_object($query)) {
						$erroInvalid=false;
						$CupomDesconto = $row->desconto;
						if(!$row->ativado){
							$erromsg[] = 'Cupom inválido.';
						}
						if(empty($erromsg)){
							if($row->time_expire < time() and $row->ativado != '2'){
								// Validade vencida
								$erromsg[] = 'Cupom inválido.';
							}
						}
						if(empty($erromsg)){
							if($row->required_acc){
								$RequiredAcc = unserialize($row->required_acc);
								if(strtolower(gettype($RequiredAcc)) == 'array'){
									$ErrorLoop = true;
									foreach ($RequiredAcc as $n) {
										if($n == {Session GET account}){
											$ErrorLoop=false;
										}
										if($ErrorLoop){ $erromsg[] = 'Cupom inválido.'; }else{ break; }
									}
								}elseif($row->required_acc != {Session GET account}){
									// Caso cupom seja configurado para ser requerido por uma acc expecifica 
									$erromsg[] = 'Cupom inválido.';
								}
								
							}
						}
							if(empty($erromsg)){ 
								$AccUser = unserialize($row->acc_used);
								if(strtolower(gettype($AccUser)) == 'array'){
									foreach ($AccUser as $n) {
										if($n == $Account->account_logged('name')){
											$erromsg[] = 'Cupom inválido.';
										}
									}
									
								}else{
									if($row->acc_used == $Account->account_logged('name')){
										$erromsg[] = 'Cupom inválido.';
									}
								}
							
							}
						}
				}
				 if($erroInvalid) $erromsg[] = 'Cupom inválido.';
				 
				if(empty($erromsg)){
					{Session SET cupomShop/$Cupom}
					{Session SET cupomDesconto/$CupomDesconto}
					{Session SET cupomProdutoID/$user->filter($_POST['buy'])}
					$sucemsg[] = 'Cupom ativado com sucesso, confira o novo valor do produto com '.$CupomDesconto.'% de desconto!';
				}
			}else{ $erromsg[] = 'Já existe um cupom ativo para esse produto.'; }
	}

if({Session GET cupomShop}){
	$Cupom = $session->get('cupomShop');
	$query = mysql_query("SELECT * FROM web_ats_shop_cupons WHERE cupom_key = '$Cupom' and ativado = '3'");
	if($query){
		while($row = mysql_fetch_object($query)) {
			$AccUser = unserialize($row->acc_used);
			if(strtolower(gettype($AccUser)) == 'array'){
				foreach ($AccUser as $n) {
					if($n == $Account->account_logged('name')){
						{Session DROP cupomShop}
						{Session DROP cupomDesconto}
						{Session DROP cupomProdutoID}
					}
				}
			}
		}
	}
	if(!$db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},ativado)){
		{Session DROP cupomShop}
		{Session DROP cupomDesconto}
		{Session DROP cupomProdutoID}
	
	}
	
}

$ShopList = ShopUniqueProduto($postID);
if ($ShopList) {
	?><?php
			foreach ($ShopList as $n) { 	
				$valor = (int)$n['produto_valor'];
				if($n['produto_desconto'] and $n['produto_desconto_time'] >= time()){
					$percentual =  $n['produto_valor_desconto'] / 100;
					$valor_calc = $valor - ($percentual * $valor);
					$valor_calc = (int)$valor_calc;

					
					if({Session GET cupomShop}){
					$percentual =  {Session GET cupomDesconto} / 100;
					$valor_calc = $valor_calc - ($percentual * $valor_calc);
					$valor_calc = (int)$valor_calc;
					$valor_final = '<font color="#74A846">'.$valor_calc.'</font>';
					}else{ $valor_final = '<font color="#74A846">'.$valor_calc.'</font>'; }
				}else{ 
					if({Session GET cupomShop}){
					$percentual =  {Session GET cupomDesconto} / 100;
					$valor_calc = $valor - ($percentual * $valor);
					$valor_calc = (int)$valor_calc;
					$valor_final = '<font color="#74A846">'.$valor_calc.'</font>';
					}else{ $valor_final = $valor; $valor_calc = $valor;}
				}
			
?>
			<?php include ''.$WEBATS['folder']['layouts'].'/'.$template->loadLayout().'/templates/error.php'; ?>
				<table width="94%">
				<tr class="row-a">
				<th><?php echo $n['produto_type']; ?></th>
				</tr>
				</table>
				<table width="94%">
				<tr class="row-b">
				<td>#</td>
				<td>Nome:</td>
				<td>Quantidade:</td>
				<td>Valor:</td>
				</tr><?php
					if($n['permitir_devolucao'] and DevolverItem or $n['produto_desconto'] and $n['produto_desconto_time'] >= time()){ $c = '*';}
					echo '<tr class="row-a">';
					echo '<td width="5%"><img class="customGal" src="'.BASE_URL.''.$WEBATS['folder']['modulos'].'/shop/list/imagens/'.$n['produto_type'].'/'.$n['produto_imagem'].'" width="32" height="32"  /></td>';
					echo '<td width="50%">'. $n['produto_name'] .''.$c.' </td>';
					echo '<td width="25%">'. $n['produto_quantidade'] .'x</td>';
					echo '<td width="15%">'. $valor_final .'</td>';
					echo '</tr>';
					?>
					
			</table><?php 
				if(empty($_POST['ConfirmBuy'])){
					if($n['produto_desconto'] and $n['produto_desconto_time'] >= time()){ echo '<p> <font size="1">*Produto com <font color="#FF0000">'.$n['produto_valor_desconto'].'% </font> de desconto até: '.date('d/m H:i',$n['produto_desconto_time']).'</font>';} 
					if($n['permitir_devolucao'] and DevolverItem){ echo '<p> <font size="1">*É permitido a devolução deste item após a compra por uma taxa dê: '.ValorDevolverItem.' '.CoinName.'.</font>';}
					?>
						<table width="94%">
							<tr class="row-a">
							<th>Cupom de Desconto</th>
							</tr>
							</table>
							<?php if($session->get('cupomProdutoID') != $_POST['buy']){ ?>
							<form action="{path}shop/buy" method="POST"><p>Cupom de Desconto: 
							<input name="CupomDesconto" type="text" id="CupomDesconto"  value="">
							<input type="hidden" name="buy" value="<?php echo (int)$n['produto_id']; ?>">
							<?php $Token->create(); ?>
							<input style="" type="submit" value="Ativar Cupom">
							</form >
							<?php }else{  echo '<p><th>Cupom de desconto ativado: '.strtoupper({Session GET cupomShop}).'</th></p>'; }?>					
					<table width="94%">
					<tr class="row-a">
					  <th>Players da sua Account</th>
					</tr>
						<td>														
								<?php
								 $AccountPlayers = $Account->account_logged_players();
									if ($AccountPlayers) {
									echo '<form action="'.BASE_URL.'shop/buy" method="post"> Personagem: <select name="name">';
									foreach ($AccountPlayers as $SearchPlayerArray) { ?>
									<option value="<?php echo $SearchPlayerArray['name']; ?>"><?php echo $SearchPlayerArray['name']; ?></option>
								<?php } echo '</select>'; ?>
							
							<?php if($n['produto_subtype'] == 'changername'){ ?>
								</br>Novo Nome: <input style="margin-left: 5px;" name="newName" type="text" id="web3"  value="">
							<?php } ?>
							<input type="hidden" name="ConfirmBuy" value="<?php echo (int)$n['produto_id']; ?>">	
							<?php $Token->create(); ?>							
							<input style="margin-left: 5px;" type="submit" value="Finalizar Compra">
							</form >
							<?php }else{ echo 'Você não tem players criados em sua conta.'; }  ?>
						
						</td>
					</table>
					<?php if($n['produto_subtype'] != 'changername'){ ?>
					<table width="94%">
						<tr class="row-a">
						  <th>Digite nome do Player</th>
						</tr>
						<td>
						<form action="{path}shop/buy" method="POST">
							Personagem: <input name="to_name" type="text" id="web3"  value=""></br>
							Nome do Seu Player: <input name="from_name" type="text" id="web3"  value="">
							<input type="hidden" name="ConfirmBuy" value="<?php echo (int)$n['produto_id']; ?>"></br>
							<?php $Token->create(); ?>
							<input style="margin-left: 380px;" type="submit" value="Finalizar Compra">
						</form >
						<form action="{path}shop/list" method="POST"><p>
						<?php $Token->create(); ?>
						<input style="margin-top: -40px; margin-left: -30px; position: absolute;" name="submit" type="submit" value="Back" title="Back"/>
						</form >
						</td>
						</table>
					<?php
					}
				}else{
					if(empty($_POST['ConfirmPay'])){
						if(isset($_POST['to_name'])){
							if($n['produto_subtype'] != 'changername'){
								if(!AnonymousBuy){
									if(empty($_POST['from_name'])){
									$ErrorCompra=true;
									$Error='Digite nome do seu player.';
									}
								}
								if(!$ErrorCompra){
									if(!$db->info_db(players, name, urldecode($_POST['to_name']),id)){
										$ErrorCompra=true;
										$Error='Este persongem não existe.';									
									}
								}
								
								
								if(!empty($_POST['from_name'])){
									if(!$ErrorCompra){
										$PlayerAccountID = $db->info_db(players, name, urldecode($_POST['from_name']),account_id);
										$AccountID = $Account->account_logged('id');
										if($PlayerAccountID != $AccountID){
											$ErrorCompra=true;
											$Error='Este personagem não pertence a sua account.';										
										}
									}
								}
								
								if(AnonymousBuy){
									if(empty($_POST['from_name'])){
										$_POST['from_name'] = 'Anonymous';
									}
								}
								
								if(!$ErrorCompra){
									$PlayerAccountID = $db->info_db(players, name, urldecode($_POST['to_name']),account_id);
									$AccountID = $Account->account_logged('id');
									if($PlayerAccountID == $AccountID){
										$ErrorCompra=true;
										$Error='Não é permitido compra algo para si mesmo dessa maneira, utilize a outra opção.';
									}
								}
							}
						}else{ 
							if(!$db->info_db(players, name, urldecode($_POST['name']),id)){
								$ErrorCompra=true;
								$Error='Este persongem não existe.';
							}
							if(!$ErrorCompra){
								if($db->info_db(players, name, urldecode($_POST['name']),online)){
									$ErrorCompra=true;
									$Error='Personagem deve estar offline para confirmar a compra.';
								}
							}
							
							if(!$ErrorCompra){
								$PlayerAccountID = $db->info_db(players, name, urldecode($_POST['name']),account_id);
								$AccountID = $Account->account_logged('id');
								if($PlayerAccountID != $AccountID){
									$ErrorCompra=true;
									$Error='Este personagem não pertence a sua account.';
								}
							}
							if($n['produto_subtype'] == 'changername'){
								if(!$ErrorCompra){									
									if($db->info_db(players, name, urldecode($_POST['newName']),name)){
										$ErrorCompra=true;
										$Error='Já existe um player com este nome.';
									}
								}
								
								if(!$ErrorCompra){									
									if($Account->checkNewPlayerName($_POST['newName'])){
										$ErrorCompra=true;
										$Error=$Account->checkNewPlayerName($_POST['newName']);
									}
								}
							}
						}
						
					if(!$ErrorCompra){	
				?>
				<table width="94%">
						<tr class="row-a">
						  <th>Confirmar Compra ?</th>
						</tr>
						<td>Personagem: <?php if(isset($_POST['to_name'])){ echo $Account->formatCharacterName($_POST['to_name']); }else{ echo $Account->formatCharacterName($_POST['name']); }?> </br>Após efetuar a compra faça login no servidor.</td>						
						</table>

						<form action="{path}shop/buy" method="POST" onsubmit="return confirm('Deseja realmente compra este produto por <?php echo $valor_calc; ?> <?php echo CoinName; ?>?');"><p>
							<input type="hidden" name="ConfirmBuy" value="<?php echo (int)$n['produto_id']; ?>">
							<input type="hidden" name="ConfirmPay" value="yes">
							<input type="hidden" name="ConfirmBuyTime" value="<?php echo time()+TimeSessionBuy; ?>">
							<?php if(empty($_POST['to_name'])){ ?>
							<input type="hidden" name="ConfirmPayName" value="<?php echo $_POST['name']; ?>">
							<?php if($n['produto_subtype'] == 'changername'){ ?>
							<input type="hidden" name="newName" type="text" id="web3"  value="<?php echo $_POST['newName']; ?>">
							<?php } ?>
							<?php }else{ ?>
							<input type="hidden" name="ConfirmPayTOName" value="<?php echo $_POST['to_name']; ?>">
							<input type="hidden" name="ConfirmPayFROMName" value="<?php echo $_POST['from_name']; ?>">
							<?php } ?>
							<?php $Token->create(); ?>
							<input style="margin-left: 400px;" type="submit" value="Finalizar Compra">
						</form >
						<form action="{path}shop/buy" method="POST"><p>
						<input type="hidden" name="buy" value="<?php echo (int)$n['produto_id']; ?>">
						<?php $Token->create(); ?>
						<input style="margin-top: -40px; position: absolute;" name="submit" type="submit" value="Back" title="Back"/>
						</form >

				<?php
					}
					}elseif($_POST['ConfirmPay'] == 'yes') {
						// confirmação do pagamento true
						$Coins = $Account->account_logged('coin');
						$Coins = $Coins - $valor_calc;
						if($Account->account_logged('coin') < $valor_calc){
							$ErrorCompra=true;
							$Error=''.CoinName.' Insuficientes para efetuar a compra.';
						}
						
						if($_POST['ConfirmBuyTime'] < time()){
							$ErrorCompra=true;
							$Error='Sua sessão expiro, retorne a lista de itens e selecione novamente o item desejado.';
						}

						if(!$ErrorCompra){						
							$defineTime = time();
							$Name = $_POST['ConfirmPayName'];
							
							//CHANGERNAME
							if($n['produto_type'] == 'others' and $n['produto_subtype'] == 'changername'){
								$OrderStatus = 'alterado';
								$Name = $_POST['newName'];
								$Suce=true;
								$MsgSuce='Compra finalizada com sucesso, nome do seu player foi alterado.';
								$data = array('name' => $Name);
								$db->update_array('players', $data, "name='".$_POST['ConfirmPayName']."'");
								@mysql_query("update `web_ats_shop` set `quantidade_vendida`=`quantidade_vendida`+1 where `produto_id`=$n[produto_id]");
							}
							
							
							//REDSKULL
							if($n['produto_type'] == 'others' and $n['produto_subtype'] == 'redskull'){
								@mysql_query("update `web_ats_shop` set `quantidade_vendida`=`quantidade_vendida`+1 where `produto_id`=$n[produto_id]");
								$OrderStatus = 'removido';
								$Name = $_POST['ConfirmPayName'];
							}
							
							//UNBAN
							if($n['produto_type'] == 'others' and $n['produto_subtype'] == 'unban'){
								$OrderStatus = 'removido';
								if(isset($_POST['ConfirmPayTOName'])){
								$AccountIDTOName = $db->info_db(players, name, urldecode($_POST['ConfirmPayTOName']),account_id);
								$AccountName = $Account->account_id($AccountIDTOName);							
								}else{
									$AccountName = {Session GET account};
								}
								$bans_query = $db->select("SELECT * FROM bans WHERE value = $AccountName AND active = '1'");
								if(mysql_num_rows($bans_query) == 0) {
									$ErrorCompra=true;
									$Error='Este player não esta banido.';							
								}
								if(!$ErrorCompra){
										@mysql_query("update `web_ats_shop` set `quantidade_vendida`=`quantidade_vendida`+1 where `produto_id`=$n[produto_id]");
										@mysql_query("DELETE FROM `bans` WHERE `value` = $AccountName");
										$Suce=true;
										$MsgSuce='Ban removido com sucesso do player.';
								}
							}
							
							if($n['produto_type'] == 'premmy'){
									$OrderStatus = 'entregue';
									$db->tableName(accounts);
									$data = array($db->rowName('coin') => $Coins);
									$db->update_array($db->tableName(accounts), $data, "".$db->rowName('name')."=".$Account->account_logged('name')."");
									
									if(isset($_POST['ConfirmPayTOName'])){
										$AccountIDTOName = $db->info_db(players, name, urldecode($user->filter($_POST['ConfirmPayTOName'])),account_id);
										$AccountPremmdaysTOName = $db->info_db(accounts, id, $AccountIDTOName,premdays);
										$PremmyDays = $AccountPremmdaysTOName + $n['produto_quantidade'];
										$data = array($db->rowName('premdays') => $PremmyDays);
										$db->update_array($db->tableName(accounts), $data, "".$db->rowName('id')."=".$AccountIDTOName."");
									
									}else{
									$PremmyDays = $Account->account_logged('premdays');
									$PremmyDays = $PremmyDays + $n['produto_quantidade'];
									$data = array($db->rowName('premdays') => $PremmyDays);
									$db->update_array($db->tableName(accounts), $data, "".$db->rowName('name')."=".$Account->account_logged('name')."");
									}
									@mysql_query("update `web_ats_shop` set `quantidade_vendida`=`quantidade_vendida`+1 where `produto_id`=$n[produto_id]");
									$Suce=true;
									$MsgSuce='Compra finalizada com sucesso, seus dias de premmy já foram inseridos em sua conta.';
							}
							
							if($n['produto_type'] == 'item'){
									$OrderStatus = 'aguardando';
									$data = array($db->rowName('coin') => $Coins);
									$db->update_array($db->tableName(accounts), $data, "".$db->rowName('name')."=".$Account->account_logged('name')."");
									
									/*if(isset($_POST['ConfirmPayTOName'])){
										$data = array(
									   'nome' => $_POST['ConfirmPayTOName'], 
									   'time_buy' => $defineTime,
									   'type' => $n['produto_type'], 
									   'item_id' => $n['produto_item_id'],
									   'quantidade' => $n['produto_quantidade']
									   );
										$db->insert_array('web_ats_shop_compras', $data);
									
									}else{
										$data = array(
									   'nome' => $_POST['ConfirmPayName'], 
									   'time_buy' => $defineTime,
									   'type' => $n['produto_type'], 
									   'item_id' => $n['produto_item_id'],
									   'quantidade' => $n['produto_quantidade']
									   );
										$db->insert_array('web_ats_shop_compras', $data);
										$db->ShowErro();
									}*/
									@mysql_query("update `web_ats_shop` set `quantidade_vendida`=`quantidade_vendida`+1 where `produto_id`=$n[produto_id]");
									$Suce=true;
									$MsgSuce='Compra finalizada com sucesso, para receber o item faça login no servidor.';
							}
									if($Suce){
									// Removendo `coins` da account do player
									$data = array($db->rowName('coin') => $Coins);
									$db->update_array($db->tableName(accounts), $data, "".$db->rowName('name')."=".$Account->account_logged('name')."");
									
									// Verificando se há cupom de desconto na session, caso haja, desativara o cupom
									if({Session GET cupomShop}){
										$ativado = '0';
										if($db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},ativado) == '2')
										$ativado = '2';
										if($db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},ativado) == '3')
										$ativado = '3';
										if($db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},ativado) == '3'){
											if($db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},acc_used)){
												$AccUser = $db->info_db(web_ats_shop_cupons, cupom_key, {Session GET cupomShop},acc_used);
												$AccUser = unserialize($AccUser);
												if(strtolower(gettype($AccUser)) == 'array'){
													foreach ($AccUser as $n) {
														if($n != $Account->account_logged('name')){
															$AccUser[] = $Account->account_logged('name');	
														}
													}
												}else{ $AccUser[] = $Account->account_logged('name'); }
											}else{ $AccUser[] = $Account->account_logged('name'); }
											$AccUser = serialize($AccUser);
										}else{ $AccUser = $Account->account_logged('name'); }
										$data = array(
										'acc_used' =>  $AccUser,
										'time_used' => $defineTime,
										'ativado' => $ativado
										);
										$db->update_array('web_ats_shop_cupons', $data, "cupom_key='".{Session GET cupomShop}."'");
									}
									if(isset($_POST['ConfirmPayTOName']))
									$ConfirmPayTOName = $user->filter($Account->formatCharacterName($_POST['ConfirmPayTOName']));
									if(isset($_POST['ConfirmPayFROMName']))
									$ConfirmPayFROMName = $user->filter($Account->formatCharacterName($_POST['ConfirmPayFROMName']));
									if(isset($ConfirmPayTOName))
									$ConfirmPayTOName = $user->filter($Account->formatCharacterName($ConfirmPayTOName));
									if({Session GET cupomShop})
									$CupomKey = {Session GET cupomShop};
									// Inserindo Histórico de compras
										$data = array(
										'produto_id' =>  $n['produto_id'],
										'produto_type' => $n['produto_type'],
										'produto_subtype' => $n['produto_subtype'],
										'produto_quantidade' => $n['produto_quantidade'],
										'item_id' => $n['produto_item_id'],
										'from_player' => $ConfirmPayFROMName,
										'to_player' => $ConfirmPayTOName,
										'valor' => $valor_calc,
										'cupom_key' => $CupomKey,
										'account_buy' => $Account->account_logged('name'),
										'player_name' => $Name,
										'status' => $OrderStatus,
										'time' => $defineTime
										);
										$db->insert_array('web_ats_shop_historico', $data);
									}
						}
					}
					if($ErrorCompra or $Suce){ ?>
								<table width="94%">
									<tr class="row-a">
									  <th><?php if($Suce){ echo 'Sucesso';}else{ echo 'Erro'; }?></th>
									</tr>
									<td><?php if($Suce){ echo $MsgSuce; }else{ echo $Error; } ?></br></td>
								</table>
								<form action="{path}shop/buy" method="POST"><p>
								<input type="hidden" name="buy" value="<?php echo (int)$n['produto_id']; ?>">
								<?php $Token->create(); ?>
								<input  name="submit" type="submit" value="Back" title="Back"/>
								</form ><?php 
							
							}
				}
			}
	}else { ?>

		<table width="94%">
			<tr class="row-a">
			  <th>Erro:</th>
			</tr>
			<td>Ocorreu um erro, volte a página anterior e selecione novamente o item desejado</td>
		</table>
		<form action="{path}shop/list" method="POST"><p>
		<?php $Token->create(); ?>
		<input  name="submit" type="submit" value="Back" title="Back"/>
		</form >
<?php }  }else{ ?>
<table width="94%">
			<tr class="row-a">
			  <th>Shop Online</th>
			</tr>
			<td>Nosso shop esta fechado no momento, provavelmente para manutenção. Aguarde e tente novamente mais tarde :)</td>
		</table>
<?php } ?>	
{if else}
<?php header("Location: ".BASE_URL."account/login"); ?>
{/if}

Here for those with programming knowledge will understand some of the logic present in all systems WebATS Manager.
 
Last edited:
Back
Top