Advertisement
Guest User

Gesior 2012 Webshop admin by Dezon

a guest
May 9th, 2014
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.20 KB | None | 0 0
  1. <?php
  2. if(!defined('INITIALIZED'))
  3.     exit;
  4.  
  5. $SQL = $GLOBALS['SQL'];
  6.    
  7. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
  8. {
  9.     //$main_content .= 'I recommend you to add items and containers by this script: <a href="http://otland.net/f479/gesior2012-items-shop-installation-administration-170654/" target="_blank">http://otland.net/f479/gesior2012-items-shop-installation-administration-170654/</a><br />';
  10.     //$main_content .= 'Script to add points etc. to shop on www is not available. I also recommend to <b>not download from forum/use old script</b> as it is bugged!';
  11.    
  12.     //validar os dados
  13.     if($action == "shop_save") {
  14.         $points             = trim($_POST['points']);
  15.         $itemid1            = trim($_POST['itemid1']);
  16.         $count1             = trim($_POST['count1']);
  17.         $itemid2            = trim($_POST['itemid2']);
  18.         $count2             = trim($_POST['count2']);
  19.         $offer_type         = trim($_POST['offer_type']);
  20.         $offer_description  = trim($_POST['offer_description']);
  21.         $offer_name         = trim($_POST['offer_name']);
  22.        
  23.         if(empty($points) && empty($itemid1) && empty($offer_name)) {
  24.             $main_content .= '<strong>Você deve preencher pelo menos os pontos, id item 1 e o nome da oferta!</strong><br /><br /><a href="?subtopic=shopadmin">Voltar</a>';
  25.         } else {
  26.             $sql_save = sprintf(
  27.                 "INSERT INTO `z_shop_offer` (points,itemid1,count1,itemid2,count2,offer_type,offer_description,offer_name)VALUES('%s','%s','%s','%s','%s','%s','%s','%s')",
  28.                 (empty($points)  ? 0 : $points),
  29.                 (empty($itemid1) ? 0 : $itemid1),
  30.                 (empty($count1)  ? 0 : $count1),
  31.                 (empty($itemid2) ? 0 : $itemid2),
  32.                 (empty($count2)  ? 0 : $count2),
  33.                 $offer_type,
  34.                 $offer_description,
  35.                 $offer_name
  36.             );
  37.             $SQL->query($sql_save);
  38.             $main_content .= '<strong>Oferta salva com sucesso!</strong><br /><br /><a href="?subtopic=shopadmin">Voltar</a>';
  39.         }
  40.        
  41.     } else {
  42.         $main_content .= <<<EOD
  43.             <style type="text/css">
  44.             h1.admshop{margin:0;padding:0;}
  45.             label.admshop{float:left;width:100px;}
  46.             div.clear{clear:both;}
  47.             p.border{border-bottom:1px solid #D4C0A1;padding:3px;}
  48.             form input, form select, form button, form reset{padding:3px;}
  49.             input.bt{padding:3px 20px;cursor:pointer;}
  50.             </style>
  51.             <h1 class="admshop"><strong>Bem vindo ao Administrador do Shop!</strong></h1>
  52.             <hr />
  53.             <form method="post" action="?subtopic=shopadmin&action=shop_save">
  54.                 <p class="border"><strong>Nome / Descrição da oferta</strong></p>
  55.                 <p><label class="admshop">Oferta: </label><input type="text" name="offer_name" size="50" maxlength="100" /></p>
  56.                 <p><label class="admshop">Descrição: </label><input type="text" name="offer_description" size="50" maxlength="1000" /></p>
  57.                 <p><label class="admshop">Qtde. pontos: </label><input type="text" name="points" size="5" maxlength="9" /></p>
  58.                 <p class="border"><strong>Tipo da oferta</strong></p>
  59.                 <p><label class="admshop">Tipo: </label><select name="offer_type"><option value="item" selected="selected">Item</option><option value="container">Container</option></select></p>
  60.                 <p class="border"><strong>Configuração do item 1</strong></p>
  61.                 <p><label class="admshop">ID Item 1: </label><input type="text" name="itemid1" size="10" /></p>
  62.                 <p><label class="admshop">Qtde. Item 1: </label><input type="text" name="count1" size="10" /></p>
  63.                 <p class="border"><strong>Configuração do item 2</strong></p>
  64.                 <p><label class="admshop">ID Item 2: </label><input type="text" name="itemid2" size="10" /></p>
  65.                 <p><label class="admshop">Qtde. Item 2: </label><input type="text" name="count2" size="10" /></p>
  66.                 <p class="border"><br /></p>
  67.                 <input type="submit" value="Salvar" class="bt" />
  68.             </form>
  69.             <div class="clear"></div>
  70. EOD;
  71. //não mude a linha linha de cima (EOD), deixe ela encostada no cantinho se não vai dar erro no PHP !!!
  72.     }//fim validação
  73.  
  74. }
  75. else
  76. {
  77.     $main_content .= 'Sorry, you have not the rights to access this page.';
  78. }
  79.  
  80. /******************************************************************
  81. * SYSTEMA DE ADMINISTRAÇÃO ONLINE DO WEBSHOP GESIOR 2012 BY DEZON *
  82. *    TODOS OS DIREITOS, POR FAVOR, NÃO REMOVER ESSES CRÉDITOS     *
  83. *       FEITO EXCLUSIVAMENTE PARA O SITE WWW.TIBIAKING.COM        *
  84. ******************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement