Changeset 14 for guildy.php


Ignore:
Timestamp:
Aug 12, 2007, 2:13:09 AM (17 years ago)
Author:
george
Message:
  • Aktuality na webu byly přesunuty z textového PHP souboru do tabulky news v databázi wow. Za zobrazování aktualit je odpovědný soubor news.php. Nová SQL tabulka je uložena ve složce sql jako 14-news.sql.
  • Opravena struktura a HTML validita hlavních stránek.
  • Přidán společný skript database.php pro připojování k MySQL databázi. Databáze je inicializována vždy při načítání skriptu global.php. Změněno připojování k databázi na tento systém v několika skriptech.
  • Změna struktury souboru config.php.
  • Promazání nepotřebných souborů.
  • Vytvoření souboru config.sample.php v podsložce scripts minimanageru. Soubor config.php nadále není verzován a je nutné ho vytvořit jako kopii souboru config.sample.php a nastavit potřebné parametry. Uchovány musí být pouze soubory bez hesel nebo s implicitními hesly.
  • Byl přidán skript pro obsluhu chyb error.php.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • guildy.php

    r11 r14  
    11<?
    22  include('global.php');
    3   $Charset = 'iso-8859-2';
     3  $Database->select_db('mangos');
    44  ShowHeader();
    55 
     
    88<TD valign="top">
    99<div class="DivText">');
    10 
    11 include('test/db.php');
    12 DB_Init($DatabaseHost, $DatabaseUser, $DatabasePassword, 'mangos');
    13 DB_Query('SET NAMES latin2');
    1410
    1511$RanksEN = array('Guildmaster', 'Veteran', 'Intendant', 'Support Officer', 'PR Officer', 'Officer', 'Famed Member',
     
    2218  echo('<table class="TableGuilda" style="align: center;" border="1" cellpadding="3" cellspacing="0" ><tr><th>Název</th><th>Poèet èlenù</th><th>Souèet levelù</th><th>Souèet bodù cti</th><th>Webové stránky</th></tr>');
    2319//  DB_Query(' COUNT(guild_member.guildid) as member_count FROM guild JOIN guild_member ON guild_member.guildid = guild.guildid GROUP BY guild.name ORDER BY member_count DESC');
    24   DB_Query('SELECT `guild`.name, guild.guildid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` GROUP BY guild.name ORDER BY guild.name');
    25   while($Guild = DB_Row())
     20  $Result = $Database->query('SELECT `guild`.name, guild.guildid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` GROUP BY guild.name ORDER BY guild.name');
     21  while($Guild = $Result->fetch_array())
    2622  {
    2723    echo('<tr><td><a href="?guild='.$Guild['guildid'].'">'.$Guild['name'].'</a></td><td>'.$Guild['member_count'].'</td><td>'.$Guild['guild_level'].'</td><td>'.$Guild['guild_honor'].'</td><td>&nbsp;</td></tr>');
     
    3026} else {
    3127  $_GET['guild'] = addslashes($_GET['guild']);
    32   DB_Query('SELECT `guild`.name, guild.guildid, guild.leaderguid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` WHERE guild.guildid='.$_GET['guild'].' GROUP BY guild.name');
    33   if(DB_NumRows() > 0)
     28  $Result = $Database->query('SELECT `guild`.name, guild.guildid, guild.leaderguid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` WHERE guild.guildid='.$_GET['guild'].' GROUP BY guild.name');
     29  if($Result->num_rows > 0)
    3430  {
    35     $Guild = DB_Row();
     31    $Guild = $Result->fetch_array();
    3632    //  if($Guild['homepage'] != '') $Guild['name'] = $Guild['name'].' <a href="'.$Guild['homepage'].'">WWW</a>';
    3733    //if($Guild['info'] != '') $Guild['info'] = ''.$Guild['info'].'</i>';
    3834    echo('<div align="center"><strong>Seznam èlenù guildy '.$Guild['name'].'</strong><br>');
    39     DB_Select('`character`', 'name', $Guild['leaderguid'].'=guid');
    40     $GuildMaster = DB_Row();
     35    $Result = $Database->select('character', 'name', $Guild['leaderguid'].'=guid');
     36    $GuildMaster = $Result->fetch_array();
    4137    echo('Vedoucí guildy: '.$GuildMaster['name'].'<br>');
    4238    echo('<table class="TableGuilda" border="1" cellpadding="1" cellspacing="0">');
     
    4541   
    4642    $GuildRanks = array();
    47     DB_Select('guild_rank', '*', 'guildid='.$Guild['guildid']);
    48     while($GuildRank = DB_Row()) $GuildRanks[$GuildRank['rid']] = $GuildRank;
     43    $Result = $Database->select('guild_rank', '*', 'guildid='.$Guild['guildid']);
     44    while($GuildRank = $Result->fetch_array()) $GuildRanks[$GuildRank['rid']] = $GuildRank;
    4945 
    50     DB_Query('SELECT guild_member.rank, guild_member.guid, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 35), " ", -1)*1 as level, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 1421), " ", -1)*1 as honor, character.name FROM guild_member JOIN `character` ON guild_member.guid = character.guid AND guild_member.guildid='.$Guild['guildid'].' ORDER BY character.name');
    51     while($Member = DB_Row())
     46    $Result = $Database->query('SELECT guild_member.rank, guild_member.guid, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 35), " ", -1)*1 as level, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 1421), " ", -1)*1 as honor, character.name FROM guild_member JOIN `character` ON guild_member.guid = character.guid AND guild_member.guildid='.$Guild['guildid'].' ORDER BY character.name');
     47    while($Member = $Result->fetch_array())
    5248    {
    5349//    $DataParts = explode(' ', $Member['data']);
Note: See TracChangeset for help on using the changeset viewer.