Example #1
0
$db->Query("\n\t\t\tDECLARE @memb___id varchar(10)\n\t\t\tDECLARE @idx bigint\n\t\t\tDECLARE CursorChar CURSOR FOR\n\t\t\t\tSELECT memb___id,idx\n\t\t\t\tFROM Z_BlockedUsers\n\t\t\t\tWHERE status = '1'\n\t\t\t\t\tAND unblockdate IS NOT NULL\n\t\t\t\t\tAND unblockdate <= getdate()\n\t\t\tOPEN CursorChar;\n\t\t\tFETCH CursorChar INTO @memb___id,@idx\t\t\n\t\t\tWHILE @@FETCH_STATUS = 0\n\t\t\t\tBEGIN\n\t\t\t\t\tUPDATE Character SET CtlCode = '0' WHERE AccountID = @memb___id\n\t\t\t\t\tUPDATE MEMB_INFO SET bloc_code = '0' WHERE memb___id = @memb___id\n\t\t\t\t\tUPDATE Z_BlockedUsers SET status = '0' WHERE idx = @idx\n\t\t\t\t\tFETCH CursorChar INTO @memb___id,@idx\n\t\t\t\tEND;\n\t\t\tCLOSE CursorChar;\n\t\t\tDEALLOCATE CursorChar;\n\t\t");
//DELETE EXPIRED VIP ITEMS
if (isset($VIP_Item_CronLog) && $VIP_Item_CronLog === true) {
    $Log = true;
    if (!is_dir("CronLog")) {
        mkdir("CronLog", 0777);
    }
    $fileName = date("Y-m-d-H-i");
    $file = fopen("CronLog/{$fileName}.txt", "a");
} else {
    $Log = false;
}
// DELETE FROM WEB
$db->Query("\n\tDELETE FROM Z_WebVault\n\tWHERE substring(item,7,8) IN\n\t(\n\t\tSELECT serial FROM Z_VipItemData WHERE deleted = 0 AND memb___id IN\n\t\t(\n\t\t\tSELECT memb___id FROM Z_VipItemUsers WHERE status = 0\n\t\t)\n\t)\t\n\t\t\t\t\t\t\n\tDELETE FROM Z_WebTradeDirectSaleItems\n\tWHERE substring(item,7,8) IN\n\t(\n\t\tSELECT serial FROM Z_VipItemData WHERE deleted = 0 AND memb___id IN\n\t\t(\n\t\t\tSELECT memb___id FROM Z_VipItemUsers WHERE status = 0\n\t\t)\n\t)\t\t\n");
$db->Query("SELECT TOP 300 serial,memb___id FROM Z_VipItemData WHERE deleted = 0 AND memb___id IN (SELECT memb___id FROM Z_VipItemUsers WHERE status = 0)");
$NumRows = $db->NumRows();
if ($NumRows > 0) {
    if ($Log) {
        $string = "[" . date("d/m/Y H:i:s") . "] [VIP ITEMS] Starting - - - - - - - - - - - - - - - - - - - - - - -\n";
        $string = "[" . date("d/m/Y H:i:s") . "] [VIP ITEMS] Verifying {$NumRows} itens";
        $string .= $NumRows == 300 ? " (Max)" : "";
        fwrite($file, $string . "\n");
    }
    $SerialData = array();
    for ($i = 0; $i < $NumRows; $i++) {
        $SerialData[$i] = $db->GetRow();
    }
    for ($i = 0; $i < $NumRows; $i++) {
        $serial = $SerialData[$i][0];
        $memb___id = $SerialData[$i][1];
        if ($Log) {
Example #2
0
<?php

if (!@(require "Config/Main.php")) {
    die;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
$db = new MuDatabase();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Guild.class.php";
$gd = new Guild();
$db->Query("SELECT g.G_Name,g.G_Master,g.G_Mark,cs.Points,g.Number FROM Guild g, Z_CastleSiegeWins cs WHERE g.G_Name = cs.Guild AND g.G_Name = (SELECT OWNER_GUILD FROM MuCastle_DATA)");
if ($db->NumRows() > 0) {
    $data = $db->GetRow();
    $CSOwner = $data[0];
    $CSKing = $data[1];
    $CSMark = $gd->PrintGuildMark(bin2hex($data[2]), 96);
    $CSWins = $data[3];
    $CSOwnersNumber = $data[4];
    $db->Query("SELECT g.G_Name, COUNT(m.G_Name) FROM Guild g, GuildMember m WHERE g.G_Name = m.G_Name AND g.G_Union = '{$CSOwnersNumber}' GROUP BY g.G_Name");
    $NumAllies = $db->NumRows();
    $CSAllies = array();
    $CSMembers = 0;
    for ($i = 0; $i < $NumAllies; $i++) {
        $result = $db->GetRow();
        if ($result[0] != $CSOwner) {
            $CSAllies[$i] = $result[0];
        }
        $CSMembers += $result[1];
    }
} else {
    $CSOwner = "-";
    $CSKing = "-";
Example #3
0
     $transferencia = false;
 }
 switch ($transferencia) {
     case 'ok':
         $post = filter_input_array(INPUT_POST, FILTER_DEFAULT);
         if ($post) {
             $post['type'] = (int) strip_tags(trim($post['type']));
             $post['destino'] = (string) strip_tags(trim(strtolower($post['destino'])));
             $post['valor'] = (int) strip_tags(trim($post['valor']));
             if (in_array('', $post) && $post['type'] == 0) {
                 $mensagem = "<div class='alert alert-info'><b>{$acc->memb_name}</b>, por favor preencha todas os campos para continuar.</div>";
             } elseif ($post['valor'] < VALOR_MIN || $post['valor'] > VALOR_MAX) {
                 $mensagem = "<div class='alert alert-warning'><b>{$acc->memb_name}</b>, o valor transferido deve conter no mínimo " . VALOR_MIN . " e máximo " . VALOR_MAX . ".</div>";
             } else {
                 $db->Query("SELECT memb___id FROM MEMB_INFO WHERE memb___id = '" . $post['destino'] . "'");
                 if ($db->NumRows() <= 0) {
                     $mensagem = "<div class='alert alert-danger'><b>{$acc->memb_name}</b>, login não encontrado no banco de dados, por favor digite novamente.</div>";
                 } elseif ($post['destino'] == $acc->memb___id) {
                     $mensagem = "<div class='alert alert-warning'><b>{$acc->memb_name}</b>, você não pode transferir para sua propria conta, por favor digite um login diferente do seu.</div>";
                 } elseif ($acc->GetCreditAmount($acc->memb___id, $post['type'], $db) < $post['valor']) {
                     $mensagem = "<div class='alert alert-info'><b>{$acc->memb_name}</b>, você não tem " . $moedas[$post['type']] . " suficiente para fazer a transferencia.</div>";
                 } else {
                     //
                     $acc->ReduceCredits($acc->memb___id, $post['type'], $post['valor'], $db);
                     $acc->AddCredits($post['destino'], $post['type'], $post['valor'], $db);
                     $mensagem = "<div class='alert alert-success'><b>{$acc->memb_name}</b>, você acaba de transferir <b>" . $post['valor'] . " " . $moedas[$post['type']] . "</b> para a conta <b>" . $post['destino'] . "</b>.</b></div>";
                 }
             }
         }
         break;
 }
Example #4
0
$Percent = (($data[0]*(($data[0]/80)+1)) / $MaximoOnline);
$Barra = (int)(172 * $Percent);*/
////////////////////////
/* JOGADORES ATIVOS */
$MaximoOnline = 700;
$db->Query("SELECT COUNT(memb___id) FROM MEMB_STAT WHERE DATEDIFF(day,ConnectTM,getdate()) < 7");
$data = $db->GetRow();
$TotalOnline = number_format($data[0], 0, "", ".");
$Percent = $data[0] / $MaximoOnline;
$Barra = (int) (172 * $Percent);
////////////////////////
/* CASTLE SIEGE */
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Guild.class.php";
$gd = new Guild();
$db->Query("SELECT g.G_Name,g.G_Master,g.G_Mark,cs.Points FROM Guild g, Z_CastleSiegeWins cs WHERE g.G_Name = cs.Guild AND g.G_Name = (SELECT OWNER_GUILD FROM MuCastle_DATA)");
if ($db->NumRows() > 0) {
    $data = $db->GetRow();
    $CSOwner = $data[0];
    $CSKing = $data[1];
    $CSMark = $gd->PrintGuildMark(bin2hex($data[2]), 80);
    $CSWins = $data[3];
} else {
    $CSOwner = "";
    $CSKing = "";
    $CSMark = "";
    $CSWins = "";
}
$db->Query("SELECT DATEADD(day, -1, SIEGE_END_DATE) FROM MuCastle_DATA");
$data = $db->GetRow();
$dateClass = new Date();
$NextCSDate = $dateClass->DateFormat($data[0]);
Example #5
0
//
//	if($lic->CheckLicense("Reseller") == 0)
//	{
//		die("Reseller module not authorized.<br />Ask at www.leoferrarezi.com");
//	}
//}
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/Reseller.php";
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/GeneralContent.tpl.php")) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
    $db = new MuDatabase();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
    $acc = new Account($db);
    $my_array['GeneralTitle'] = $ResellerMsg01;
    $my_array['GeneralContent'] = "";
    $db->Query("SELECT memb___id FROM Z_Resellers WHERE memb___id = '" . $acc->memb___id . "'");
    if ($db->NumRows() < 1) {
        $return = "<div class=\"ResellerIntroDiv\">{$ResellerMsg02}</div>";
    } else {
        require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Reseller.class.php";
        $rs = new Reseller();
        if (!isset($_POST['cust_memb___id']) || empty($_POST['cust_memb___id'])) {
            $return = $rs->ResellerForm($db, $acc);
        } else {
            $return = $rs->TransferResellerCredits($db, $acc, $_POST['cust_memb___id'], $_POST['cust_amount']);
        }
    }
    $my_array['GeneralContent'] = $return;
    $db->Disconnect();
    $tpl = new Template();
    $tpl->Assign($my_array);
    $tpl->Display($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/GeneralContent.tpl.php");
Example #6
0
<?php

@session_start();
if (!@(require "Config/Main.php")) {
    die;
}
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/Events.php";
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/Events.tpl.php")) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
    $db = new MuDatabase();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Date.class.php";
    $dt = new Date();
    $db->Query("SELECT * FROM Z_Currencies ORDER BY idx");
    $NumCurrencies = $db->NumRows();
    $Currencies = array();
    for ($i = 0; $i < $NumCurrencies; $i++) {
        $Currencies[$i + 1] = $db->GetRow();
    }
    $db->Query("SELECT TOP 30 * FROM Z_EventsSchedule WHERE winner IS NULL ORDER BY date");
    $NumRows = $db->NumRows();
    $EventsData = array();
    for ($i = 0; $i < $NumRows; $i++) {
        $data = $db->GetRow();
        $EventsData[$i] = $data;
    }
    $return = "<table class=\"BlockedUsersTable\">\n    <tr>\n      <th align=\"center\">{$EventsMsg01}</th>\n      <th align=\"center\">{$EventsMsg02}</th>\n\t  <th align=\"center\">{$EventsMsg03}</th>\n\t  <th align=\"center\">{$EventsMsg04}</th>\n\t</tr>";
    for ($i = 0; $i < $NumRows; $i++) {
        $data = $EventsData[$i];
        $db->Query("SELECT realname FROM Z_Users WHERE id = '" . $data['by'] . "'");
        $result = $db->GetRow();
        $Admin = $result[0];
Example #7
0
function ShowStep2()
{
    require "Config/Main.php";
    $_SESSION['SiteFolder'] = $MainSiteFolder;
    require "System/MuDatabase.class.php";
    $db = new MuDatabase(true);
    if (isset($_POST['submit'])) {
        if ($_POST['dbCreate'] == 1) {
            $drops = "\n\t\t\tUSE [MuOnline]\n\t\t\tIF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[PK_HEROI]'))\n\t\t\tDROP TRIGGER [dbo].[PK_HEROI]\n\t\t\tIF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[Z_PK_HERO]'))\n\t\t\tDROP TRIGGER [dbo].[Z_PK_HERO]\n\t\t\tIF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[XW_PK_HERO]'))\n\t\t\tDROP TRIGGER [dbo].[XW_PK_HERO]\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_BlockedUsers]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_BlockedUsers;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_CastleSiegeWins]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_CastleSiegeWins;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_ChangeKeyLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_ChangeKeyLog;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_ChangePassLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_ChangePassLog;  \n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Credits]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Credits;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_CreditShopItens]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_CreditShopItens;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_CreditShopLogs]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_CreditShopLogs;\n\t\t\tIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_CreditShopPacks]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_CreditShopPacks;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Currencies]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Currencies;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_DepositBanks]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_DepositBanks;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_DepositWayData]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_DepositWayData;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_DepositWays]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_DepositWays;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskAttach]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_HelpDeskAttach;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskBlock]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_HelpDeskBlock;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskButtons]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_HelpDeskButtons;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskMessages]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_HelpDeskMessages;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskTickets]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_HelpDeskTickets;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Income]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Income;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_LostPasswordLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_LostPasswordLog;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_MailListMessages]') AND type in (N'U'))\n\t\t\tDROP TABLE [dbo].[Z_MailListMessages]\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_MailListSending]') AND type in (N'U'))\n\t\t\tDROP TABLE [dbo].[Z_MailListSending]\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_MailValidation]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_MailValidation;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Messages]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Messages;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_News]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_News;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Users]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Users;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Rename]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Rename;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Resellers]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Resellers;   \n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopCategories]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopCategories;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopDiscCodes]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopDiscCodes;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopItems]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopItems;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopLog;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopPackItems]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopPackItems;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebShopPacks]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebShopPacks;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebTradeDirectSale]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebTradeDirectSale;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebTradeDirectSaleItems]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebTradeDirectSaleItems;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_WebVault]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_WebVault;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_PollAnswers]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_PollAnswers;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Polls]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Polls;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_PollVotes]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_PollVotes;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_GuideDBCategories]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_GuideDBCategories;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Guides]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Guides;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_Events]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_Events;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_EventsSchedule]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_EventsSchedule;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_ResetTransferLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_ResetTransferLog;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_VipItemData]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_VipItemData;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_VipItemUsers]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_VipItemUsers;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_GameCurrencies]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_GameCurrencies;\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_ChangeClassLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_ChangeClassLog;\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_MasterResetLog]') AND type in (N'U'))\n\t\t\tDROP TABLE Z_MasterResetLog;\t\t\n\t\t\t\t\t\t\n\t\t\t";
            //Drop All Tables
            $db->Query($drops);
            $query[0] = "\n\t\t\tSET ANSI_NULLS ON\n\t\t\tSET QUOTED_IDENTIFIER ON\n\t\t\tIF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DT_GenHash]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))\n\t\t\tBEGIN\n\t\t\texecute dbo.sp_executesql @statement = N'CREATE  FUNCTION [dbo].[DT_GenHash] (@data VARCHAR(10), @data2 VARCHAR(10)) \n\t\t\tRETURNS BINARY(16) AS\n\t\t\tBEGIN\n\t\t\tDECLARE @hash BINARY(16)\n\t\t\tEXEC master.dbo.XP_MD5_EncodeKeyVal @data2, @data, @hash OUT\n\t\t\tRETURN @hash\n\t\t\tEND' \n\t\t\tEND\n\t\t\t";
            //MD5 hash
            $query[1] = "\n\t\t\tALTER PROCEDURE [dbo].[WZ_CS_ModifyCastleOwnerInfo]\n\t\t\t@iMapSvrGroup  SMALLINT,\n\t\t\t@iCastleOccupied INT,\n\t\t\t@szOwnGuildName VARCHAR(8)\n\t\t\tAs\n\t\t\tBegin\n\t\t\tBEGIN TRANSACTION\n\t\t\tSET NOCOUNT ON\n\t\t\tIF EXISTS ( SELECT MAP_SVR_GROUP FROM MuCastle_DATA  WITH (READUNCOMMITTED) WHERE MAP_SVR_GROUP = @iMapSvrGroup)\n\t\t\tBEGIN\n\t\t\tUPDATE MuCastle_DATA \n\t\t\tSET CASTLE_OCCUPY = @iCastleOccupied, OWNER_GUILD = @szOwnGuildName\n\t\t\tWHERE MAP_SVR_GROUP = @iMapSvrGroup\n\t\t\t\n\t\t\tDECLARE @exist varchar(10)\n\t\t\tset @exist = 'NOT'\n\t\t\t\n\t\t\tSELECT @exist = Guild FROM Z_CastleSiegeWins WHERE Guild = @szOwnGuildName\n\t\t\tif( @exist <> 'NOT' )\n\t\t\tbegin \n\t\t\tUPDATE Z_CastleSiegeWins SET Points = Points+1 WHERE Guild = @szOwnGuildName\n\t\t\tend\n\t\t\telse\n\t\t\tbegin\n\t\t\tINSERT INTO Z_CastleSiegeWins (Guild,Points)\n\t\t\tVALUES (@szOwnGuildName,1)\n\t\t\tend\n\t\t\t\n\t\t\tSELECT 1 As QueryResult\n\t\t\tEND\n\t\t\tELSE\n\t\t\tBEGIN\n\t\t\tSELECT 0 As QueryResult\n\t\t\tEND\n\t\t\tIF(@@Error <> 0 )\n\t\t\tROLLBACK TRANSACTION\n\t\t\tELSE \n\t\t\tCOMMIT TRANSACTION\n\t\t\tSET NOCOUNT OFF \n\t\t\tEnd  \n\t\t\t";
            //Procedure CS
            $query[2] = "\n\t\t\tCREATE TABLE [dbo].[Z_BlockedUsers](\n\t\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t\t[cause] [nvarchar](255) NULL,\n\t\t\t\t[blockdate] [datetime] NOT NULL,\n\t\t\t\t[unblockdate] [datetime] NULL,\n\t\t\t\t[image] [nvarchar](255) NULL,\n\t\t\t\t[admin] [tinyint] NOT NULL,\n\t\t\t\t[status] [tinyint] NOT NULL,\n\t\t\t CONSTRAINT [PK_Z_BlockedUsers] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tIF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Z_BlockedUsers]') AND name = N'IX_Z_BlockedUsers')\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_BlockedUsers] ON [dbo].[Z_BlockedUsers]\n\t\t\t(\n\t\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t\n\t\t\tIF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_Z_BlockedUsers_bloc_date]') AND type = 'D')\n\t\t\tBEGIN\n\t\t\tALTER TABLE [dbo].[Z_BlockedUsers] ADD  CONSTRAINT [DF_Z_BlockedUsers_bloc_date]  DEFAULT (getdate()) FOR [blockdate]\n\t\t\tEND\t\t\t\n\t\t\n\t\t\tIF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_Z_BlockedUsers_status]') AND type = 'D')\n\t\t\tBEGIN\n\t\t\tALTER TABLE [dbo].[Z_BlockedUsers] ADD  CONSTRAINT [DF_Z_BlockedUsers_status]  DEFAULT ((1)) FOR [status]\n\t\t\tEND\n\t\t\t";
            //Z_BlockedUsers
            $query[3] = "\n\t\t\tCREATE TABLE [dbo].[Z_CastleSiegeWins](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[Guild] [varchar](10) NOT NULL,\n\t\t\t[Points] [int] NOT NULL\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            //Z_CastleSiegeWins
            $query[4] = "\n\t\t\tCREATE TABLE [dbo].[Z_ChangeKeyLog](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[old___key] [nvarchar](7) NOT NULL,\n\t\t\t[new___key] [nvarchar](7) NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_ChangeKeyLog_date]  DEFAULT (getdate()),\n\t\t\tCONSTRAINT [PK_Z_ChangeKeyLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_ChangeKeyLog] ON [dbo].[Z_ChangeKeyLog] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_ChangeKeyLog
            $query[5] = "\n\t\t\tCREATE TABLE [dbo].[Z_ChangePassLog](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[old___pwd] [nvarchar](10) NOT NULL,\n\t\t\t[new___pwd] [nvarchar](10) NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_ChangePassLog_date]  DEFAULT (getdate()),\n\t\t\tCONSTRAINT [PK_Z_ChangePassLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tIF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Z_ChangePassLog]') AND name = N'IX_Z_ChangePassLog')\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_ChangePassLog] ON [dbo].[Z_ChangePassLog] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_ChangePassLog
            $query[6] = "\n\t\t\tCREATE TABLE [dbo].[Z_Credits](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[value] [int] NOT NULL CONSTRAINT [DF_Z_Credits_value]  DEFAULT ((0)),\n\t\t\t[type] [tinyint] NOT NULL CONSTRAINT [DF_Z_Credits_type]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_Credits] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_Credits] ON [dbo].[Z_Credits] \n\t\t\t(\n\t\t\t[memb___id] ASC,\n\t\t\t[type] DESC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_Credits
            $query[7] = "\n\t\t\tCREATE TABLE [dbo].[Z_CreditShopItens](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[pack_idx] [int] NOT NULL,\n\t\t\t[item] [nvarchar](10) NOT NULL,\n\t\t\t[value] [int] NOT NULL CONSTRAINT [DF_Z_CreditShopItens_value]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_CreditShopItens] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_CreditShopItens] ON [dbo].[Z_CreditShopItens] \n\t\t\t(\n\t\t\t[pack_idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_CreditShopItens
            $query[8] = "\n\t\t\tCREATE TABLE [dbo].[Z_CreditShopLogs](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nchar](10) NULL,\n\t\t\t[date] [datetime] NULL CONSTRAINT [DF_Z_CreditShopLogs_date]  DEFAULT (getdate()),\n\t\t\t[package] [int] NULL,\n\t\t\t[paidvalue] [int] NULL,\n\t\t\tCONSTRAINT [PK_Z_CreditShopLogs] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_CreditShopLogs] ON [dbo].[Z_CreditShopLogs] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_CreditShopLogs
            $query[9] = "\n\t\t\tCREATE TABLE [dbo].[Z_CreditShopPacks](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[name] [nvarchar](50) NOT NULL,\n\t\t\t[description] [nvarchar](255) NULL,\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_CreditShopPacks_status]  DEFAULT ((0)),\n\t\t\t[price] [smallint] NOT NULL CONSTRAINT [DF_Z_CreditShopPacks_price]  DEFAULT ((0)),\n\t\t\t[order] [smallint] NOT NULL CONSTRAINT [DF_Z_CreditShopPacks_order]  DEFAULT ((0)),\n\t\t\t[multiply] [nvarchar](50) NOT NULL CONSTRAINT [DF_Z_CreditShopPacks_multiply]  DEFAULT ((1)),\n\t\t\tCONSTRAINT [PK_Z_CreditShopPacks] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_CreditShopPacks] ON [dbo].[Z_CreditShopPacks] \n\t\t\t(\n\t\t\t[status] ASC,\n\t\t\t[order] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_CreditShopPacks
            $query[10] = "\n\t\t\tCREATE TABLE [dbo].[Z_Currencies](\n\t\t\t[idx] [int] NOT NULL,\n\t\t\t[name] [nvarchar](50) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_Currencies] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            //Z_Currencies
            $query[11] = "\n\t\t\tCREATE TABLE [dbo].[Z_DepositBanks](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[bank_name] [nvarchar](50) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_DepositBanks] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            //Z_DepositBanks
            $query[12] = "\n\t\t\tCREATE TABLE [dbo].[Z_DepositWayData](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[data] [nvarchar](255) NOT NULL,\n\t\t\t[format] [nvarchar](255) NOT NULL,\n\t\t\t[way] [int] NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_DepositWayData] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_DepositWayData] ON [dbo].[Z_DepositWayData] \n\t\t\t(\n\t\t\t[way] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_DepositWayData
            $query[13] = "\n\t\t\tCREATE TABLE [dbo].[Z_DepositWays](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[way_name] [nvarchar](20) NOT NULL,\n\t\t\t[bank] [int] NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_DepositWays] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_DepositWays] ON [dbo].[Z_DepositWays] \n\t\t\t(\n\t\t\t[bank] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_DepositWays
            $query[14] = "\n\t\t\tCREATE TABLE [dbo].[Z_HelpDeskAttach](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[msg_idx] [bigint] NOT NULL,\n\t\t\t[file] [nvarchar](37) NOT NULL,\n\t\t\t[orig_name] [nvarchar](50) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_HelpDeskAttach] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_HelpDeskAttach] ON [dbo].[Z_HelpDeskAttach] \n\t\t\t(\n\t\t\t[msg_idx] DESC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_HelpDeskAttach
            $query[15] = "\n\t\t\tCREATE TABLE [dbo].[Z_HelpDeskBlock](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](50) NOT NULL,\n\t\t\t[admin] [tinyint] NOT NULL CONSTRAINT [DF_Z_HelpDeskBlock_admin]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_HelpDeskBlock] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_HelpDeskBlock] ON [dbo].[Z_HelpDeskBlock] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_HelpDeskBlock
            $query[16] = "\n\t\t\tCREATE TABLE [dbo].[Z_HelpDeskButtons](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[title] [nvarchar](32) NULL,\n\t\t\t[text] [text] NULL,\n\t\t\t[user] [tinyint] NULL CONSTRAINT [DF_Z_HelpDeskButtons_user]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_HelpDeskButtons] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tIF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Z_HelpDeskButtons]') AND name = N'IX_Z_HelpDeskButtons')\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_HelpDeskButtons] ON [dbo].[Z_HelpDeskButtons] \n\t\t\t(\n\t\t\t[user] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_HelpDeskButtons
            $query[17] = "\n\t\t\tCREATE TABLE [dbo].[Z_HelpDeskMessages](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[ticket_idx] [bigint] NOT NULL,\n\t\t\t[message] [text] NULL,\n\t\t\t[by] [nvarchar](50) NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_HelpDeskMessages_date]  DEFAULT (getdate()),\n\t\t\t[ip] [nvarchar](15) NULL,\n\t\t\tCONSTRAINT [PK_HelpDeskMessages] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_HelpDeskMessages] ON [dbo].[Z_HelpDeskMessages] \n\t\t\t(\n\t\t\t[ticket_idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_HelpDeskMessages
            $query[18] = "\n\t\t\tCREATE TABLE [dbo].[Z_HelpDeskTickets](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[created] [datetime] NOT NULL CONSTRAINT [DF_Z_HelpDeskTickets_created]  DEFAULT (getdate()),\n\t\t\t[last_update] [datetime] NOT NULL CONSTRAINT [DF_Z_HelpDeskTickets_last_update]  DEFAULT (getdate()),\n\t\t\t[admin] [tinyint] NULL,\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_HelpDeskTickets_status]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_HelpDeskTickets] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_HelpDeskTickets] ON [dbo].[Z_HelpDeskTickets] \n\t\t\t(\n\t\t\t[memb___id] ASC,\n\t\t\t[status] DESC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_HelpDeskTickets
            $query[19] = "\n\t\t\tCREATE TABLE [dbo].[Z_Income](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](50) NOT NULL,\n\t\t\t[amount] [smallint] NOT NULL,\n\t\t\t[bank] [nvarchar](50) NOT NULL,\n\t\t\t[way] [nvarchar](50) NOT NULL,\n\t\t\t[date_pay] [datetime] NULL CONSTRAINT [DF_Z_Income_date_pay]  DEFAULT (getdate()),\n\t\t\t[date_confirm] [datetime] NULL,\n\t\t\t[data] [text] NOT NULL,\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_Income_status]  DEFAULT ((0)),\n\t\t\t[extra_info] [text] NULL,\n\t\t\tCONSTRAINT [PK_Z_Income] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_Income] ON [dbo].[Z_Income] \n\t\t\t(\n\t\t\t[status] ASC,\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_Income
            $query[20] = "\n\t\t\tCREATE TABLE [dbo].[Z_LostPasswordLog](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_LostPasswordLog_date]  DEFAULT (getdate()),\n\t\t\tCONSTRAINT [PK_Z_LostPasswordLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_LostPasswordLog] ON [dbo].[Z_LostPasswordLog] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_LostPasswordLog
            $query[21] = "\n\t\t\tCREATE TABLE [dbo].[Z_MailValidation](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[code] [nvarchar](32) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_MailValidation] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            //Z_MailValidation
            $query[22] = "\n\t\t\tCREATE TABLE [dbo].[Z_Messages](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[subject] [nvarchar](50) NOT NULL,\n\t\t\t[message] [text] NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_Messages_date]  DEFAULT (getdate()),\n\t\t\t[status] [smallint] NOT NULL CONSTRAINT [DF_Z_Messages_status]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_Messages] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_Messages] ON [dbo].[Z_Messages] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_Messages
            $query[23] = "\n\t\t\tCREATE TABLE [dbo].[Z_News](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[title] [nvarchar](255) NOT NULL,\n\t\t\t[text] [text] NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_News_date]  DEFAULT (getdate()),\n\t\t\t[admin] [nvarchar](20) NOT NULL,\n\t\t\t[stick] [tinyint] NOT NULL CONSTRAINT [DF_Z_News_stick]  DEFAULT ((0)),\n\t\t\t[views] [int] NOT NULL CONSTRAINT [DF_Z_News_views]  DEFAULT ((0)),\n\t\t\t[order] [smallint] NOT NULL CONSTRAINT [DF_Z_News_order]  DEFAULT ((0)),\n\t\t\t[archive] [tinyint] NOT NULL CONSTRAINT [DF_Z_News_archive]  DEFAULT ((0)),\n\t\t\t[link] [nvarchar](255) NULL,\n\t\t\tCONSTRAINT [PK_Z_News] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_News] ON [dbo].[Z_News] \n\t\t\t(\n\t\t\t[archive] DESC,\n\t\t\t[order] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]  \n\t\t\t";
            //Z_News
            $query[24] = "\n\t\t\tCREATE TABLE [dbo].[Z_Users](\n\t\t\t[id] [smallint] IDENTITY(1,1) NOT NULL,\n\t\t\t[username] [nvarchar](20) NOT NULL,\n\t\t\t[password] [nvarchar](20) NOT NULL,\n\t\t\t[realname] [nvarchar](50) NOT NULL,\n\t\t\t[userlevel] [tinyint] NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_Users] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            //Z_Users
            $query[25] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopCategories](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[name] [nvarchar](30) NOT NULL,\n\t\t\t[orderN] [smallint] NOT NULL,\n\t\t\t[pack] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopCategories_pack]  DEFAULT ((0)),\n\t\t\t[main_cat] [int] NOT NULL CONSTRAINT [DF_Z_WebShopCategories_main_cat] DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_WebShopCategories] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopCategories] ON [dbo].[Z_WebShopCategories] \n\t\t\t(\n\t\t\t[pack] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebShopCategories
            $query[26] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopItems](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[category_idx] [int] NOT NULL,\n\t\t\t[type] [smallint] NOT NULL,\n\t\t\t[id] [smallint] NOT NULL,\n\t\t\t[max_exc_opts] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_max_exc_opts]  DEFAULT ((6)),\n\t\t\t[currency] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_currency]  DEFAULT ((1)),\n\t\t\t[base_price] [int] NOT NULL CONSTRAINT [DF_Z_WebShopItens_base_price]  DEFAULT ((0)),\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_status]  DEFAULT ((0)),\n\t\t\t[min_level] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_min_level]  DEFAULT ((0)),\n\t\t\t[max_level] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_max_level]  DEFAULT ((15)),\n\t\t\t[addopt] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_addopt]  DEFAULT ((0)),\n\t\t\t[skill] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_skill]  DEFAULT ((0)),\n\t\t\t[luck] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_luck]  DEFAULT ((0)),\n\t\t\t[ancient] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_ancient]  DEFAULT ((0)),\n\t\t\t[harmony] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_harmony]  DEFAULT ((0)),\n\t\t\t[opt380] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_opt380]  DEFAULT ((0)),\n\t\t\t[socket_empty] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_socket_empty]  DEFAULT ((0)),\n\t\t\t[max_socket] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItens_max_socket]  DEFAULT ((0)),\n\t\t\t[socket_level] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_socket_level]  DEFAULT ((5)),\n\t\t\t[max_amount] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_max_amount]  DEFAULT ((1)),\n\t\t\t[sold] [int] NOT NULL CONSTRAINT [DF_Z_WebShopItens_sold]  DEFAULT ((0)),\n\t\t\t[limit] [int] NOT NULL CONSTRAINT [DF_Z_WebShopItens_limit]  DEFAULT ((0)),\n\t\t\t[insurance] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_insurance]  DEFAULT ((0)),\n\t\t\t[cancellable] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_cancellable]  DEFAULT ((0)),\n\t\t\t[vip_item] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopItems_vip_item] DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_WebShopItens] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopItems] ON [dbo].[Z_WebShopItems] \n\t\t\t(\n\t\t\t[category_idx] ASC,\n\t\t\t[status] DESC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebShopItems
            $query[27] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopLog](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[serial] [nchar](8) NOT NULL,\n\t\t\t[item] [nchar](32) NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_WebShopLog_date]  DEFAULT (getdate()),\n\t\t\t[price] [int] NOT NULL CONSTRAINT [DF_Z_WebShopLog_price]  DEFAULT ((0)),\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_status]  DEFAULT ((1)),\n\t\t\t[insurance] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_insurance]  DEFAULT ((0)),\n\t\t\t[amount] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_amount]  DEFAULT ((1)),\n\t\t\t[pack] [smallint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_pack]  DEFAULT ((0)),\n\t\t\t[currency] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_currency]  DEFAULT ((1)),\n\t\t\t[discCode] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,\n\t\t\t[cancellable] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopLog_cancellable]  DEFAULT ((0)), \n\t\t\tCONSTRAINT [PK_Z_WebShopLogs] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopLog] ON [dbo].[Z_WebShopLog] \n\t\t\t(\n\t\t\t[memb___id] ASC,\n\t\t\t[item] ASC,\n\t\t\t[status] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebShopLog
            $query[28] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopPackItems](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[pack_idx] [int] NOT NULL,\n\t\t\t[type] [tinyint] NOT NULL,\n\t\t\t[id] [tinyint] NOT NULL,\n\t\t\t[exc_opts] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_max_exc_opts]  DEFAULT ((63)),\n\t\t\t[level] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_min_level]  DEFAULT ((15)),\n\t\t\t[addopt] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_addopt]  DEFAULT ((7)),\n\t\t\t[skill] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_skill]  DEFAULT ((0)),\n\t\t\t[luck] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_luck]  DEFAULT ((1)),\n\t\t\t[ancient] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_ancient]  DEFAULT ((0)),\n\t\t\t[harmony_opt] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_harmony_opt1]  DEFAULT ((0)),\n\t\t\t[harmony_lvl] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_harmony]  DEFAULT ((0)),\n\t\t\t[opt380] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_opt380]  DEFAULT ((0)),\n\t\t\t[socket1] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_max_socket]  DEFAULT ((0)),\n\t\t\t[socket2] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_socket2]  DEFAULT ((0)),\n\t\t\t[socket3] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_socket3]  DEFAULT ((0)),\n\t\t\t[socket4] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_socket4]  DEFAULT ((0)),\n\t\t\t[socket5] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPackItems_socket5]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_WebShopPackItems] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopPackItems] ON [dbo].[Z_WebShopPackItems] \n\t\t\t(\n\t\t\t[pack_idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebShopPackItems
            $query[29] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopPacks](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[category_idx] [int] NOT NULL,\n\t\t\t[pack_name] [nvarchar](50) NOT NULL,\n\t\t\t[currency] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_currency]  DEFAULT ((1)),\n\t\t\t[base_price] [int] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_base_price]  DEFAULT ((0)),\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_status]  DEFAULT ((1)),\n\t\t\t[sold] [int] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_sold]  DEFAULT ((0)),\n\t\t\t[limit] [int] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_limit]  DEFAULT ((0)),\n\t\t\t[insurance] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_insurance]  DEFAULT ((1)),\n\t\t\t[cancellable] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_cancellable]  DEFAULT ((0)),\n\t\t\t[vip_item] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebShopPacks_vip_item] DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_WebShopPacks] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopPacks] ON [dbo].[Z_WebShopPacks] \n\t\t\t(\n\t\t\t[category_idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebShopPacks
            $query[30] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebTradeDirectSale](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[source] [nvarchar](10) NOT NULL,\n\t\t\t[destinationChar] [nvarchar](10) NOT NULL,\n\t\t\t[destination] [nvarchar](10) NOT NULL,\n\t\t\t[status] [tinyint] NOT NULL CONSTRAINT [DF_Z_WebTradeDirectSell_status]  DEFAULT ((0)),\n\t\t\t[dateSent] [datetime] NOT NULL CONSTRAINT [DF_Z_WebTradeDirectSell_dateSent]  DEFAULT (getdate()),\n\t\t\t[dateUpdate] [datetime] NOT NULL CONSTRAINT [DF_Z_WebTradeDirectSell_dateUpdate]  DEFAULT (getdate()),\n\t\t\tCONSTRAINT [PK_Z_WebTradeDirectSell] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebTradeDirectSale] ON [dbo].[Z_WebTradeDirectSale] \n\t\t\t(\n\t\t\t[destination] ASC,\n\t\t\t[source] ASC,\n\t\t\t[status] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebTradeDirectSale
            $query[31] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebTradeDirectSaleItems](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[sale_idx] [bigint] NOT NULL,\n\t\t\t[via] [tinyint] NOT NULL,\n\t\t\t[item] [nchar](32) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_WebTradeDirectSellItems] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebTradeDirectSaleItems] ON [dbo].[Z_WebTradeDirectSaleItems] \n\t\t\t(\n\t\t\t[sale_idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebTradeDirectSaleItems_1] ON dbo.Z_WebTradeDirectSaleItems\n\t\t\t(\n\t\t\t[item] ASC\n\t\t\t) WITH(PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t\n\t\t\t";
            //Z_WebTradeDirectSaleItems
            $query[32] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebVault](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[item] [nchar](32) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_WebVault] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebVault] ON [dbo].[Z_WebVault] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebVault_1] ON [dbo].[Z_WebVault]\n\t\t\t(\n\t\t\t[item]\n\t\t\t) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t";
            //Z_WebVault
            $query[33] = "INSERT INTO [Z_Users] ([username],[password],[realname],[userlevel]) VALUES ('admin','admin','Admin','9')";
            //INSERT USER
            $query[34] = "\n\t\t\tCREATE TABLE [dbo].[Z_MailListMessages](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[title] [nvarchar](255) NOT NULL,\n\t\t\t[message] [text] NULL,\n\t\t\tCONSTRAINT [PK_Z_MailListMessages] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE TABLE [dbo].[Z_MailListSending](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[msg_idx] [int] NOT NULL,\n\t\t\t[mail_addr] [nvarchar](255) NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_MailListSending] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            // Mail List
            $query[35] = "\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects where name = 'DF_Character_Z_RankPK' and type = 'D')\n\t\t\tBEGIN\n\t\t\t\tALTER TABLE dbo.Character DROP CONSTRAINT DF_Character_Z_RankPK\n\t\t\tEND\n\t\t\t\n\t\t\tIF  EXISTS (SELECT * FROM sys.objects where name = 'DF_Character_Z_RankHR' and type = 'D')\n\t\t\tBEGIN\n\t\t\t\tALTER TABLE dbo.Character DROP CONSTRAINT DF_Character_Z_RankHR\n\t\t\tEND\n\t\t\t\n\t\t\tIF EXISTS (select * from sys.columns where Name = N'Z_RankPK' and Object_ID = Object_ID(N'Character'))\n\t\t\tBEGIN\n\t\t\t\tALTER TABLE dbo.Character DROP COLUMN Z_RankPK, Z_RankHR\n\t\t\tEND\n\t\t\t\n\t\t\tIF NOT EXISTS (select * from sys.columns where Name = N'Z_RankPK' and Object_ID = Object_ID(N'Character'))\n\t\t\tBEGIN\n\t\t\t\tALTER TABLE dbo.Character ADD\n\t\t\t\tZ_RankPK int NOT NULL CONSTRAINT DF_Character_Z_RankPK DEFAULT 0,\n\t\t\t\tZ_RankHR int NOT NULL CONSTRAINT DF_Character_Z_RankHR DEFAULT 0\n\t\t\tEND\t\t\t\n\t\t\t";
            // Ranking PK/HERO
            $query[36] = "\n\t\t\tCREATE TRIGGER [dbo].[Z_PK_HERO] ON [dbo].[Character]\n\t\t\tAFTER UPDATE\n\t\t\tAS\n\t\t\t\n\t\t\tDECLARE @rank int\n\t\t\tDECLARE @valor int\n\t\t\tDECLARE @char varchar(10)\n\t\t\t\n\t\t\tSELECT @valor = PkCount FROM DELETED\n\t\t\tSELECT @rank = PkCount, @char = Name FROM INSERTED\n\t\t\t\n\t\t\tIF (@rank > 0) and (@rank > @valor)\n\t\t\tUPDATE [dbo].[Character]\n\t\t\tSET Z_RankPK = Z_RankPK + (@rank-@valor)\n\t\t\tWHERE Name = @char\n\t\t\tELSE\n\t\t\tIF (@rank < 0) and (@rank < @valor)\n\t\t\tUPDATE [dbo].[Character]\n\t\t\tSET Z_RankHR = Z_RankHR + (@valor-@rank)\n\t\t\tWHERE Name = @char\n\t\t\t";
            // TRIGGER PK/HERO
            $query[37] = "\n\t\t\tCREATE TABLE [dbo].[Z_Rename](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[oldName] [nvarchar](10) NOT NULL,\n\t\t\t[newName] [nvarchar](10) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_Rename_date]  DEFAULT (getdate()),\n\t\t\t[ip] [nvarchar](15) NULL,\n\t\t\tCONSTRAINT [PK_Z_Rename] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY];\n\t\t\t";
            // Z_Rename
            $query[38] = "\n\t\t\tCREATE TABLE [dbo].[Z_WebShopDiscCodes](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[code] [nvarchar](50) NOT NULL,\n\t\t\t[type] [tinyint] NOT NULL CONSTRAINT [DF_Z_DiscountCodes_type]  DEFAULT ((1)),\n\t\t\t[value] [int] NOT NULL CONSTRAINT [DF_Z_DiscountCodes_value]  DEFAULT ((0)),\n\t\t\t[expireDate] [smalldatetime] NULL CONSTRAINT [DF_Z_DiscountCodes_expireDate]  DEFAULT (getdate()),\n\t\t\t[count] [int] NOT NULL CONSTRAINT [DF_Z_DiscountCodes_count]  DEFAULT ((1)),\n\t\t\tCONSTRAINT [PK_Z_DiscountCodes] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[code] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_WebShopDiscCodes] ON [dbo].[Z_WebShopDiscCodes] \n\t\t\t(\n\t\t\t[idx] ASC,\n\t\t\t[expireDate] ASC,\n\t\t\t[count] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]";
            // Z_WebShopDiscCodes
            $query[39] = "\n\t\t\tCREATE TABLE [dbo].[Z_Resellers](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t[name] [nvarchar](50) NULL,\n\t\t\t[description] [nvarchar](255) NULL,\n\t\t\t[commission] [tinyint] NULL,\n\t\t\tCONSTRAINT [PK_Z_Resellers] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX [IX_Z_Resellers] ON [dbo].[Z_Resellers] \n\t\t\t(\n\t\t\t[memb___id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]\n\t\t\t";
            // Z_Resellers
            $query[40] = "\n\t\t\tCREATE TABLE [dbo].[Z_PollAnswers](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[poll_id] [bigint] NOT NULL,\n\t\t\t[answer] [nvarchar](255) COLLATE Latin1_General_CI_AS NOT NULL,\n\t\t\tCONSTRAINT [PK_Z_PoolAnswers] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE TABLE [dbo].[Z_Polls](\n\t\t\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[question] [nvarchar](255) COLLATE Latin1_General_CI_AS NOT NULL,\n\t\t\t[creation_date] [datetime] NOT NULL CONSTRAINT [DF_Z_Pools_creation_date]  DEFAULT (getdate()),\n\t\t\t[expiration_date] [datetime] NOT NULL,\n\t\t\t[minAL] [tinyint] NOT NULL CONSTRAINT [DF_Z_Pools_minAL]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_Pools] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[id] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE TABLE [dbo].[Z_PollVotes](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[poll_id] [bigint] NOT NULL,\n\t\t\t[answer_id] [bigint] NOT NULL,\n\t\t\t[memb___id] [nvarchar](10) COLLATE Latin1_General_CI_AS NOT NULL,\n\t\t\t[ip] [nvarchar](15) COLLATE Latin1_General_CI_AS NULL,\n\t\t\tCONSTRAINT [PK_Z_PoolVotes] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]";
            //Poll system
            $query[41] = "\n\t\t\tCREATE TABLE [dbo].[Z_GuideDBCategories](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[name] [nvarchar](30) COLLATE Latin1_General_CI_AS NOT NULL,\n\t\t\t[orderN] [smallint] NOT NULL,\n\t\t\t[main_cat] [int] NOT NULL CONSTRAINT [DF_Z_GuideDBCategories_main_cat]  DEFAULT ((0)),\n\t\t\tCONSTRAINT [PK_Z_GuideDBCategories] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE TABLE [dbo].[Z_Guides](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[category] [bigint] NOT NULL,\n\t\t\t[title] [nvarchar](255) COLLATE Latin1_General_CI_AS NULL,\n\t\t\t[text] [text] COLLATE Latin1_General_CI_AS NULL,\n\t\t\tCONSTRAINT [PK_Z_Guides] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]\n\t\t\t";
            //GuideDB system
            $query[42] = "\n\t\t\tCREATE TABLE [dbo].[Z_Events](\n\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t[title] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL,\n\t\t\t[description] [nvarchar](255) COLLATE Latin1_General_CI_AS NULL,\n\t\t\t[by] [tinyint] NOT NULL,\n\t\t\t[type] [tinyint] NOT NULL CONSTRAINT [DF_Z_Events_type]  DEFAULT ((0)),\n\t\t\t[currency1] [int] NOT NULL CONSTRAINT [DF_Z_Events_currency1]  DEFAULT ((0)),\n\t\t\t[currency2] [int] NOT NULL CONSTRAINT [DF_Z_Events_currency2]  DEFAULT ((0)),\n\t\t\t[currency3] [int] NOT NULL CONSTRAINT [DF_Z_Events_currency3]  DEFAULT ((0)),\n\t\t\t[currency4] [int] NOT NULL CONSTRAINT [DF_Z_Events_currency4]  DEFAULT ((0)),\n\t\t\t[currency5] [int] NOT NULL CONSTRAINT [DF_Z_Events_currency5]  DEFAULT ((0)),\n\t\t\t[playerLimit] [smallint] NOT NULL CONSTRAINT [DF_Z_Events_limit]  DEFAULT ((0)),\n\t\t\t[AccountLevel] [tinyint] NOT NULL CONSTRAINT [DF_Z_Events_AccountLevel]  DEFAULT ((0)),\n\t\t\t[winQuantity] [tinyint] NOT NULL CONSTRAINT [DF_Z_Events_winAmount]  DEFAULT ((1)),\n\t\t\tCONSTRAINT [PK_Z_Events] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE TABLE [dbo].[Z_EventsSchedule](\n\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t[event] [int] NOT NULL,\n\t\t\t[type] [tinyint] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_type]  DEFAULT ((0)),\n\t\t\t[date_start] [datetime] NULL,\n\t\t\t[date_end] [datetime] NULL,\n\t\t\t[date] [datetime] NOT NULL,\n\t\t\t[winner] [nvarchar](10) COLLATE Latin1_General_CI_AS NULL,\n\t\t\t[by] [tinyint] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_by]  DEFAULT ((0)),\n\t\t\t[currency1] [int] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_currency1] DEFAULT ((0)),\n\t\t\t[currency2] [int] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_currency2] DEFAULT ((0)),\n\t\t\t[currency3] [int] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_currency3] DEFAULT ((0)),\n\t\t\t[currency4] [int] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_currency4] DEFAULT ((0)),\n\t\t\t[currency5] [int] NOT NULL CONSTRAINT [DF_Z_EventsSchedule_currency5] DEFAULT ((0)),\n\t\t\t[place] [nvarchar](50) NULL,\n\t\t\tCONSTRAINT [PK_Z_EventsSchedule] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]";
            // Events
            $query[43] = "\n\t\t\tCREATE TABLE [dbo].[Z_ResetTransferLog](\n\t\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[source] [varchar](10) NOT NULL,\n\t\t\t\t[destination] [varchar](10) NOT NULL,\n\t\t\t\t[resets] [int] NOT NULL,\n\t\t\t\t[totalTax] [int] NOT NULL,\n\t\t\t\t[date] [datetime] NOT NULL CONSTRAINT [DF_Z_ResetTransferLog_date] DEFAULT (getdate()),\n\t\t\t\t[ip] [varchar](15) NULL,\n\t\t\t CONSTRAINT [PK_Z_ResetTransferLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t";
            // Reset Tranfer Log
            $query[44] = "\n\t\t\tCREATE TABLE [dbo].[Z_VipItemData](\n\t\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t\t[serial] [nchar](8) NOT NULL,\n\t\t\t\t[item] [nchar](32) NOT NULL,\n\t\t\t\t[date] [datetime] NOT NULL,\n\t\t\t\t[deleted] [tinyint] NOT NULL,\n\t\t\t CONSTRAINT [PK_Z_VipItemData] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tALTER TABLE [dbo].[Z_VipItemData] ADD  CONSTRAINT [DF_Z_VipItemData_serial]  DEFAULT ((0)) FOR [serial]\n\t\t\tALTER TABLE [dbo].[Z_VipItemData] ADD  CONSTRAINT [DF_Z_VipItemData_date]  DEFAULT (getdate()) FOR [date]\n\t\t\tALTER TABLE [dbo].[Z_VipItemData] ADD  CONSTRAINT [DF_Z_VipItemData_deleted]  DEFAULT ((0)) FOR [deleted]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX IX_Z_VipItemData ON dbo.Z_VipItemData\n\t\t\t(\n\t\t\tdeleted\n\t\t\t) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX IX_Z_VipItemData_1 ON dbo.Z_VipItemData\n\t\t\t(\n\t\t\tmemb___id\n\t\t\t) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t";
            $query[45] = "\n\t\t\tCREATE TABLE [dbo].[Z_VipItemUsers](\n\t\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[status] [tinyint] NOT NULL,\n\t\t\t\t[due_date] [datetime] NULL,\n\t\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t CONSTRAINT [PK_Z_VipItemUsers] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tALTER TABLE [dbo].[Z_VipItemUsers] ADD  CONSTRAINT [DF_Z_VipItemUsers_status]  DEFAULT ((0)) FOR [status]\n\t\t\tALTER TABLE [dbo].[Z_VipItemUsers] ADD  CONSTRAINT [DF_Z_VipItemUsers_due_date]  DEFAULT (getdate()) FOR [due_date]\n\t\t\t\n\t\t\tCREATE NONCLUSTERED INDEX IX_Z_VipItemUsers ON dbo.Z_VipItemUsers\n\t\t\t(\n\t\t\tstatus\n\t\t\t) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t";
            $query[46] = "\n\t\t\tCREATE TABLE [dbo].[Z_GameCurrencies](\n\t\t\t\t[idx] [tinyint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[name] [nvarchar](50) NOT NULL,\n\t\t\t\t[database] [nvarchar](50) NOT NULL,\n\t\t\t\t[table] [nvarchar](50) NOT NULL,\n\t\t\t\t[column] [nvarchar](50) NOT NULL,\n\t\t\t\t[accountColumn] [nvarchar](12) NOT NULL,\n\t\t\t\t[onlyoff] [tinyint] NOT NULL,\n\t\t\t CONSTRAINT [PK_Z_GameCurrencies] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tALTER TABLE [dbo].[Z_GameCurrencies] ADD  CONSTRAINT [DF_Z_GameCurrencies_database]  DEFAULT (N'MuOnline') FOR [database]\n\t\t\tALTER TABLE [dbo].[Z_GameCurrencies] ADD  CONSTRAINT [DF_Z_GameCurrencies_accountColumn]  DEFAULT (N'memb___id') FOR [accountColumn]\n\t\t\tALTER TABLE [dbo].[Z_GameCurrencies] ADD  CONSTRAINT [DF_Z_GameCurrencies_status]  DEFAULT ((0)) FOR [onlyoff]\n\t\t\t";
            $query[47] = "\n\t\t\tCREATE TABLE [dbo].[Z_ChangeClassLog](\n\t\t\t\t[idx] [bigint] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t\t[char] [nvarchar](10) NOT NULL,\n\t\t\t\t[fromClass] [tinyint] NOT NULL,\n\t\t\t\t[toClass] [tinyint] NOT NULL,\n\t\t\t\t[date] [datetime] NOT NULL,\n\t\t\t CONSTRAINT [PK_Z_ChangeClassLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tALTER TABLE [dbo].[Z_ChangeClassLog] ADD  CONSTRAINT [DF_Z_ChangeClassLog_date]  DEFAULT (getdate()) FOR [date]\n\t\t\t";
            $query[48] = "\n\t\t\tCREATE TABLE [dbo].[Z_MasterResetLog](\n\t\t\t\t[idx] [int] IDENTITY(1,1) NOT NULL,\n\t\t\t\t[Name] [nvarchar](10) NOT NULL,\n\t\t\t\t[memb___id] [nvarchar](10) NOT NULL,\n\t\t\t\t[date] [datetime] NOT NULL,\n\t\t\t\t[ResetCount] [int] NOT NULL,\n\t\t\t\t[bonus] [int] NOT NULL,\n\t\t\t CONSTRAINT [PK_XW_MasterResetLog] PRIMARY KEY CLUSTERED \n\t\t\t(\n\t\t\t\t[idx] ASC\n\t\t\t)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]\n\t\t\t) ON [PRIMARY]\n\t\t\t\n\t\t\tALTER TABLE [dbo].[Z_MasterResetLog] ADD  CONSTRAINT [DF_XW_MasterResetLog_date]  DEFAULT (getdate()) FOR [date]\n";
            foreach ($query as $key => $theQuery) {
                if (!empty($theQuery)) {
                    if (!$db->Query($theQuery)) {
                        echo "<h3 align=\"center\" style=\"color:#FF0000\">Oh, master, I have got an error in the query #" . ($key + 1) . ".<br />\n\t\t\t\t\t\tPlease contact Ferrarezi support and report this error with the query number!</h3>";
                        echo $db->GetError();
                        return;
                    }
                }
            }
        }
        echo "<h1>YES!</h1>";
        echo "<h3>I've managed to install the Ferrarezi Web successfully!</h3>";
        echo "<h3>You can now configure and use your site fully!</h3>";
        echo "<h3>Thanks for your attention, master! See you next time! ;)</h3>";
        echo "<hr />";
        echo "<h2>You should configure now your Manager users.</h2>";
        echo "<h3>Your default credentials:<br />\n\t\t<span style=\"float:left; width:100px; text-align: right; color: #990000; margin-right: 5px;\">Login: </span> <span>admin</span><br />\n\t\t<span style=\"float:left; width:100px; text-align: right; color: #990000; margin-right: 5px;\">Password: </span> <span>admin</span></h3>";
        echo "<h3>To do your first login right now, <a href=\"Manager/\">click here!</a></h3>";
        @unlink("install.php");
        @unlink("installer.php");
        return;
    }
    ?>
	<br />
	<?php 
    if ($db->Query("SELECT 1")) {
        ?>
		<form action="?step=2" name="" method="post">
			<h2>Everything went well until now, master! It is just Great! \o/</h2>
			<h3>Now I'm about to start your Database configurarion.</h3>
			<?php 
        if ($db->Query("SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Z_BlockedUsers]') AND type in (N'U')")) {
            if ($db->NumRows() > 0) {
                ?>
				
				<h3 style="background-color:#FF0">Should I (re)create all the site database?</h3>
				<p>
					<input type="radio" name="dbCreate" value="1" />
					YES, (re)create all tables. (<strong style="color:#FF0000">You'll lose all the site data!</strong>)<br />
					<input name="dbCreate" type="radio" value="0" checked="checked" />
					NO, leave as it is. </p>
				<h3 style="color:#FF0000">Please, be careful! <u>This will empty your WHOLE site Database</u>, if it already exists!</h3><p>&nbsp;</p>
                <?php 
            } else {
                ?>
					<input type="hidden" name="dbCreate" value="1" />
					<?php 
            }
        }
        ?>
			<h3>Are you ready for that?</h3>
			<p align="center">
				<input name="submit" type="submit" id="submit" value="Rush!" />
			</p>
		</form>
		<?php 
    } else {
        ?>
		<h3>I'm sorry, but I could not connect to your database with the provided data.</h3>
		<h3>So, please, <a href="?step=1">go back</a> and try again, Master!</h3>
		<?php 
    }
}
Example #8
0
 function ViewTicket($ticketId)
 {
     //print_r($_SERVER);
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/HelpDesk.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/HelpDesk.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/GenericMessages.php";
     $db = $this->db;
     $db2 = new MuDatabase();
     $return = "";
     $db->Query("SELECT idx FROM Z_HelpDeskTickets WHERE idx = '{$ticketId}' AND memb___id = '" . $this->acc->memb___id . "'");
     if ($db->NumRows() <= 0) {
         return $GenericMessage03;
     }
     $db->Query("SELECT * FROM Z_HelpDeskMessages WHERE ticket_idx = '{$ticketId}' ORDER BY date");
     $return .= "<p class=\"HelpDeskBackLink\"><a href='?c=HelpDesk/'>{$HelpDeskMessage14}</a></p>";
     $return .= "<p class=\"HelpDeskViewTitle\">{$HelpDeskMessage12}" . $ticketId . "</p>";
     $return .= "<table class=\"HelpDeskMessagesTable\">";
     $numrows = $db->NumRows();
     for ($i = 0; $i < $numrows; $i++) {
         $data = $db->GetRow();
         if ($data['by'] == $this->acc->memb___id) {
             $trClass = "HelpDeskUserMessage";
         } else {
             $trClass = "HelpDeskSupporterMessage";
         }
         $db2->Query("SELECT * FROM Z_HelpDeskAttach WHERE msg_idx = '" . $data['idx'] . "'");
         $attachsNum = $db2->NumRows();
         $attachs = "";
         if ($attachsNum > 0) {
             $attachs = "<p><span style=\"float: right\">{$HelpDeskMessage25}<br />";
             for ($j = 0; $j < $attachsNum; $j++) {
                 $attachData = $db2->GetRow();
                 $attachs .= "<a href=\"/" . $_SESSION['SiteFolder'] . "{$HelpDeskUploadDir}/" . $attachData['file'] . "\" target=\"_blank\">[" . $attachData['orig_name'] . "]</a> ";
             }
             $attachs .= "</span></p>";
         }
         $return .= "\n\t\t\t<tr align=\"left\" class=\"{$trClass}\">\n\t\t\t  <td valign=\"top\" class=\"HelpDeskUserTd\" nowrap=\"nowrap\">" . $data['by'] . "<br />" . $this->theDate->DateFormat($data['date']) . "<br />" . $this->theDate->TimeFormat($data['date'], "h") . "</td>\n\t\t\t  <td valign=\"top\" class=\"HelpDeskMessageTd\">" . $data['message'] . "{$attachs}</td>\n\t\t\t</tr>";
     }
     $return .= "</table>";
     $db2->Disconnect();
     $db->Query("SELECT status FROM Z_HelpDeskTickets WHERE idx = '{$ticketId}'");
     $ticketStatus = $db->GetRow();
     if ($ticketStatus[0] > 1) {
         $return .= "<p style=\"font-weight:bold\">{$HelpDeskMessage16}</p>";
     } else {
         if ($this->GetBlockStatus($this->acc->memb___id) == 1) {
             $return .= $HelpDeskMessage07;
         } else {
             $return .= "<p align=\"left\" class=\"HelpDeskGenericTitle\">{$HelpDeskMessage15}</p>";
             $return .= "<form action=\"?c=HelpDesk/{$ticketId}\" method=\"post\" name=\"HelpDeskPost\" enctype=\"multipart/form-data\">";
             $return .= "<textarea class=\"HelpDeskMessageBox\" name=\"message\" id=\"message\"></textarea>";
             $return .= "<p align=\"left\">{$HelpDeskMessage17}</p>";
             for ($i = 0; $i < $HelpDeskMaxFiles; $i++) {
                 $return .= "<input name=\"file[]\" type=\"file\" class=\"HelpDeskFileBox\"><br />";
             }
             $return .= "<br /><p><input name=\"submitCall\" type=\"submit\" class=\"HelpDeskSubmitButton\" id=\"submitCall\" value=\"{$HelpDeskMessage18}\"></p>";
             $return .= "</form>";
         }
     }
     $return .= "<p>&nbsp;</p><p align=\"center\"><a href='?c=HelpDesk/'>{$HelpDeskMessage14}</a></p>";
     return $return;
 }
Example #9
0
    require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
    $acc = new Account($db);
    $db->Query("SELECT cLevel, {$SQLResetsColumn} FROM Character WHERE Name = '{$Name}'");
    $data = $db->GetRow();
    if ($Termos == 'resets') {
        return $data['ResetCount'];
    }
    if ($Termos == 'level') {
        return $data['cLevel'];
    }
    if ($Termos == 'status') {
        return in_array($Name, $acc->GetConnectedCharacters($db)) ? 'ON' : 'OFF';
    }
}
$db->Query("SELECT * FROM Guild WHERE G_Name = '{$guild}'");
$NumRows = $db->NumRows();
$data = $db->GetRow();
if ($NumRows <= 0) {
    $error = "<tr><td colspan='6'><div class='alert alert-danger' style='margin:0px;'>A Guild <b>{$guild}</b> não foi encontrada no banco de dados...</div></td></tr>";
    $Guild = "{$guild}";
    $GuildInfo = "";
    $logo = "";
    $G_Member = "-";
    $G_Notice = "-";
    $G_Score = "-";
    $G_Master = "-";
} else {
    $error = "";
    $Guild = "{$guild}";
    $logo = $gd->PrintGuildMark(bin2hex($data['G_Mark']), 150);
    $G_Master = $data['G_Master'];
Example #10
0
 function ShowItemDetails($item, $class = "ItemDescription")
 {
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/WebShop.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/Itens.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/ClassNames.php";
     $this->AnalyseItemByHex($item);
     $return = "<div class=\"{$class}\" onclick=\"ItemDescriptionClick('{$item}')\" onmouseout=\"ItemDescriptionMouseOut('{$item}')\" onmouseover=\"ItemDescriptionMouseOver('{$item}')\" id=\"" . $item . "_desc\" >";
     //Defense
     if ($this->Defense > 0) {
         $this->DefenseCalc();
         $this->ExcellentItem > 0 && $this->ItemType != 12 ? $complement = "Excellent" : ($complement = "");
         $return .= "<span class=\"ItemDefense{$complement}\">" . $ItensMsg004 . (int) $this->Defense . "</span><br />";
     }
     //Wings Damage % and Defense %
     $ArrayWings1 = array(0, 1, 2, 41, 49);
     $ArrayWings2 = array(3, 4, 5, 6, 42);
     $ArrayWings3 = array(36, 37, 38, 39, 40, 43, 50);
     $ArrayWings4 = array(200, 201, 202, 203, 204, 205);
     $ArrayWings5 = array(206, 207, 208, 209, 210, 211);
     $ArrayWings6 = array(263, 264, 265, 266, 267);
     if ($this->ItemType == 12 && (in_array($this->ItemId, $ArrayWings1) || in_array($this->ItemId, $ArrayWings2) || in_array($this->ItemId, $ArrayWings3) || in_array($this->ItemId, $ArrayWings4) || in_array($this->ItemId, $ArrayWings5) || in_array($this->ItemId, $ArrayWings6)) || $this->ItemType == 13 && $this->ItemId == 30) {
         $this->WingPercentsCalc($return, $ArrayWings1, $ArrayWings2, $ArrayWings3, $ArrayWings4, $ArrayWings5, $ArrayWings6);
     }
     //Damage
     if ($this->DmgMax > 0) {
         $complement = "";
         $this->DamageCalc($complement);
         if ($this->X == 1) {
             $return .= "<span class=\"ItemDamage{$complement}\">" . $ItensMsg054 . $this->DmgMin . " ~ " . $this->DmgMax . "</span><br />";
         } else {
             $return .= "<span class=\"ItemDamage{$complement}\">" . $ItensMsg055 . $this->DmgMin . " ~ " . $this->DmgMax . "</span><br />";
         }
     }
     //AttackSpeed
     if ($this->AttackSpeed > 0) {
         $return .= "<span class=\"ItemAttackSpeed\">" . $ItensMsg056 . $this->AttackSpeed . "</span><br />";
     }
     //Custom Description
     if ($this->ItemType >= 12) {
         $this->GetCustomItemDescription($return);
     }
     //Durability
     if ($this->Durability > 0 && $this->DurabilityItem != "XX") {
         $this->DurabilityCalc();
         $return .= "<span class=\"ItemDurability\">" . $ItensMsg005 . "[" . (int) $this->DurabilityItem . "/" . (int) $this->Durability . "]</span><br />";
     }
     //Nature Attributes
     if ($this->Ice > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg062 . ": " . ($this->Ice + $this->LevelItem) . "</span><br />";
     }
     if ($this->Poison > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg063 . ": " . ($this->Poison + $this->LevelItem) . "</span><br />";
     }
     if ($this->Lightning > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg064 . ": " . ($this->Lightning + $this->LevelItem) . "</span><br />";
     }
     if ($this->Fire > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg065 . ": " . ($this->Fire + $this->LevelItem) . "</span><br />";
     }
     if ($this->Earth > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg066 . ": " . ($this->Earth + $this->LevelItem) . "</span><br />";
     }
     if ($this->Wind > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg067 . ": " . ($this->Wind + $this->LevelItem) . "</span><br />";
     }
     if ($this->Water > 0) {
         $return .= "<span class=\"ItemResistance\">" . $ItensMsg069 . $ItensMsg068 . ": " . ($this->Water + $this->LevelItem) . "</span><br />";
     }
     //Level Requirimets
     if ($this->ReqLevel > 0) {
         $this->RequiredLevelCalc();
         $return .= "<span class=\"ItemLevelrequire_oncement\">{$ItensMsg061}{$this->ReqLevelItem}</span><br />";
     }
     //Stats require_oncements
     if ($this->ReqStr > 0 || $this->ReqAgi > 0 || $this->ReqVit > 0 || $this->ReqEne > 0 || $this->ReqCom > 0) {
         $this->StatsRequirementCalc($return);
     }
     //Class require_oncements
     $this->ClassRequirementsCalc($return);
     if ($this->AncientItem != 0) {
         $this->AncientOptions($return);
     }
     //Magic Power %
     if ($this->MagicPwr > 0) {
         $this->MagicPwrCalc();
         $return .= "<p><span class=\"ItemMagicPower\">{$ItensMsg070}{$this->MagicPwr}%{$ItensMsg071}</span></p>";
     }
     //380 Option
     if ($this->Option380Item != 0) {
         $this->Option380Calc();
         $return .= "<p><span class=\"Item380Option\">{$this->Option380ItemName}</span></p>";
     }
     //Harmony
     if ($this->HarmonyItem != "00") {
         $this->HarmonyCalc();
         $return .= "<p><span class=\"ItemHarmony\">{$this->HarmonyItemName}</span></p>";
     }
     //Skill
     if ($this->SkillItem != 0) {
         $this->GetSkillName($this->Skill);
         $return .= "<span class=\"ItemSkill\">" . $ItensMsg057 . $this->SkillItem . "</span><br />";
     }
     //Luck
     if ($this->LuckItem == 1) {
         $return .= "<span class=\"ItemLuck\">{$ItensMsg012}</span><br />";
     }
     //Add Option
     if ($this->AddOptionItem > 0) {
         $output = "";
         $this->AddOptionCalc($output);
         $return .= "<span class=\"ItemAddOption\">{$output}</span><br />";
     }
     //Excellent Options
     if ($this->ExcellentItem > 0) {
         $output = "";
         $this->ExcellentOptionsCalc($output);
         $return .= "<span class=\"ItemExcellentOptions\">{$output}</span>";
     }
     //Socket
     if ($this->ItemType <= 11 && $this->SocketItem != "0000000000" && $this->SocketItem != "FFFFFFFFFF") {
         $this->SocketCalc();
         $return .= $this->SocketItemName;
     }
     if ($this->Serial != "XXXXXXXX") {
         if (isset($WebShopShowItemSerial) && $WebShopShowItemSerial === true) {
             $return .= "<br /><span>Serial: " . $this->Serial . "<br />";
         }
         if (isset($WebShopShowItemBuyier) && $WebShopShowItemBuyier === true || isset($WebShopShowSecuredItem) && $WebShopShowSecuredItem === true) {
             require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
             $db = new MuDatabase();
             $db->Query("SELECT memb___id,status,insurance FROM Z_WebShopLog WHERE serial = '" . $this->Serial . "'");
             if ($db->NumRows() > 0) {
                 $dado = $db->GetRow();
                 if (isset($WebShopShowItemBuyier) && $WebShopShowItemBuyier === true) {
                     if ($dado[1] == "1") {
                         $return .= "{$ItensMsg093}" . $dado[0] . "<br />";
                     } else {
                         $return .= "{$ItensMsg094}<br />";
                     }
                 }
                 if (isset($WebShopShowSecuredItem) && $WebShopShowSecuredItem === true) {
                     if ($dado[2] == 1) {
                         $return .= "{$ItensMsg095}<br />";
                     }
                 }
             }
         }
         $return .= "</span>";
         if (isset($WebShopShowNOTradeItem) && $WebShopShowNOTradeItem === true) {
             if ($this->SecuredItem == 8) {
                 $return .= "<span class=\"ItemNOTrade\">{$ItensMsg096}</span>";
             }
         }
     }
     $return .= "<br /></div>";
     return $return;
 }
Example #11
0
            <table class="table table-bordered table-condensed table-hover table-striped">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Login</th>
                        <th>Destino</th>
                        <th>Valor</th>
                        <th>Moeda</th>
                        <th>Data</th>
                        <th>IP</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
$db->Query("SELECT TOP 10 * FROM Z_TransferLog ORDER BY date DESC");
$ADMResult = $db->NumRows();
if ($ADMResult > 0) {
    for ($i = 0; $i < $ADMResult; $i++) {
        $ADMData = $db->GetRow();
        $NewTypeName = getCurrency($ADMData['type_dest']);
        $i + 1;
        echo "<tr align=\"center\">";
        echo "<td> {$i} </td>";
        echo "<td> {$ADMData['memb___id']} </td>";
        echo "<td> {$ADMData['memb___id_dest']} </td>";
        echo "<td> {$ADMData['value_dest']} </td>";
        echo "<td> {$NewTypeName} </td>";
        echo "<td> " . date('d/m/Y H:i:s', strtotime($ADMData['date'])) . " </td>";
        echo "<td> {$ADMData['ip']} </td>";
        echo "</tr>";
    }