Changeset 92 for db/post_read.php


Ignore:
Timestamp:
Sep 30, 2007, 6:34:12 PM (17 years ago)
Author:
hosiplan
Message:

Překopávka výpisu menu, teď se vypisuje pomocí funkce ze souboru menu.php
Vytvořem bug report. Bohužel zatím nemá spam ochranu.
Když se ozvou nějací roboti, tak není problém přidat.
Taky byl přidán soubor generovani_klicu.php,
kterým se dají vytvořit klíče proti spam ochraně...
Sice si teď uveědomuji že je zatím zbytečný, ale to už je jedno.

Taky byl přidána možnost jazykového rozlišení,
teprve jsem začal přepisovat texty do proměnných,
takže to dokončím příšetě

Location:
db
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • db

    • Property svn:ignore set to
      config.php
  • db/post_read.php

    r89 r92  
    77if( !empty($q) AND !empty($id) ){
    88  if( !empty($lvl_d) AND !empty($lvl_h) ){ $where = "(`MinLevel`>='$lvl_d' AND `MinLevel`<='$lvl_h') AND "; };
    9   $sql_select = SQLselect_Strankovani("SELECT * FROM quest_template WHERE ( $where`Title` LIKE '%$q%' )", $limit, 20, "?id=questy&amp;q=".$q."&amp;lvl_d=".$lvl_d."&amp;lvl_h=".$lvl_h, $SID, $DB_mangos);
     9  $sql_select = SQLselect_Strankovani("SELECT * FROM quest_template WHERE ( $where`Title` LIKE '%$q%' )", $limit, 20, "?id=questy&amp;q=".$q."&amp;lvl_d=".$lvl_d."&amp;lvl_h=".$lvl_h, $SID);
    1010  if( @mysql_num_rows($sql_select[1]) > 0 ){ $i = 0;
    1111    $sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
     
    1818      $sql_select['result'] .= "<td>";
    1919
    20         $startovni_creature_dotaz = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$result['entry']." ",$DB_mangos);
     20        $startovni_creature_dotaz = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$result['entry']." ");
    2121        while( $start_creature = @MySQL_Fetch_Array($startovni_creature_dotaz) ){
    2222          $sql_select['result'] .= "<a href=\"index.php?creature=".$start_creature['entry']."\">".$start_creature['name']."</a><br>";
    2323          };
    24         $startovni_gameobject_dotaz = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$result['entry']." ",$DB_mangos);
     24        $startovni_gameobject_dotaz = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$result['entry']." ");
    2525        while( $start_gameobject = @MySQL_Fetch_Array($startovni_gameobject_dotaz) ){
    2626          $sql_select['result'] .= "<a href=\"index.php?gameobject=".$start_gameobject['entry']."\">".$start_gameobject['name']."</a><br>";
     
    3333   
    3434    $sql_select['result'] .= "</table>\n";
    35     };
     35    }  else{ $sql_select['error'] = "<p>Nebyly nalezeny žádné questy.</p>"; };
    3636 
    3737  }
    3838elseif( !empty($quest) AND empty($id) ){
    39   $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='$quest' LIMIT 1;",$DB_mangos);
     39  $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='$quest' LIMIT 1;");
    4040  if( @mysql_num_rows($sql_select['sql']) > 0 ){ $i = 0;
    4141    $result = MySQL_Fetch_Array($sql_select['sql']);
     
    4343
    4444    // Zjištění creatur a gameobjectů kde se Quest dá vzít
    45     $startovni_NPC_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$sql_select['quest']['entry']." ",$DB_mangos);
     45    $startovni_NPC_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$sql_select['quest']['entry']." ");
    4646      if( @mysql_num_rows($startovni_NPC_dotaz_creature) > 0 ){
    4747        while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_creature)){
    4848        $sql_select['other']['StartNPC'] .= "<a href=\"index.php?creature=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n";
    4949        }; };
    50     $startovni_NPC_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$sql_select['quest']['entry']." ",$DB_mangos);
     50    $startovni_NPC_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$sql_select['quest']['entry']." ");
    5151      if( @mysql_num_rows($startovni_NPC_dotaz_gameobject) > 0 ){
    5252        while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_gameobject)){
     
    5454        }; };
    5555    if( empty($sql_select['other']['StartNPC']) ){
    56       $sql_select['other']['StartNPC'] = "<b>Úkol není kde začít!<br> Nahlaste to prosím adminovy!</b>"; }
     56      $sql_select['other']['StartNPC'] = "<b>Úkol není kde začít!</b>"; }
    5757
    5858    // Zjištění Oblasti
     
    6161
    6262    // Důležitá věc
    63     $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$sql_select['quest']['SrcItemId']." LIMIT 1;",$DB_mangos);
     63    $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$sql_select['quest']['SrcItemId']." LIMIT 1;");
    6464    if( @mysql_num_rows($SrcItemId_dotaz) > 0 ){
    6565        $SrcItemId = @MySQL_Fetch_Array($SrcItemId_dotaz);
     
    107107  }
    108108elseif( !empty($creature) AND empty($id) ){
    109   $sql_select['sql'] = mysql_query("SELECT * FROM creature_template WHERE `entry`='$creature' LIMIT 1;",$DB_mangos);
     109  $sql_select['sql'] = mysql_query("SELECT * FROM creature_template WHERE `entry`='$creature' LIMIT 1;");
    110110  if( @mysql_num_rows($sql_select['sql']) > 0 ){ $i = 0;
    111111    $result = MySQL_Fetch_Array($sql_select['sql']);
    112112    $sql_select['creature'] = $result;
    113113
    114     $questy_dotaz_creature = mysql_query("SELECT * FROM `creature_questrelation` LEFT JOIN `quest_template` ON `creature_questrelation`.`quest` = `quest_template`.`entry` WHERE (`creature_questrelation`.`id` =".$sql_select['creature']['entry']." AND `quest_template`.`PrevQuestId`=0 ) ",$DB_mangos);
     114    $questy_dotaz_creature = mysql_query("SELECT * FROM `creature_questrelation` LEFT JOIN `quest_template` ON `creature_questrelation`.`quest` = `quest_template`.`entry` WHERE (`creature_questrelation`.`id` =".$sql_select['creature']['entry']." AND `quest_template`.`PrevQuestId`=0 ) ");
    115115      if( @mysql_num_rows($questy_dotaz_creature) > 0 ){
    116116        while($quest_NPC = @MySQL_Fetch_Array($questy_dotaz_creature)){
     
    119119
    120120    } else{ $sql_select['error'] = "<p>Creep nebyl nalezen.</p>"; };
     121 
     122  }
     123elseif( $id == "bugreport" AND empty($bug) ){
     124  $DB_web = mysql_select_db($Config['DB_read']['DB_read']['Database_web']);
     125    if( !$DB_web ){ DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); };
     126
     127  $sql_select = SQLselect_Strankovani("SELECT * FROM `bug_report` ORDER BY `opraveno` ASC, `vlozeno` DESC", $limit, 20, "?id=bugreport", $SID);
     128  if( @mysql_num_rows($sql_select[1]) > 0 ){ $i = 0;
     129    $sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
     130    $sql_select['result'] .= "<thead><tr><td>Vloženo</td><td>Chyba</td><td align='right'>Status</td></tr></thead>\n<col width=\"120px\"><col><col width=\"60px\">";
     131
     132    while( $result = MySQL_Fetch_Array($sql_select[1]) ){
     133      $sql_select['result'] .= "<tr><td valign='top'>";
     134      $sql_select['result'] .= "<a href=\"./index.php?id=bugreport&amp;bug=".$result['id']."\">".@date("d.m.Y H:i", $result['vlozeno'])."</a>";
     135      $sql_select['result'] .= "</td><td valign='top'>";
     136      $sql_select['result'] .= nl2br(htmlentities($result['popis']));
     137      $sql_select['result'] .= "</td><td valign='top' align='right'>";
     138      if( $result['opraveno'] == 0 ){
     139        $sql_select['result'] .= "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; }
     140      elseif( $result['opraveno'] == 1 ){
     141        $sql_select['result'] .= "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; }
     142      $sql_select['result'] .= "</td></tr>\n";
     143      };
     144
     145    $sql_select['result'] .= "</table>\n";
     146
     147    } else{ $sql_select['error'] .= "<p>V databázi nejsou záznamy o chybách.</p>"; };
     148
     149  }
     150elseif( $id == "bugreport" AND !empty($bug) ){
     151  $DB_web = mysql_select_db($Config['DB_read']['DB_read']['Database_web']);
     152    if( !$DB_web ){ DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); };
     153
     154  $sql_select['sql'] = mysql_query("SELECT * FROM `bug_report` WHERE id=$bug LIMIT 1");
     155  if( @mysql_num_rows($sql_select['sql']) > 0 ){
     156    $result = MySQL_Fetch_Array($sql_select['sql']);
     157      $sql_select['bug'] = $result;
     158      if( empty($sql_select['bug']['opravil_nick']) ){
     159        $sql_select['bug']['opravil_nick'] = "Zatím nikdo"; };
     160      if( $sql_select['bug']['opraveno'] == 0 ){
     161        $sql_select['bug']['opraveno'] = "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Čeká na vyřízení"; }
     162      elseif( $sql_select['bug']['opraveno'] == 1 ){
     163        $sql_select['bug']['opraveno'] = "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Opraveno"; }
     164    } else{ $sql_select['error'] = "<p>V databázi není záznam s touto chybou.</p>"; };
     165
     166  }
     167elseif( $id == "sendbug" ANd isset($_POST['send']) ){
     168  $DB_web = mysql_select_db($Config['DB_read']['DB_read']['Database_web']);
     169    if( !$DB_web ){ DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); };
     170
     171  $sql_insert['sql'] = "INSERT INTO `bug_report` (`nick`,`typ`,`vlozeno`,`popis`) VALUES('".$_POST['game_nick']."','".$_POST['err_type']."','".time()."','".$_POST['popis']."')";
     172  if( mysql_query($sql_insert['sql']) ){
     173    $sql_insert['result'] = "<p>Bug byl uložen do databáze.</p>";
     174    }
     175  else{ $sql_insert['result'] = "<p>Bug se nepodařilo uložit do databáze.<br>Zkuste to později znovu prosím.</p>"; };
    121176 
    122177  };
Note: See TracChangeset for help on using the changeset viewer.