Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 104.95 KB | None | 0 0
  1. <script>
  2. // Set the date we're counting down to
  3. var countDownDatex = new Date("Nov 11, 2017 23:59:00").getTime();
  4.  
  5. // Update the count down every 1 second
  6. var xx = setInterval(function() {
  7.  
  8.   // Get todays date and time
  9.   var nowx = new Date().getTime();
  10.  
  11.   // Find the distance between now an the count down date
  12.   var distancex = countDownDatex - nowx;
  13.  
  14.   // Time calculations for days, hours, minutes and seconds
  15.   var daysx = Math.floor(distancex / (1000 * 60 * 60 * 24));
  16.   var hoursx = Math.floor((distancex % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  17.   var minutesx = Math.floor((distancex % (1000 * 60 * 60)) / (1000 * 60));
  18.   var secondsx = Math.floor((distancex % (1000 * 60)) / 1000);
  19.  
  20.   // Display the result in the element with id="demo"
  21.   document.getElementById("demo").innerHTML = daysx + "d " + hoursx + "h "
  22.   + minutesx + "m " + secondsx + "s";
  23.  
  24.   // If the count down is finished, write some text
  25.   if (distancex < 0) {
  26.     clearInterval(xx);
  27.     document.getElementById("demo").innerHTML = "EXPIRA EM INSTANTES";
  28.   }
  29. }, 1000);
  30. </script>
  31.  
  32. <script>
  33. // Set the date we're counting down to
  34. var countDownDatey = new Date("Nov 10, 2017 23:59:00").getTime();
  35.  
  36. // Update the count down every 1 second
  37. var xy = setInterval(function() {
  38.  
  39.   // Get todays date and time
  40.   var nowy = new Date().getTime();
  41.  
  42.   // Find the distance between now an the count down date
  43.   var distancey = countDownDatey - nowy;
  44.  
  45.   // Time calculations for days, hours, minutes and seconds
  46.   var daysy = Math.floor(distancey / (1000 * 60 * 60 * 24));
  47.   var hoursy = Math.floor((distancey % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  48.   var minutesy = Math.floor((distancey % (1000 * 60 * 60)) / (1000 * 60));
  49.   var secondsy = Math.floor((distancey % (1000 * 60)) / 1000);
  50.  
  51.   // Display the result in the element with id="demo"
  52.   document.getElementById("demo3").innerHTML = daysy + "d " + hoursy + "h "
  53.   + minutesy + "m " + secondsy + "s";
  54.  
  55.   // If the count down is finished, write some text
  56.   if (distancey < 0) {
  57.     clearInterval(xy);
  58.     document.getElementById("demo3").innerHTML = "EXPIRA EM INSTANTES";
  59.   }
  60. }, 1000);
  61. </script>
  62.  
  63. <script>
  64. // Set the date we're counting down to
  65. var countDownDate = new Date("Nov 22, 2017 23:59:00").getTime();
  66.  
  67. // Update the count down every 1 second
  68. var x = setInterval(function() {
  69.  
  70.   // Get todays date and time
  71.   var now = new Date().getTime();
  72.  
  73.   // Find the distance between now an the count down date
  74.   var distance = countDownDate - now;
  75.  
  76.   // Time calculations for days, hours, minutes and seconds
  77.   var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  78.   var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  79.   var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  80.   var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  81.  
  82.   // Display the result in the element with id="demo"
  83.   document.getElementById("demo2").innerHTML = days + "d " + hours + "h "
  84.   + minutes + "m " + seconds + "s";
  85.  
  86.   // If the count down is finished, write some text
  87.   if (distance < 0) {
  88.     clearInterval(x);
  89.     document.getElementById("demo2").innerHTML = "EXPIRA EM INSTANTES";
  90.   }
  91. }, 1000);
  92. </script>
  93.  
  94. <?PHP
  95.  
  96. //  ALTER TABLE `z_shop_history_item` CHANGE `offer_id` `offer_id` VARCHAR( 255 ) NOT NULL;
  97. // 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`;
  98.  
  99. if($config['site']['shop_system'] == 1) {
  100.   if($logged)
  101.     $user_premium_points = $account_logged->getCustomField('premium_points');
  102.   else
  103.     $user_premium_points = 'Login first';
  104.  
  105. function getItemByID($id)
  106. {
  107.   $id = (int) $id;
  108.   $SQL = $GLOBALS['SQL'];
  109.   $data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
  110.   if ($data['offer_type'] == 'pacc')
  111.   {
  112.     $offer['id'] = $data['id'];
  113.     $offer['type'] = $data['offer_type'];
  114.     $offer['days'] = $data['count1'];
  115.     $offer['points'] = $data['points'];
  116.     $offer['description'] = $data['offer_description'];
  117.     $offer['name'] = $data['offer_name'];
  118.   }
  119.   elseif ($data['offer_type'] == 'changename')
  120.   {
  121.     $offer['id'] = $data['id'];
  122.     $offer['type'] = $data['offer_type'];
  123.     $offer['points'] = $data['points'];
  124.     $offer['description'] = $data['offer_description'];
  125.     $offer['name'] = $data['offer_name'];
  126.   }
  127.   elseif ($data['offer_type'] == 'item')
  128.   {
  129.     $offer['id'] = $data['id'];
  130.     $offer['type'] = $data['offer_type'];
  131.     $offer['item_id'] = $data['itemid1'];
  132.     $offer['item_count'] = $data['count1'];
  133.     $offer['points'] = $data['points'];
  134.     $offer['description'] = $data['offer_description'];
  135.     $offer['name'] = $data['offer_name'];
  136.   }
  137.   elseif ($data['offer_type'] == 'gold')
  138.   {
  139.     $offer['id'] = $data['id'];
  140.     $offer['type'] = $data['offer_type'];
  141.     $offer['days'] = $data['count1'];
  142.     $offer['points'] = $data['points'];
  143.     $offer['description'] = $data['offer_description'];
  144.     $offer['name'] = $data['offer_name'];
  145.   }
  146.   elseif ($data['offer_type'] == 'itemvip')
  147.   {
  148.     $offer['id'] = $data['id'];
  149.     $offer['type'] = $data['offer_type'];
  150.     $offer['item_id'] = $data['itemid1'];
  151.     $offer['item_count'] = $data['count1'];
  152.     $offer['points'] = $data['points'];
  153.     $offer['description'] = $data['offer_description'];
  154.     $offer['name'] = $data['offer_name'];
  155.   }
  156.   elseif ($data['offer_type'] == 'itemvipp')
  157.   {
  158.     $offer['id'] = $data['id'];
  159.     $offer['type'] = $data['offer_type'];
  160.     $offer['item_id'] = $data['itemid1'];
  161.     $offer['item_count'] = $data['count1'];
  162.     $offer['points'] = $data['points'];
  163.     $offer['description'] = $data['offer_description'];
  164.     $offer['name'] = $data['offer_name'];
  165.   }
  166.   elseif ($data['offer_type'] == 'montarias')
  167.   {
  168.     $offer['id'] = $data['id'];
  169.     $offer['type'] = $data['offer_type'];
  170.     $offer['item_id'] = $data['itemid1'];
  171.     $offer['item_count'] = $data['count1'];
  172.     $offer['points'] = $data['points'];
  173.     $offer['description'] = $data['offer_description'];
  174.     $offer['name'] = $data['offer_name'];
  175.   }
  176.   elseif ($data['offer_type'] == 'outfits')
  177.   {
  178.     $offer['id'] = $data['id'];
  179.     $offer['type'] = $data['offer_type'];
  180.     $offer['item_id'] = $data['itemid1'];
  181.     $offer['item_count'] = $data['count1'];
  182.     $offer['points'] = $data['points'];
  183.     $offer['description'] = $data['offer_description'];
  184.     $offer['name'] = $data['offer_name'];
  185.   }
  186.     elseif ($data['offer_type'] == 'itemvippp')
  187.   {
  188.     $offer['id'] = $data['id'];
  189.     $offer['type'] = $data['offer_type'];
  190.     $offer['item_id'] = $data['itemid1'];
  191.     $offer['item_id1'] = $data['itemid2'];
  192.     $offer['item_id2'] = $data['itemid3'];
  193.     $offer['item_count'] = $data['count1'];
  194.     $offer['item_count1'] = $data['count2'];
  195.     $offer['item_count2'] = $data['count3'];
  196.     $offer['points'] = $data['points'];
  197.     $offer['realpoints'] = $data['realpoints'];
  198.     $offer['description'] = $data['offer_description'];
  199.     $offer['prazo'] = $data['prazo'];
  200.     $offer['name'] = $data['offer_name'];
  201.   }
  202.   elseif ($data['offer_type'] == 'container')
  203.   {
  204.     $offer['id'] = $data['id'];
  205.     $offer['type'] = $data['offer_type'];
  206.     $offer['container_id'] = $data['itemid2'];
  207.     $offer['container_count'] = $data['count2'];
  208.     $offer['item_id'] = $data['itemid1'];
  209.     $offer['item_count'] = $data['count1'];
  210.     $offer['points'] = $data['points'];
  211.     $offer['description'] = $data['offer_description'];
  212.     $offer['name'] = $data['offer_name'];
  213.   }
  214.   elseif ($data['offer_type'] == 'unban')
  215.   {
  216.     $offer['id'] = $data['id'];
  217.     $offer['type'] = $data['offer_type'];
  218.     $offer['points'] = $data['points'];
  219.     $offer['description'] = $data['offer_description'];
  220.     $offer['name'] = $data['offer_name'];
  221.   }
  222.   elseif ($data['offer_type'] == 'redskull')
  223.   {
  224.     $offer['id'] = $data['id'];
  225.     $offer['type'] = $data['offer_type'];
  226.     $offer['points'] = $data['points'];
  227.     $offer['description'] = $data['offer_description'];
  228.     $offer['name'] = $data['offer_name'];
  229.   }
  230.   elseif ($data['offer_type'] == 'itemlogout')
  231.   {
  232.     $offer['id'] = $data['id'];
  233.     $offer['type'] = $data['offer_type'];
  234.     $offer['points'] = $data['points'];
  235.     $offer['description'] = $data['offer_description'];
  236.     $offer['pid'] = $data['pid'];
  237.     $offer['count1'] = $data['count1'];
  238.     $offer['item_id'] = $data['itemid1'];
  239.     $offer['free_cap'] = $data['free_cap'];
  240.   }
  241.   return $offer;
  242. }
  243.  
  244.  
  245. function getOfferArray()
  246. {
  247.   $offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';');
  248.   $i_pacc = 0;
  249.   $i_changename = 0;
  250.   $i_item = 0;
  251.   $i_gold = 0;
  252.   $i_itemvip = 0;
  253.   $i_itemvipp = 0;
  254.   $i_montarias = 0;
  255.   $i_outfits = 0;
  256.   $i_itemvippp = 0;
  257.   $i_container = 0;
  258.   $i_unban = 0;
  259.   $i_redskull = 0;
  260.   $i_itemlogout = 0;
  261.   while($data = $offer_list->fetch()) {
  262.     if ($data['offer_type'] == 'pacc')
  263.     {
  264.       $offer_array['pacc'][$i_pacc]['id'] = $data['id'];
  265.       $offer_array['pacc'][$i_pacc]['days'] = $data['count1'];
  266.       $offer_array['pacc'][$i_pacc]['points'] = $data['points'];
  267.       $offer_array['pacc'][$i_pacc]['description'] = $data['offer_description'];
  268.       $offer_array['pacc'][$i_pacc]['name'] = $data['offer_name'];
  269.       $i_pacc++;
  270.     }
  271.     elseif ($data['offer_type'] == 'changename')
  272.     {
  273.       $offer_array['changename'][$i_changename]['id'] = $data['id'];
  274.       $offer_array['changename'][$i_changename]['points'] = $data['points'];
  275.       $offer_array['changename'][$i_changename]['description'] = $data['offer_description'];
  276.       $offer_array['changename'][$i_changename]['name'] = $data['offer_name'];
  277.       $i_changename++;
  278.     }
  279.     elseif ($data['offer_type'] == 'item')
  280.     {
  281.       $offer_array['item'][$i_item]['id'] = $data['id'];
  282.       $offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
  283.       $offer_array['item'][$i_item]['item_count'] = $data['count1'];
  284.       $offer_array['item'][$i_item]['points'] = $data['points'];
  285.       $offer_array['item'][$i_item]['description'] = $data['offer_description'];
  286.       $offer_array['item'][$i_item]['name'] = $data['offer_name'];
  287.       $i_item++;
  288.     }
  289.     elseif ($data['offer_type'] == 'gold')
  290.     {
  291.       $offer_array['gold'][$i_gold]['id'] = $data['id'];
  292.       $offer_array['gold'][$i_gold]['days'] = $data['count1'];
  293.       $offer_array['gold'][$i_gold]['points'] = $data['points'];
  294.       $offer_array['gold'][$i_gold]['description'] = $data['offer_description'];
  295.       $offer_array['gold'][$i_gold]['name'] = $data['offer_name'];
  296.       $i_gold++;
  297.     }
  298.     elseif ($data['offer_type'] == 'itemvip')
  299.     {
  300.       $offer_array['itemvip'][$i_itemvip]['id'] = $data['id'];
  301.       $offer_array['itemvip'][$i_itemvip]['item_id'] = $data['itemid1'];
  302.       $offer_array['itemvip'][$i_itemvip]['item_count'] = $data['count1'];
  303.       $offer_array['itemvip'][$i_itemvip]['points'] = $data['points'];
  304.       $offer_array['itemvip'][$i_itemvip]['description'] = $data['offer_description'];
  305.       $offer_array['itemvip'][$i_itemvip]['name'] = $data['offer_name'];
  306.       $i_itemvip++;
  307.     }
  308.     elseif ($data['offer_type'] == 'itemvipp')
  309.     {
  310.       $offer_array['itemvipp'][$i_itemvipp]['id'] = $data['id'];
  311.       $offer_array['itemvipp'][$i_itemvipp]['item_id'] = $data['itemid1'];
  312.       $offer_array['itemvipp'][$i_itemvipp]['item_count'] = $data['count1'];
  313.       $offer_array['itemvipp'][$i_itemvipp]['points'] = $data['points'];
  314.       $offer_array['itemvipp'][$i_itemvipp]['description'] = $data['offer_description'];
  315.       $offer_array['itemvipp'][$i_itemvipp]['name'] = $data['offer_name'];
  316.       $i_itemvipp++;
  317.     }
  318.     elseif ($data['offer_type'] == 'montarias')
  319.     {
  320.       $offer_array['montarias'][$i_montarias]['id'] = $data['id'];
  321.       $offer_array['montarias'][$i_montarias]['item_id'] = $data['itemid1'];
  322.       $offer_array['montarias'][$i_montarias]['item_count'] = $data['count1'];
  323.       $offer_array['montarias'][$i_montarias]['points'] = $data['points'];
  324.       $offer_array['montarias'][$i_montarias]['description'] = $data['offer_description'];
  325.       $offer_array['montarias'][$i_montarias]['name'] = $data['offer_name'];
  326.       $i_montarias++;
  327.     }
  328.     elseif ($data['offer_type'] == 'outfits')
  329.     {
  330.       $offer_array['outfits'][$i_outfits]['id'] = $data['id'];
  331.       $offer_array['outfits'][$i_outfits]['item_id'] = $data['itemid1'];
  332.       $offer_array['outfits'][$i_outfits]['item_count'] = $data['count1'];
  333.       $offer_array['outfits'][$i_outfits]['points'] = $data['points'];
  334.       $offer_array['outfits'][$i_outfits]['description'] = $data['offer_description'];
  335.       $offer_array['outfits'][$i_outfits]['name'] = $data['offer_name'];
  336.       $i_outfits++;
  337.     }
  338.     elseif ($data['offer_type'] == 'itemvippp')
  339.     {
  340.       $offer_array['itemvippp'][$i_itemvippp]['id'] = $data['id'];
  341.       $offer_array['itemvippp'][$i_itemvippp]['item_id'] = $data['itemid1'];
  342.       $offer_array['itemvippp'][$i_itemvippp]['item_id1'] = $data['itemid2'];
  343.       $offer_array['itemvippp'][$i_itemvippp]['item_id2'] = $data['itemid3'];
  344.       $offer_array['itemvippp'][$i_itemvippp]['item_count'] = $data['count1'];
  345.       $offer_array['itemvippp'][$i_itemvippp]['item_count1'] = $data['count2'];
  346.       $offer_array['itemvippp'][$i_itemvippp]['item_count2'] = $data['count3'];
  347.       $offer_array['itemvippp'][$i_itemvippp]['points'] = $data['points'];
  348.       $offer_array['itemvippp'][$i_itemvippp]['realpoints'] = $data['realpoints'];
  349.       $offer_array['itemvippp'][$i_itemvippp]['description'] = $data['offer_description'];
  350.       $offer_array['itemvippp'][$i_itemvippp]['name'] = $data['offer_name'];
  351.       $offer_array['itemvippp'][$i_itemvippp]['prazo'] = $data['prazo'];
  352.       $i_itemvippp++;
  353.     }
  354.     elseif ($data['offer_type'] == 'container')
  355.     {
  356.       $offer_array['container'][$i_container]['id'] = $data['id'];
  357.       $offer_array['container'][$i_container]['container_id'] = $data['itemid2'];
  358.       $offer_array['container'][$i_container]['container_count'] = $data['count2'];
  359.       $offer_array['container'][$i_container]['item_id'] = $data['itemid1'];
  360.       $offer_array['container'][$i_container]['item_count'] = $data['count1'];
  361.       $offer_array['container'][$i_container]['points'] = $data['points'];
  362.       $offer_array['container'][$i_container]['description'] = $data['offer_description'];
  363.       $offer_array['container'][$i_container]['name'] = $data['offer_name'];
  364.       $i_container++;
  365.     }
  366.     elseif ($data['offer_type'] == 'unban')
  367.     {
  368.       $offer_array['unban'][$i_unban]['id'] = $data['id'];
  369.       $offer_array['unban'][$i_unban]['points'] = $data['points'];
  370.       $offer_array['unban'][$i_unban]['description'] = $data['offer_description'];
  371.       $offer_array['unban'][$i_unban]['name'] = $data['offer_name'];
  372.       $i_unban++;
  373.     }
  374.     elseif ($data['offer_type'] == 'redskull')
  375.     {
  376.       $offer_array['redskull'][$i_redskull]['id'] = $data['id'];
  377.       $offer_array['redskull'][$i_redskull]['points'] = $data['points'];
  378.       $offer_array['redskull'][$i_redskull]['description'] = $data['offer_description'];
  379.       $offer_array['redskull'][$i_redskull]['name'] = $data['offer_name'];
  380.       $i_redskull++;
  381.     }
  382.     elseif ($data['offer_type'] == 'itemlogout')
  383.     {
  384.       $offer_array['itemlogout'][$i_itemlogout]['id'] = $data['id'];
  385.       $offer_array['itemlogout'][$i_itemlogout]['points'] = $data['points'];
  386.       $offer_array['itemlogout'][$i_itemlogout]['description'] = $data['offer_description'];
  387.       $offer_array['itemlogout'][$i_itemlogout]['name'] = $data['offer_name'];
  388.       $offer_array['itemlogout'][$i_itemlogout]['count1'] = $data['count1'];
  389.       $offer_array['itemlogout'][$i_itemlogout]['pid'] = $data['pid'];
  390.       $offer_array['itemlogout'][$i_itemlogout]['item_id'] = $data['itemid1'];
  391.       $offer_array['itemlogout'][$i_itemlogout]['free_cap'] = $data['free_cap'];
  392.       $i_itemlogout++;
  393.     }
  394.   }
  395.   return $offer_array;
  396. }
  397.  
  398.  
  399.   if($action == '') {
  400.     unset($_SESSION['viewed_confirmation_page']);
  401.  
  402.     $main_content .= '
  403.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  404.     if($logged && $user_premium_points == 1) {
  405.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  406.     }
  407.     else if($logged) {
  408.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  409.     }
  410.  
  411.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[Equipamentos]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=armas">Armas</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=diversos">Diversos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=montarias">Montarias</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=outfits">Outfits</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=ofertas">Ofertas</a><b>]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  412.  
  413.     $offer_list = getOfferArray();
  414.     if(count($offer_list['pacc']) > 0 )
  415.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  416.        
  417.         //Pacc
  418.  
  419.  
  420.         if(count($offer_list['pacc']) > 0)
  421.           foreach($offer_list['pacc'] as $pacc) {
  422.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/Premium_Scroll.gif"></td><td><br><b><center>'.$pacc['name'].'</b> (<font color="red">'.$pacc['points'].' Elemental Coins</font>)<br /></center><center>'.$pacc['description'].'</center><br></td><td align="center">';
  423.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  424.             $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="Comprar"><br><b></b></form>';
  425.           }
  426.           $main_content .= '</table>';
  427.  
  428.       //show list of gold card offers
  429.         if(count($offer_list['gold']) > 0) {
  430.         $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>Gold Card</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>';
  431.           foreach($offer_list['gold'] as $gold) {
  432.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/goldcard.gif"></td><td><b>'.$gold['name'].'</b> ('.$gold['points'].' pontos)<br />'.$gold['description'].'</td><td align="center">';
  433.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  434.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$gold['id'].'"><input type="submit" value="Comprar"><br></form>';
  435.           }
  436.           $main_content .= '</table><br />';
  437.         }
  438.               //show list of items offers
  439.       if(count($offer_list['item']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0)
  440.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Equipamentos</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  441.         if(count($offer_list['item']) > 0) {
  442.           foreach($offer_list['item'] as $item) {
  443.  
  444.           if($item['points'] == 1) {
  445.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$item['item_id'].'.png"></td><td><br><b><center>'.$item['name'].'</b> (<font color="red">'.$item['points'].' Elemental Coin</font>)<br /></center><center>'.$item['description'].'</center><br></td><td align="center">';
  446.           }
  447.           else {
  448.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$item['item_id'].'.png"></td><td><br><b><center>'.$item['name'].'</b> (<font color="red">'.$item['points'].' Elemental Coins</font>)<br /></center><center>'.$item['description'].'</center><br></td><td align="center">';
  449.           }
  450.  
  451.  
  452.  
  453.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  454.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$item['id'].'"><input type="submit" value="Comprar"><br></form>';
  455.             $main_content .= '</td></tr>';
  456.           }
  457.           $main_content .= '</table><TABLE BORDER=0><TR><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TR></TABLE>';
  458.         }
  459.       //show list of itemsvip offers
  460.  
  461.         //show list of containers offers
  462.         if(count($offer_list['container']) > 0) {
  463.           $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>&nbsp;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>';
  464.           foreach($offer_list['container'] as $container) {
  465.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' pontos)<br />'.$container['description'].'</td><td align="center">';
  466.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  467.             $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'].' pontos</b></form>';
  468.             $main_content .= '</td></tr>';
  469.           }
  470.           $main_content .= '</table><br />';
  471.         }
  472.         if(count($offer_list['itemlogout']) > 0) {
  473.           $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>&nbsp;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>';
  474.           foreach($offer_list['itemlogout'] as $itemlogout) {
  475.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' pontos)<br />'.$itemlogout['description'].'</td><td align="center">';
  476.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  477.             $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></b></form>';
  478.             $main_content .= '</td></tr>';
  479.           }
  480.           $main_content .= '</table><br />';
  481.         }
  482.      
  483.         //Remove Red Skull
  484.         if(count($offer_list['redskull']) > 0)
  485.           foreach($offer_list['redskull'] as $redskull) {
  486.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/removerred.png"></td><td><br><b><center>'.$redskull['name'].'</b> (<font color="red">'.$redskull['points'].' Elemental Coins</font>)<br /></center><center>'.$redskull['description'].'</center><br></td><td align="center">';
  487.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  488.             $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><br><input type="submit" value="Comprar"><br></form>';
  489.             $main_content .= '</td></tr>';
  490.           }
  491.         //Unban
  492.         if(count($offer_list['unban']) > 0)
  493.           foreach($offer_list['unban'] as $unban){
  494.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' pontos)<br />'.$unban['description'].'</td><td align="center">';
  495.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  496.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Comprar"><br></form>';
  497.             $main_content .= '</td></tr>';
  498.           }
  499.           $main_content .= '</table><br>';
  500.   }
  501.  
  502.  
  503.  
  504.  
  505.  
  506.   elseif($action == 'ofertas') {
  507.     unset($_SESSION['viewed_confirmation_page']);
  508.  
  509.     $main_content .= '
  510.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  511.     if($logged && $user_premium_points == 1) {
  512.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  513.     }
  514.     else if($logged) {
  515.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  516.     }
  517.  
  518.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem">Equipamentos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=armas">Armas</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=diversos">Diversos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=montarias">Montarias</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=outfits">Outfits</a><b>]</b> <b>[Ofertas]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  519.  
  520.     $offer_list = getOfferArray();
  521.     if(count($offer_list['pacc']) > 0 )
  522.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  523.        
  524.         //Pacc
  525.  
  526.  
  527.             if(count($offer_list['itemvippp']) > 0) {
  528.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Ofertas</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  529.           foreach($offer_list['itemvippp'] as $itemvippp) {
  530.  
  531.             if ($itemvippp['points'] == 1) {
  532.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvippp['name'].'.png"></td><td><br><center><b>'.$itemvippp['name'].'</b> (De <strike>'.$itemvippp['realpoints'].'</strike> por: <font color="red">'.$itemvippp['points'].' Elemental Coin</font>)<br /></center><center>'.$itemvippp['description'].'<table><tr><td></td></tr></table>'.$itemvippp['prazo'].'</center><br></td><td align="center">';
  533.             }
  534.             else {
  535.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvippp['name'].'.png"></td><td><br><center><b>'.$itemvippp['name'].'</b> (De <strike>'.$itemvippp['realpoints'].'</strike> por: <font color="red">'.$itemvippp['points'].' Elemental Coins</font>)<br /></center><center>'.$itemvippp['description'].'<table><tr><td></td></tr></table>'.$itemvippp['prazo'].'</center><br></td><td align="center">';
  536.             }
  537.  
  538.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  539.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvippp['id'].'"><input type="submit" value="Comprar"><br></form>';
  540.             $main_content .= '</td></tr>';
  541.           }
  542.           $main_content .= '</table><br />';
  543.         }
  544.   }
  545.  
  546.  
  547.  
  548.   elseif($action == 'diversos') {
  549.     unset($_SESSION['viewed_confirmation_page']);
  550.  
  551.     $main_content .= '
  552.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  553.     if($logged && $user_premium_points == 1) {
  554.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  555.     }
  556.     else if($logged) {
  557.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  558.     }
  559.  
  560.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem">Equipamentos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=armas">Armas</a><b>]</b> <b>[Diversos]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=montarias">Montarias</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=outfits">Outfits</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=ofertas">Ofertas</a><b>]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  561.  
  562.     $offer_list = getOfferArray();
  563.     if(count($offer_list['pacc']) > 0 )
  564.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  565.        
  566.         //Pacc
  567.  
  568.  
  569.         if(count($offer_list['pacc']) > 0)
  570.           foreach($offer_list['pacc'] as $pacc) {
  571.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/Premium_Scroll.gif"></td><td><br><b><center>'.$pacc['name'].'</b> (<font color="red">'.$pacc['points'].' Elemental Coins</font>)<br /></center><center>'.$pacc['description'].'</center><br></td><td align="center">';
  572.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  573.             $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="Comprar"><br><b></b></form>';
  574.           }
  575.           $main_content .= '</table>';
  576.  
  577.       //show list of gold card offers
  578.         if(count($offer_list['gold']) > 0) {
  579.         $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>Gold Card</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>';
  580.           foreach($offer_list['gold'] as $gold) {
  581.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/goldcard.gif"></td><td><b>'.$gold['name'].'</b> ('.$gold['points'].' pontos)<br />'.$gold['description'].'</td><td align="center">';
  582.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  583.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$gold['id'].'"><input type="submit" value="Comprar"><br></form>';
  584.           }
  585.           $main_content .= '</table><br />';
  586.         }
  587.               //show list of items offers
  588.  
  589.       //show list of itemsvip offers
  590.       if(count($offer_list['itemvip']) > 0) {
  591.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Diversos</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  592.           foreach($offer_list['itemvip'] as $itemvip) {
  593.  
  594.             if ($itemvip['points'] == 1) {
  595.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvip['item_id'].'.png"></td><td><br><b><center>'.$itemvip['name'].'</b> (<font color="red">'.$itemvip['points'].' Elemental Coin</font>)<br /></center><center>'.$itemvip['description'].'</center><br></td><td align="center">';
  596.             }
  597.             else {
  598.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvip['item_id'].'.png"></td><td><br><b><center>'.$itemvip['name'].'</b> (<font color="red">'.$itemvip['points'].' Elemental Coins</font>)<br /></center><center>'.$itemvip['description'].'</center><br></td><td align="center">';
  599.             }
  600.  
  601.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  602.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvip['id'].'"><input type="submit" value="Comprar"><br></form>';
  603.             $main_content .= '</td></tr>';
  604.           }
  605.           $main_content .= '</table>';
  606.         }
  607.         //show list of containers offers
  608.         if(count($offer_list['container']) > 0) {
  609.           $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>&nbsp;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>';
  610.           foreach($offer_list['container'] as $container) {
  611.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' pontos)<br />'.$container['description'].'</td><td align="center">';
  612.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  613.             $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'].' pontos</b></form>';
  614.             $main_content .= '</td></tr>';
  615.           }
  616.           $main_content .= '</table><br />';
  617.         }
  618.         if(count($offer_list['itemlogout']) > 0) {
  619.           $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>&nbsp;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>';
  620.           foreach($offer_list['itemlogout'] as $itemlogout) {
  621.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' pontos)<br />'.$itemlogout['description'].'</td><td align="center">';
  622.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  623.             $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></b></form>';
  624.             $main_content .= '</td></tr>';
  625.           }
  626.           $main_content .= '</table><br />';
  627.         }
  628.      
  629.         //Remove Red Skull
  630.         if(count($offer_list['redskull']) > 0)
  631.           foreach($offer_list['redskull'] as $redskull) {
  632.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/removerred.png"></td><td><br><b><center>'.$redskull['name'].'</b> (<font color="red">'.$redskull['points'].' Elemental Coins</font>)<br /></center><center>'.$redskull['description'].'</center><br></td><td align="center">';
  633.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  634.             $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><br><input type="submit" value="Comprar"><br></form>';
  635.             $main_content .= '</td></tr>';
  636.           }
  637.         //Unban
  638.         if(count($offer_list['unban']) > 0)
  639.           foreach($offer_list['unban'] as $unban){
  640.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' pontos)<br />'.$unban['description'].'</td><td align="center">';
  641.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  642.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Comprar"><br></form>';
  643.             $main_content .= '</td></tr>';
  644.           }
  645.           $main_content .= '</table><br>';
  646.  
  647.  
  648.  
  649. if(count($offer_list['changename']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 )
  650.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Mudar Nome</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  651.         if(count($offer_list['changename']) > 0)
  652.           foreach($offer_list['changename'] as $changename) {
  653.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/changenick.gif"></td><td><br><b><center>'.$changename['name'].'</b> (<font color="red">'.$changename['points'].' Elemental Coins</font>)<br /></center><center>'.$changename['description'].'</center><br></td><td align="center">';
  654.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  655.             $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><br><input type="submit" value="Comprar"><br></form>';
  656.             $main_content .= '</table><br />';
  657.           }
  658.           $main_content .= '</table><br>';
  659.  
  660.  
  661.  
  662.   }
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.   elseif($action == 'montarias') {
  680.     unset($_SESSION['viewed_confirmation_page']);
  681.  
  682.     $main_content .= '
  683.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  684.     if($logged && $user_premium_points == 1) {
  685.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  686.     }
  687.     else if($logged) {
  688.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  689.     }
  690.  
  691.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem">Equipamentos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=armas">Armas</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=diversos">Diversos</a><b>]</b> <b>[Montarias]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=outfits">Outfits</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=ofertas">Ofertas</a><b>]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  692.  
  693.     $offer_list = getOfferArray();
  694.     if(count($offer_list['pacc']) > 0 )
  695.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  696.        
  697.         //Pacc
  698.  
  699.  
  700.       if(count($offer_list['montarias']) > 0) {
  701.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Montarias</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  702.           foreach($offer_list['montarias'] as $montarias) {
  703.  
  704.             if ($montarias['points'] == 1) {
  705.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$montarias['name'].'.gif"></td><td><br><b><center>'.$montarias['name'].'</b> (<font color="red">'.$montarias['points'].' Elemental Coin</font>)<br /></center><center>'.$montarias['description'].'</center><br></td><td align="center">';
  706.             }
  707.             else {
  708.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$montarias['name'].'.gif"></td><td><br><b><center>'.$montarias['name'].'</b> (<font color="red">'.$montarias['points'].' Elemental Coins</font>)<br /></center><center>'.$montarias['description'].'</center><br></td><td align="center">';
  709.             }
  710.  
  711.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  712.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$montarias['id'].'"><input type="submit" value="Comprar"><br></form>';
  713.             $main_content .= '</td></tr>';
  714.           }
  715.           $main_content .= '</table><br />';
  716.         }
  717.  
  718.   }
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.   elseif($action == 'outfits') {
  729.     unset($_SESSION['viewed_confirmation_page']);
  730.  
  731.     $main_content .= '
  732.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  733.     if($logged && $user_premium_points == 1) {
  734.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  735.     }
  736.     else if($logged) {
  737.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  738.     }
  739.  
  740.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem">Equipamentos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=armas">Armas</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=diversos">Diversos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=montarias">Montarias</a><b>]</b> <b>[Outfits]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=ofertas">Ofertas</a><b>]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  741.  
  742.     $offer_list = getOfferArray();
  743.     if(count($offer_list['pacc']) > 0 )
  744.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  745.        
  746.         //Pacc
  747.  
  748.  
  749.       if(count($offer_list['outfits']) > 0) {
  750.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Outfits</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  751.           foreach($offer_list['outfits'] as $outfits) {
  752.  
  753.             if ($outfits['points'] == 1) {
  754.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$outfits['name'].'.gif"><img src="item_images/'.$outfits['name'].'.png"></td><td><br><b><center>'.$outfits['name'].'</b> (<font color="red">'.$outfits['points'].' Elemental Coin</font>)<br /></center><center>'.$outfits['description'].'</center><br></td><td align="center">';
  755.             }
  756.             else {
  757.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$outfits['name'].'.gif"><img src="item_images/'.$outfits['name'].'.png"></td><td><br><b><center>'.$outfits['name'].'</b> (<font color="red">'.$outfits['points'].' Elemental Coins</font>)<br /></center><center>'.$outfits['description'].'</center><br></td><td align="center">';
  758.             }
  759.  
  760.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  761.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$outfits['id'].'"><input type="submit" value="Comprar"><br></form>';
  762.             $main_content .= '</td></tr>';
  763.           }
  764.           $main_content .= '</table><br />';
  765.         }
  766.  
  767.   }
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.   elseif($action == 'armas') {
  778.     unset($_SESSION['viewed_confirmation_page']);
  779.  
  780.     $main_content .= '
  781.    <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><TABLE BORDER=0><TR><TR>';
  782.     if($logged && $user_premium_points == 1) {
  783.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center>';
  784.     }
  785.     else if($logged) {
  786.       $main_content .= '<center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center>';
  787.     }
  788.  
  789.     $main_content .= '<table><tr><td></td></tr></table><font size=3><center><b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem">Equipamentos</a><b>]</b> <b>[Armas]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=diversos">Diversos</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=montarias">Montarias</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=outfits">Outfits</a><b>]</b> <b>[</b><a href="http://avatarworld.org/index.php?subtopic=shopsystem&action=ofertas">Ofertas</a><b>]</b></center></font><table><TR><TR><TR><TR><TD></TD></TR></TR></TR></TR></TABLE>';
  790.  
  791.     $offer_list = getOfferArray();
  792.     if(count($offer_list['pacc']) > 0 )
  793.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Premium Account</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  794.        
  795.         //Pacc
  796.  
  797.  
  798.         if(count($offer_list['pacc']) > 0)
  799.           foreach($offer_list['pacc'] as $pacc) {
  800.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/Premium_Scroll.gif"></td><td><br><b><center>'.$pacc['name'].'</b> (<font color="red">'.$pacc['points'].' Elemental Coins</font>)<br /></center><center>'.$pacc['description'].'</center><br></td><td align="center">';
  801.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  802.             $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="Comprar"><br><b></b></form>';
  803.           }
  804.           $main_content .= '</table>';
  805.  
  806.       //show list of gold card offers
  807.         if(count($offer_list['gold']) > 0) {
  808.         $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>Gold Card</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>';
  809.           foreach($offer_list['gold'] as $gold) {
  810.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/goldcard.gif"></td><td><b>'.$gold['name'].'</b> ('.$gold['points'].' pontos)<br />'.$gold['description'].'</td><td align="center">';
  811.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  812.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$gold['id'].'"><input type="submit" value="Comprar"><br></form>';
  813.           }
  814.           $main_content .= '</table><br />';
  815.         }
  816.               //show list of items offers
  817.  
  818.       //show list of itemsvip offers
  819.       if(count($offer_list['itemvipp']) > 0) {
  820.         $main_content .= '<center><table border="1" cellpadding="3" cellspacing="1" width="746"><tr width="746" bgcolor="#505050"><td colspan="3"><font color="white" size="3"><b>&nbsp;Armas</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="100" align="center"><b>Imagem</b></td><td width="390" align="left"><b><center>Descrição do Produto</center></b></td><td width="160" align="center"><b>Comprar Produto</b></td></tr>';
  821.           foreach($offer_list['itemvipp'] as $itemvipp) {
  822.  
  823.             if ($itemvipp['points'] == 1) {
  824.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvipp['item_id'].'.png"></td><td><br><b><center>'.$itemvipp['name'].'</b> (<font color="red">'.$itemvipp['points'].' Elemental Coin</font>)<br /></center><center>'.$itemvipp['description'].'</center><br></td><td align="center">';
  825.             }
  826.             else {
  827.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvipp['item_id'].'.png"></td><td><br><b><center>'.$itemvipp['name'].'</b> (<font color="red">'.$itemvipp['points'].' Elemental Coins</font>)<br /></center><center>'.$itemvipp['description'].'</center><br></td><td align="center">';
  828.             }
  829.  
  830.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  831.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvipp['id'].'"><input type="submit" value="Comprar"><br></form>';
  832.             $main_content .= '</td></tr>';
  833.           }
  834.           $main_content .= '</table><br />';
  835.         }
  836.  
  837.  
  838.         //show list of containers offers
  839.         if(count($offer_list['container']) > 0) {
  840.           $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>&nbsp;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>';
  841.           foreach($offer_list['container'] as $container) {
  842.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' pontos)<br />'.$container['description'].'</td><td align="center">';
  843.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  844.             $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'].' pontos</b></form>';
  845.             $main_content .= '</td></tr>';
  846.           }
  847.           $main_content .= '</table><br />';
  848.         }
  849.         if(count($offer_list['itemlogout']) > 0) {
  850.           $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>&nbsp;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>';
  851.           foreach($offer_list['itemlogout'] as $itemlogout) {
  852.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' pontos)<br />'.$itemlogout['description'].'</td><td align="center">';
  853.             if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  854.             $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></b></form>';
  855.             $main_content .= '</td></tr>';
  856.           }
  857.           $main_content .= '</table><br />';
  858.         }
  859.      
  860.         //Remove Red Skull
  861.         if(count($offer_list['redskull']) > 0)
  862.           foreach($offer_list['redskull'] as $redskull) {
  863.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/removerred.png"></td><td><br><b><center>'.$redskull['name'].'</b> (<font color="red">'.$redskull['points'].' Elemental Coins</font>)<br /></center><center>'.$redskull['description'].'</center><br></td><td align="center">';
  864.             if(!$logged) $main_content .= '</br><form action="index.php?subtopic=accountmanagement" method=POST><input type="submit" value="Login"><br></form>'; else
  865.             $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><br><input type="submit" value="Comprar"><br></form>';
  866.             $main_content .= '</td></tr>';
  867.           }
  868.         //Unban
  869.         if(count($offer_list['unban']) > 0)
  870.           foreach($offer_list['unban'] as $unban){
  871.             $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' pontos)<br />'.$unban['description'].'</td><td align="center">';
  872.             if(!$logged) $main_content .= '<b>Logue para comprar</b>'; else
  873.             $main_content .= '</br><form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Comprar"><br></form>';
  874.             $main_content .= '</td></tr>';
  875.           }
  876.           $main_content .= '</table><br>';
  877.   }
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.   elseif($action == 'select_player') {
  885.     unset($_SESSION['viewed_confirmation_page']);
  886.     if(!$logged) {
  887.       $main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate.';
  888.     } else {
  889.       $buy_id = (int) $_REQUEST['buy_id'];
  890.       if(empty($buy_id)) {
  891.         $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
  892.       } else {
  893.         $buy_offer = getItemByID($buy_id);
  894.         if(isset($buy_offer['id'])) {  //item exist in database
  895.           if($buy_offer['type'] != 'changename') {
  896.             if($user_premium_points >= $buy_offer['points']) {
  897.  
  898.               if($user_premium_points == 1) {
  899.               $main_content .= '
  900.              <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center></TABLE>';
  901.               }
  902.               else {
  903.               $main_content .= '
  904.              <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center></TABLE>';
  905.               }
  906.  
  907.               $main_content .= '
  908.              <table border="1" cellpadding="3" cellspacing="1" width="746">
  909.                <tr bgcolor="#505050"><td colspan="2"><font color="white" size="3"><b>&nbsp;Selecione seu Character</b></font></td></tr>
  910.                <tr bgcolor="#D4C0A1"><td width="160"><b><center>Produto Escolhido:</center></b></td><td width="490">&nbsp;<font color="red">'.$buy_offer['name'].'</font></td></tr>
  911.                <br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
  912.                <tr bgcolor="#F1E0C6"><td width="160"><b><center>Character Escolhido:</center></b></td><td width="490">&nbsp;<select name="buy_name">';
  913.                 $players_from_logged_acc = $account_logged->getPlayersList();
  914.               if(count($players_from_logged_acc) > 0) {
  915.                 $players_from_logged_acc->orderBy('name');
  916.                 foreach($players_from_logged_acc as $player)
  917.                   $main_content .= '<option>'.$player->getName().'</option><br />';
  918.               } else {
  919.                 $main_content .= 'You don\'t have any character on your account.';
  920.               }
  921.               $main_content .= '</select></table>
  922.      <TABLE BORDER=0 WIDTH=100%>
  923.        <TR><br>
  924.          <TD ALIGN=center VALIGN=top>
  925.              <INPUT TYPE="submit" value="Continuar Comprando" BORDER=0 WIDTH=120 HEIGHT=18>
  926.          </TD></form>
  927.          <TD ALIGN=center>
  928.            <FORM  ACTION="index.php?subtopic=shopsystem" METHOD=post>
  929.              <INPUT TYPE="submit" value="Cancelar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  930.              </FORM>
  931.          </TD>
  932.        </TR>
  933.      </TABLE>
  934.              ';
  935.             } else {
  936.               $main_content .= 'You dont have enough <B>Elemental Coins</B> to buy this item. Please <a href="index.php?subtopic=shopsystem">select other item</a> or <a href="index.php?subtopic=donate">buy elemental coins</a>.';
  937.             }
  938.           } elseif($user_premium_points >= $buy_offer['points']) {
  939.               if($user_premium_points == 1) {
  940.               $main_content .= '
  941.              <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center></TABLE>';
  942.               }
  943.               else {
  944.               $main_content .= '
  945.              <div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div><center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center></TABLE>';
  946.               }
  947. $main_content .= '<br> ';
  948.           $main_content .= '
  949.          <form id="change" name="change" action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST onsubmit="return validaCampo(); return false;">
  950.          <input type="hidden" name="buy_id" value="'.$buy_id.'">
  951.            <table border="1" cellpadding="3" cellspacing="1" width="746">
  952.            <tr bgcolor="#505050"><td colspan="2"><font color="white" size="3"><b>&nbsp;Mudar Nome</b></font></td></tr>
  953.            <tr bgcolor="#D4C0A1"><td width="160"><b><center>Character Escolhido:</center></b></td><td width="490">&nbsp;<select name="buy_name">';
  954.             $players_from_logged_acc = $account_logged->getPlayersList();
  955.             $players_from_logged_acc->orderBy('name');
  956.               foreach($players_from_logged_acc as $player) {
  957.                 $main_content .= '<option>'.$player->getName().'</option>';
  958.               }
  959.             $main_content .= '</select></td></tr>
  960.            <tr bgcolor="#F1E0C6"><td width="160"><b><center>Novo Nome:</center></b></td><td width="490">&nbsp;<input id="buy_from" name="buy_from" onkeyup="checkbuy_from();" value="'.$buy_from.'" size="25" maxlength="16" type="text" name="buy_from"></td></tr></table>
  961. ';
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976. function allLetter($inputtxt)
  977. {
  978.   $name = (string) $inputtxt;
  979.   $name_to_check = strtolower($name);
  980.   //first word can't be:
  981.   $first_words_blocked = array('gm ','cm ', 'god ','tutor ', "'", '-');
  982.   //names blocked:
  983.   $names_blocked = array('gm','cm', 'god', 'tutor');
  984.   //name can't contain:
  985.   $words_blocked = array('gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
  986.   foreach($first_words_blocked as $word)
  987.     if($word == substr($name_to_check, 0, strlen($word)))
  988.       return false;
  989.   if(substr($name_to_check, -1) == "'" || substr($name_to_check, -1) == "-")
  990.     return false;
  991.   if(substr($name_to_check, 1, 1) == ' ')
  992.     return false;
  993.   if(substr($name_to_check, -2, 1) == " ")
  994.     return false;
  995.   foreach($names_blocked as $word)
  996.     if($word == $name_to_check)
  997.       return false;
  998.   for($i = 0; $i < strlen($name_to_check); $i++)
  999.     if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
  1000.       return false;
  1001.   foreach($words_blocked as $word)
  1002.     if (!(strpos($name_to_check, $word) === false))
  1003.       return false;
  1004.   for($i = 0; $i < strlen($name_to_check); $i++)
  1005.     if($name_to_check[$i] == $name_to_check[($i+1)] && $name_to_check[$i] == $name_to_check[($i+2)])
  1006.       return false;
  1007.   for($i = 0; $i < strlen($name_to_check); $i++)
  1008.     if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
  1009.       return false;
  1010.   $temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '");
  1011.   if ($temp != strlen($name))
  1012.     return false;
  1013.   if(strlen($name) < 1)
  1014.     return false;
  1015.   if(strlen($name) > 25)
  1016.     return false;
  1017.   return true;
  1018. }
  1019.  
  1020. function listaPlayers()
  1021.     {
  1022.         $_players = $GLOBALS['_players'];
  1023.         $o = '<select name="buy_from" id="buy_from"><option value=""></option>';
  1024.         foreach($_players as $_player)
  1025.         {
  1026.             $o .= '<option value="'.$_player->getName().'">'.$_player->getName().'</option>';
  1027.         }
  1028.         $o .= '</select></td></tr>';
  1029.  
  1030.         return $o;
  1031.     }
  1032.  
  1033. $main_content .= '
  1034.  
  1035. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  1036. <html xmlns="http://www.w3.org/1999/xhtml">
  1037. <head>
  1038. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  1039. <title>CADASTRO DE CLIENTES COM BANCO DE DADOS E PHP</title>
  1040. <style type="text/css">
  1041. <!--
  1042. .style1 {
  1043.  color: #FF0000;
  1044.  font-size: x-small;
  1045. }
  1046. .style3 {color: #0000FF; font-size: x-small; }
  1047. -->
  1048. </style>
  1049.  
  1050. <script type="text/javascript">
  1051.  
  1052.  
  1053. function isUpperCase(char) {
  1054.    return char !== char.toLowerCase();
  1055. }
  1056.  
  1057. function hasUpperCaseChars(str) {
  1058.  var len=str.length;
  1059.  for(var i=1;i<len;i++) {
  1060.    if(/[A-Z]/.test(str.charAt(i))) return true;
  1061.  }
  1062.  return false;
  1063. }
  1064.  
  1065. function validaCampo()
  1066. {
  1067. if(document.change.buy_from.value=="")
  1068.  {
  1069.  alert("Digite o novo nome escolhido.");
  1070.  document.change.buy_from.focus();
  1071.  return false;
  1072.  }
  1073. else
  1074.  if(document.change.buy_from.value.length>14 || document.change.buy_from.value.length<4)
  1075.  {
  1076.  alert("Digite o novo nome contendo entre 4 a 14 letras.");
  1077.  document.change.buy_from.focus();
  1078.  return false;
  1079.  }
  1080. else
  1081.  if(!isUpperCase(document.change.buy_from.value.charAt(0)) || hasUpperCaseChars(document.change.buy_from.value))
  1082.  {
  1083.  alert("Digite o novo nome com a primeira letra maiúscula e o restante letras minúsculas.");
  1084.  document.change.buy_from.focus();
  1085.  return false;
  1086.  }
  1087. else
  1088.  if(!document.change.buy_from.value.match(/^[a-zA-Z_]+$/))
  1089. {
  1090.  alert("Digite o novo nome sem símbolos (sem espaço, hífen, apóstrofo, entre outros).");
  1091.  document.change.buy_from.focus();
  1092.  return false;
  1093.  }
  1094. else
  1095. return true;
  1096. }
  1097.  
  1098. <!-- Fim do JavaScript que validará os campos obrigatórios! -->
  1099. </script>
  1100. </head>
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.          <TABLE BORDER=0 WIDTH=100%>
  1115.        <TR><br>
  1116.          <TD ALIGN=center VALIGN=top>
  1117.              <INPUT TYPE="submit" value="Continuar Comprando" BORDER=0 WIDTH=120 HEIGHT=18>
  1118.          </TD></form>
  1119.          <TD ALIGN=center>
  1120.            <FORM  ACTION="index.php?subtopic=shopsystem" METHOD=post>
  1121.              <INPUT TYPE="submit" value="Cancelar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  1122.              </FORM>
  1123.          </TD>
  1124.        </TR>
  1125.      </TABLE>
  1126.  
  1127.            ';
  1128.           }
  1129.           else {
  1130.               $main_content .= 'You dont have enough <B>Elemental Coins</B> to buy this item or dont have any <b>character</b> on your account. Please <a href="index.php?subtopic=shopsystem">select other item</a> or <a href="index.php?subtopic=donate">buy elemental coins</a> or <a href="index.php?subtopic=accountmanagement&action=createcharacter">create a new character</a>.';
  1131.             }
  1132.         } else {
  1133.                   $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
  1134.         }
  1135.       }
  1136.     }
  1137.   }
  1138.   elseif($action == 'confirm_transaction') {
  1139.     if(!$logged) {
  1140.       $main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate.';
  1141.     } else {
  1142.       $buy_id = (int) $_POST['buy_id'];
  1143.       $buy_name = stripslashes(urldecode($_POST['buy_name']));
  1144.       $buy_from = stripslashes(urldecode($_POST['buy_from']));
  1145.       if(empty($buy_id)) {
  1146.         $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
  1147.       } else {
  1148.         if($buy_offer['type'] == 'changename'){
  1149.           if(!check_name_new_char($buy_from)) {
  1150.             $main_content .= 'Invalid name format of new name.';
  1151.           }
  1152.         } else {
  1153.           $buy_offer = getItemByID($buy_id);
  1154.           $check_name_in_database = $ots->createObject('Player');
  1155.           $check_name_in_database->find($buy_from);
  1156.           if($buy_offer['type'] == 'changename'){
  1157.             if(!$check_name_in_database->isLoaded()) {
  1158.             }
  1159.           }
  1160.           if(isset($buy_offer['id'])) {  //item exist in database
  1161.             if($user_premium_points >= $buy_offer['points']) {
  1162.               if(check_name($buy_name)) {
  1163.                 $buy_player = new OTS_Player();
  1164.                 $buy_player->find($buy_name);
  1165.                 if($buy_player->isLoaded()) {
  1166.                   $buy_player_account = $buy_player->getAccount();
  1167.                     if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
  1168.                      if($buy_offer['type'] == 'pacc') {
  1169.                                             $player_viptime = $buy_player_account->getCustomField('viptime');
  1170.                                             $player_lastlogin = $buy_player_account->getCustomField('lastday');
  1171.                                             $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()).');';
  1172.                                             $SQL->query($save_transaction);
  1173.                                             if($player_viptime > 0)
  1174.                                                 $buy_player_account->setCustomField('viptime', $player_viptime + $buy_offer['days'] * 86400);
  1175.                                             else
  1176.                                                 $buy_player_account->setCustomField('viptime', time() + $buy_offer['days'] * 86400);
  1177.                                             $buy_player_account->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1178.                                             $user_premium_points = $user_premium_points - $buy_offer['points'];
  1179.                                             if ($player_vip_days >= 1) {
  1180.                                             }
  1181.                                             $main_content .= '<center><h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of VIP days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br />Now you have <b>'.$user_premium_points.' elemental coins</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  1182.                                             }
  1183.  
  1184.                     elseif($buy_offer['type'] == 'unban') {
  1185.                       $my_acc_id = $account_logged->getCustomField('id');
  1186.                       $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE value = '.$my_acc_id.';')->fetch();
  1187.                         if($datadata['value'] == $my_acc_id) {
  1188.                           if($SQL->query('DELETE FROM bans WHERE value= '.$my_acc_id.' LIMIT 1;')) {
  1189.                           } else {
  1190.                             $SQL->query('DELETE FROM bans WHERE account= '.$my_acc_id.' LIMIT 1;');
  1191.                           }
  1192.                           $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1193.                           $user_premium_points = $user_premium_points - $buy_offer['points'];
  1194.                           $main_content .= '<center><h2>Ban Deleted!</h2><b>Your account has been unbanned for '.$buy_offer['points'].' elemental coins</b> from your account.
  1195.                            <br>Now you have <b>'.$user_premium_points.' elemental coins</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  1196.                         } else {
  1197.                           $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>';
  1198.                         }
  1199.                       }
  1200.                     ////////////////////////////////
  1201.                     elseif($buy_offer['type'] == 'itemlogout') {
  1202.                       $my_acc_id = $buy_player->getCustomField('id');
  1203.                       $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE id = '.$my_acc_id.';')->fetch();
  1204.                       $playerslot = $SQL->query('SELECT * FROM '.$SQL->tableName('player_items').' WHERE player_id = '.$my_acc_id.';')->fetch();
  1205.                       if($playerinfo['online'] == '0') {
  1206.                         if ($playerslot['pid'] != '10') {
  1207.                           if ($datadata['cap'] >= $SQL->quote($buy_offer['free_cap'])) {
  1208.                             $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']).');');
  1209.                             $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1210.                             $user_premium_points = $user_premium_points - $buy_offer['points'];
  1211.                             $main_content .= '<h2>Item received to player: '.$buy_player->getName().'!</h2><br>Now you have <b>'.$user_premium_points.' elemental coins</b>.
  1212.                              <br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a>';
  1213.                           } else {
  1214.                             $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>';
  1215.                           }
  1216.                         } else {
  1217.                           $main_content .= '<b>Please leave the arrow slot in blank to receive item!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
  1218.                         }
  1219.                       } else {
  1220.                         $main_content .= '<b>You need to be offline!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
  1221.                       }
  1222.                     }
  1223.                     ////////////////////////////////
  1224.                     elseif($buy_offer['type'] == 'changename') {
  1225.                       $my_acc_id = $buy_player->getCustomField('id');
  1226.                       $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
  1227.                       $checkname = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('name').' = '. $SQL->quote($buy_from) .';')->fetch();
  1228.                       if($playerinfo['online'] == '0') {
  1229.                         if($checkname == false) {
  1230.                           $SQL->query('UPDATE `players` SET `name` = '. $SQL->quote($buy_from) .' WHERE `id` = '. $my_acc_id.' ;');
  1231.                           $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1232.                           $user_premium_points = $user_premium_points - $buy_offer['points'];
  1233.                           $main_content .= '<center><h2>Name changed!</h2>
  1234.                          <b>Your name</b> has been changed to <b>'.$buy_from.'</b> for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>
  1235.  
  1236.                            <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1237.                         } else {
  1238.                           $main_content .= 'Sorry, the name "<b>'.$buy_from.'</b>" does already exist. Go back to <a href="index.php?subtopic=shopsystem">shop site</a>.';
  1239.                         }
  1240.                       } else {
  1241.                         $main_content .= 'Sorry, "<b>'.$buy_name.'</b>" has to be offline to complete transaction. Go back to <a href="index.php?subtopic=shopsystem">shop site</a>.';
  1242.                       }
  1243.                     }
  1244.                     ////////////////////////////////
  1245.                     elseif($buy_offer['type'] == 'redskull') {
  1246.                       $my_acc_id = $buy_player->getCustomField('id');
  1247.                       $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
  1248.                       if($playerinfo['skull'] == '4' AND $playerinfo['online'] >= '0' AND $playerinfo['skulltime'] > '0') {
  1249.                         $SQL->query('UPDATE killers SET unjustified=0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id='. $my_acc_id .');');
  1250.                         $SQL->query('UPDATE players SET skulltime=0, skull=0 WHERE id='. $my_acc_id .';');
  1251.                         $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1252.                         $user_premium_points = $user_premium_points - $buy_offer['points'];
  1253.                         $main_content .= '<center><h2>RedSkull Removed!</h2><br><b>Your redskull has been removed from the player '.$buy_player->getName().'.</b>
  1254.                          <br>Now you have<b> '.$user_premium_points.' elemental coins</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1255.                       } else {
  1256.                         $main_content .= '
  1257.                        <center><h2>Not completed!</h2>The player <b>'.$buy_player->getName().'</b> has to be <b>offline</b> or <b>have redskull</b> to complete transaction!<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>
  1258.                        ';
  1259.                       }
  1260.                     }
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.                     //////////////////////////
  1267.                     elseif($buy_offer['type'] == 'item') {
  1268.                       $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\');';
  1269.                       $SQL->query($sql);
  1270.                       $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\');';
  1271.                       $SQL->query($save_transaction);
  1272.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1273.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1274.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1275.  
  1276.                       if ($buy_offer['points'] == 1) {
  1277.                       $main_content .= '
  1278.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1279.                       }
  1280.  
  1281.                       else {
  1282.                       $main_content .= '
  1283.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1284.                       }
  1285.  
  1286.                       $main_content .= '
  1287.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1288.                     }
  1289.  
  1290.  
  1291.                                                                                 if($buy_offer['type'] == 'gold') {
  1292.                                                                              $player_card_time = $buy_player_account->getCustomField('card_time');
  1293.                       $player_lastlogin = $buy_player_account->getCustomField('lastday');
  1294.                       $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()).');';
  1295.                       $SQL->query($save_transaction);
  1296.                       if($player_card_time > 0)
  1297.                         $buy_player_account->setCustomField('card_time', $player_card_time + $buy_offer['days'] * 86400);
  1298.                       else
  1299.                         $buy_player_account->setCustomField('card_time', time() + $buy_offer['days'] * 86400);
  1300.                       $buy_player_account->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1301.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1302.                       if ($player_card_time >= 1) {
  1303.                       }
  1304.                       $main_content .= '<center><h2>Gold Card added!</h2><b>'.$buy_offer['days'].' days</b> of Gold Card days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br />Now you have <b>'.$user_premium_points.' elemental coins</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  1305.                       }
  1306.  
  1307.  
  1308.  
  1309.                     //////////////////////////
  1310.                     elseif($buy_offer['type'] == 'itemvip') {
  1311.                       $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']).', \'\', \'\', \'itemvip\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  1312.                       $SQL->query($sql);
  1313.                       $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\');';
  1314.                       $SQL->query($save_transaction);
  1315.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1316.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1317.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1318.  
  1319.                       if ($buy_offer['points'] == 1) {
  1320.                       $main_content .= '
  1321.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1322.                       }
  1323.  
  1324.                       else {
  1325.                       $main_content .= '
  1326.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1327.                       }
  1328.  
  1329.                       $main_content .= '
  1330.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1331.                     }
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.                     elseif($buy_offer['type'] == 'itemvipp') {
  1342.                       $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']).', \'\', \'\', \'itemvipp\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  1343.                       $SQL->query($sql);
  1344.                       $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\');';
  1345.                       $SQL->query($save_transaction);
  1346.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1347.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1348.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1349.  
  1350.                       if ($buy_offer['points'] == 1) {
  1351.                       $main_content .= '
  1352.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1353.                       }
  1354.  
  1355.                       else {
  1356.                       $main_content .= '
  1357.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1358.                       }
  1359.  
  1360.                       $main_content .= '
  1361.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1362.                     }
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.                     elseif($buy_offer['type'] == 'montarias') {
  1374.                       $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']).', \'\', \'\', \'montarias\', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['points']).', \'1\');';
  1375.                       $SQL->query($sql);
  1376.                       $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\');';
  1377.                       $SQL->query($save_transaction);
  1378.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1379.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1380.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1381.  
  1382.                       if ($buy_offer['points'] == 1) {
  1383.                       $main_content .= '
  1384.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1385.                       }
  1386.  
  1387.                       else {
  1388.                       $main_content .= '
  1389.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1390.                       }
  1391.  
  1392.                       $main_content .= '
  1393.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1394.                     }
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.                     elseif($buy_offer['type'] == 'outfits') {
  1402.                       $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']).', \'\', \'\', \'outfits\', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['points']).', \'1\');';
  1403.                       $SQL->query($sql);
  1404.                       $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\');';
  1405.                       $SQL->query($save_transaction);
  1406.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1407.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1408.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1409.  
  1410.                       if ($buy_offer['points'] == 1) {
  1411.                       $main_content .= '
  1412.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1413.                       }
  1414.  
  1415.                       else {
  1416.                       $main_content .= '
  1417.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1418.                       }
  1419.  
  1420.                       $main_content .= '
  1421.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1422.                     }
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.                       elseif($buy_offer['type'] == 'itemvippp') {
  1434.                       $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', \'\', \'\', \'itemvippp\', '.$SQL->quote($buy_offer['name']).', \'\', '.$SQL->quote($buy_offer['item_id1']).', '.$SQL->quote($buy_offer['item_count1']).', '.$SQL->quote($buy_offer['item_id2']).', '.$SQL->quote($buy_offer['item_count2']).', \'1\');';
  1435.                       $SQL->query($sql);
  1436.                       $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\');';
  1437.                       $SQL->query($save_transaction);
  1438.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1439.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1440.                       $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b>';
  1441.  
  1442.                       if ($buy_offer['points'] == 1) {
  1443.                       $main_content .= '
  1444.                      for <b>'.$buy_offer['points'].' elemental coin</b> from your account.<br>';
  1445.                       }
  1446.  
  1447.                       else {
  1448.                       $main_content .= '
  1449.                      for <b>'.$buy_offer['points'].' elemental coins</b> from your account.<br>';
  1450.                       }
  1451.  
  1452.                       $main_content .= '
  1453.                        <br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1454.                     }
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.                     elseif($buy_offer['type'] == 'container') {
  1467.                       $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\');';
  1468.                       $SQL->query($sql);
  1469.                       $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\');';
  1470.                       $SQL->query($save_transaction);
  1471.                       $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  1472.                       $user_premium_points = $user_premium_points - $buy_offer['points'];
  1473.                       $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'].' elemental coins</b> from your account.<br />Now you have <b>'.$user_premium_points.' elemental coins</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  1474.                     }
  1475.                   } else {
  1476.                     if($buy_offer['type'] != 'changename') {
  1477.                       $set_session = TRUE;
  1478.                       $_SESSION['viewed_confirmation_page'] = 'yes';
  1479.                       $main_content .= '<div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div>';
  1480.  
  1481.                       if($user_premium_points == 1){
  1482.                       $main_content .= '
  1483.                      <center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center></TABLE>';
  1484.                       }
  1485.                       else {
  1486.                         $main_content .= '
  1487.                      <center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center></TABLE>';
  1488.                       }
  1489.  
  1490.  
  1491.                       $main_content .= '
  1492.                      <br>
  1493.                        <table border="1" cellpadding="3" cellspacing="1" width="746">
  1494.                <tr bgcolor="#505050"><td colspan="2"><font color="white" size="3"><b>&nbsp;Confirmar Compra</b></font></td></tr>
  1495.                        <tr bgcolor="#D4C0A1"><td width="178"><b><center>Produto Escolhido:</center></b></td><td width="472" colspan="2"><font color="red">&nbsp;'.$buy_offer['name'].'</font></td></tr>';
  1496.  
  1497.                     if($buy_offer['points'] == 1){
  1498.                       $main_content .= '
  1499.                        <tr bgcolor="#F1E0C6"><td width="178"><b><center>Valor do Produto:</center></b></td><td width="472" colspan="2"><b>&nbsp;'.$buy_offer['points'].'</b> Elemental Coin</td></tr>';
  1500.                     }
  1501.                     else {
  1502.                       $main_content .= '
  1503.                        <tr bgcolor="#F1E0C6"><td width="178"><b><center>Valor do Produto:</center></b></td><td width="472" colspan="2"><b>&nbsp;'.$buy_offer['points'].'</b> Elemental Coins</td></tr>';
  1504.                     }
  1505.  
  1506.  
  1507.                       $main_content .= '
  1508.                        <tr bgcolor="#D4C0A1"><td width="178"><b><center>Character Escolhido:</center></b></td><td width="485" colspan="2"><font color="red">&nbsp;'.$buy_player->getName().'</font></td></tr>
  1509.                        <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).'">
  1510.                        </table>
  1511.      <TABLE BORDER=0 WIDTH=100%>
  1512.        <TR><br>
  1513.          <TD ALIGN=center VALIGN=top>
  1514.              <INPUT TYPE="submit" value="Confirmar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  1515.          </TD></form>
  1516.          <TD ALIGN=center>
  1517.            <FORM  ACTION="index.php?subtopic=shopsystem" METHOD=post>
  1518.              <INPUT TYPE="submit" value="Cancelar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  1519.              </FORM>
  1520.          </TD>
  1521.        </TR>
  1522.      </TABLE>
  1523.                        ';
  1524.                     } else {
  1525.                       $set_session = TRUE;
  1526.                       $_SESSION['viewed_confirmation_page'] = 'yes';
  1527.                       $main_content .= '<div id="ProgressBar">  <div id="Headline"><big><big><big><big>Shopping Online</big></big></big></div></div>';
  1528.  
  1529.                       if($user_premium_points == 1){
  1530.                       $main_content .= '
  1531.                      <center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coin)</center></TABLE>';
  1532.                       }
  1533.                       else {
  1534.                         $main_content .= '
  1535.                      <center>(Seu saldo: <b><font color="green">'.$user_premium_points.'</font></b> Elemental Coins)</center></TABLE>';
  1536.                       }
  1537.  
  1538.  
  1539.                       $main_content .= '
  1540.                      <br>
  1541.                        <table border="1" cellpadding="3" cellspacing="1" width="746">
  1542.                        <tr bgcolor="#505050"><td colspan="2"><font color="white" size="3"><b>&nbsp;Confirmar Compra</b></font></td></tr>
  1543.                        <tr bgcolor="#D4C0A1"><td width="178"><b><center>Produto Escolhido:</center></b></td><td width="472" colspan="2"><font color="red">&nbsp;'.$buy_offer['name'].'</font></td></tr>
  1544.                        <tr bgcolor="#F1E0C6"><td width="178"><b><center>Valor do Produto:</center></b></td><td width="472" colspan="2"><b>&nbsp;'.$buy_offer['points'].'</b> Elemental Coins</td></tr>
  1545.                        <tr bgcolor="#D4C0A1"><td width="178"><b><center>Character Escolhido:</center></b></td><td width="485" colspan="2"><font color="red">&nbsp;'.$buy_player->getName().'</font></td></tr>
  1546.                        <tr bgcolor="#F1E0C6"><td width="178"><b><center>Novo Nome:</center></b></td><td width="485" colspan="2"><font color="red">&nbsp;'.$buy_from.'</font></td></tr>
  1547.                        
  1548.                        <form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST">
  1549.                        <input type="hidden" name="buy_confirmed" value="yes">
  1550.            <input type="hidden" name="buy_id" value="'.$buy_id.'">
  1551.            <input type="hidden" name="buy_from" value="'.urlencode($buy_from).'">
  1552.            <input type="hidden" name="buy_name" value="'.urlencode($buy_name).'">
  1553.                        </table>
  1554.      <TABLE BORDER=0 WIDTH=100%>
  1555.        <TR><br>
  1556.          <TD ALIGN=center VALIGN=top>
  1557.              <INPUT TYPE="submit" value="Confirmar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  1558.          </TD></form>
  1559.          <TD ALIGN=center>
  1560.            <FORM  ACTION="index.php?subtopic=shopsystem" METHOD=post>
  1561.              <INPUT TYPE="submit" value="Cancelar Compra" BORDER=0 WIDTH=120 HEIGHT=18>
  1562.              </FORM>
  1563.          </TD>
  1564.        </TR>
  1565.      </TABLE>';
  1566.                     }
  1567.                   }
  1568.                 } else {
  1569.                   $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>.';
  1570.                 }
  1571.               } else {
  1572.                 $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.';
  1573.               }
  1574.             } else {
  1575.               $main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> elemental coins. Please <a href="index.php?subtopic=shopsystem">select other item</a> or <a href="index.php?subtopic=donate">buy elemental coins</a>.';
  1576.             }
  1577.                   } else {
  1578.             $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
  1579.           }
  1580.         }
  1581.       }
  1582.     }
  1583.     if(!$set_session) {
  1584.       unset($_SESSION['viewed_confirmation_page']);
  1585.     }
  1586.   }
  1587.  
  1588.   elseif($action == 'showerwerre2390ww_histo32wrrerwerwry') {
  1589.     if(!$logged) {
  1590.       $main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> first to make a donate.';
  1591.     } else{
  1592.       $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()).';');
  1593.       if(is_object($items_history_received)) {
  1594.         foreach($items_history_received as $item_received) {
  1595.           if($account_logged->getId() == $item_received['to_account'])
  1596.             $char_color = 'green';
  1597.           else
  1598.             $char_color = 'red';
  1599.             $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
  1600.           if($account_logged->getId() == $item_received['from_account'])
  1601.             $items_received_text .= '<i>Your account</i>';
  1602.           else
  1603.             $items_received_text .= $item_received['from_nick'];
  1604.             $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
  1605.           if($item_received['trans_real'] > 0)
  1606.             $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
  1607.           else
  1608.             $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
  1609.             $items_received_text .= '</tr>';
  1610.         }
  1611.       }
  1612.       $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()).';');
  1613.       if(is_object($paccs_history_received)) {
  1614.         foreach($paccs_history_received as $pacc_received) {
  1615.           if($account_logged->getId() == $pacc_received['to_account'])
  1616.             $char_color = 'green';
  1617.           else
  1618.             $char_color = 'red';
  1619.             $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
  1620.           if($account_logged->getId() == $pacc_received['from_account'])
  1621.             $paccs_received_text .= '<i>Your account</i>';
  1622.           else
  1623.             $paccs_received_text .= $pacc_received['from_nick'];
  1624.             $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>';
  1625.         }
  1626.       }
  1627.       $main_content .= '<center><h1>Transactions History</h1></center>';
  1628.       if(!empty($items_received_text))
  1629.         $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>&nbsp;Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
  1630.       if(!empty($paccs_received_text))
  1631.         $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>&nbsp;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 />';
  1632.       if(empty($paccs_received_text) && empty($items_received_text))
  1633.         $main_content .= 'You did not buy/receive any items or PACC.';
  1634.     }
  1635.   }
  1636.   }
  1637. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement