Changeset 49 for trunk/dictionary.php


Ignore:
Timestamp:
Jan 30, 2009, 10:33:08 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Přepracován systém pro více skupin překladů. Původně přes samostatné php soubory, nyní dynamicky dle tabulek group a group_item.
  • Přidáno: Doplněna podpora skupin překladů item, creature, gameobject, mangos_string, mangos_command.
  • Opraveno: Export dat nyní bez výběru konkrétních sloupců s plným výběrem exportu překladových skupin. Přepracované extporotvané příkazy a forma dat.
  • Upraveno: Styl stránek částečně oddělen do souboru style.css. Podobně javascripty přesouvat do global.js.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      SqlTranslate.zip
  • trunk/dictionary.php

    r43 r49  
    22
    33session_start();
     4
     5// SQL injection hack protection
     6foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
     7foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     8
    49include('includes/config.php');
    510include('includes/databaseconection.php');
     
    1015$Database->SelectDatabase($Config['Database']['Database']);   
    1116
    12 
    13   function Licence($Licence)
    14   { // BEGIN function Licence
    15     global $Database;
    16     if (isset($_SESSION['User']) and $_SESSION['User'] <> '') {
    17       $User = $_SESSION['User'];
    18       $Pass = $_SESSION['Pass'];
     17function Licence($Licence)
     18{
     19  global $Database;
     20 
     21  if (isset($_SESSION['User']) and $_SESSION['User'] <> '')
     22  {
     23    $User = $_SESSION['User'];
     24    $Pass = $_SESSION['Pass'];
    1925   
    2026    $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE LOWER(user) = LOWER('$User')"));
    21     if (!$Line) {
     27    if (!$Line)
     28        {
    2229       return false;
    2330    } else {
     
    4148      //  die('Nemáte zde přístup, přihla‘te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
    4249    }
    43        
    44   } // END function Licence
     50}
    4551
    46 
    47 
    48 
    49 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     52echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    5053<HTML>
    5154<HEAD>
     
    5659  <TITLE>Projekt překládání textů do WoW</TITLE>
    5760</HEAD> 
    58   <body>
     61  <body>');
    5962 
    60   ';
    61  
    62   if (array_key_exists('insert', $_GET)) {
    63     echo '<form action="dictionary.php" method="post">
     63if(array_key_exists('insert', $_GET))
     64{
     65  echo('<form action="dictionary.php" method="post">
    6466          <input type="text" name="AJWord"> Anglické slovo<br>
    6567          <input type="text" name="CZWord"> České slovo<br>
    6668          <input type="text" name="description">  Popis<br>
    6769          <input type="submit" value="Uložit">
    68           </form>
    69           ';   
    70     $WinWidth = 230;
    71   } else  {
    72     $WinWidth = 345;
    73     if (array_key_exists('AJWord', $_POST)) {
    74       $AJWord = $_POST['AJWord'];
    75       $CZWord = $_POST['CZWord'];
    76       $description = $_POST['description'];
    77       $user = @$_SESSION['UserID'];
    78       $Database->SQLCommand("INSERT INTO `dictionary` ( `AJWord` , `CZWord` , `description` , `user` )
    79                               VALUES ('$AJWord', '$CZWord', '$description', '$user');");
    80       echo 'Záznam byl uložen!';
    81       $WinWidth = 325;
    82     }   
    83   }
     70          </form>');   
     71  $WinWidth = 230;
     72} else 
     73{
     74  $WinWidth = 345;
     75  if (array_key_exists('AJWord', $_POST))
     76  {
     77    $AJWord = $_POST['AJWord'];
     78    $CZWord = $_POST['CZWord'];
     79    $description = $_POST['description'];
     80    $user = @$_SESSION['UserID'];
     81    $Database->SQLCommand("INSERT INTO `dictionary` ( `AJWord` , `CZWord` , `description` , `user` ) VALUES ('$AJWord', '$CZWord', '$description', '$user');");
     82    echo('Záznam byl uložen!');
     83    $WinWidth = 325;
     84  }   
     85}
    8486
     87echo('<table border="1" width="100%">');
     88 
     89if(array_key_exists('search', $_GET))
     90{
     91  $Search = $_GET['search'];
     92} else
     93{
     94  $Search = '';
     95}
     96       
     97echo('<tr><td><form action="dictionary.php" method="get">
     98  <input type="text" value="'.$Search.'" name="search" size="30">
     99  <input type="submit" value="Vyhledat">');
     100if(Licence(0))
     101  echo(' <a href="dictionary.php?insert">Vložit slovo</a>');
     102           
     103echo('</form></td></tr>');
     104echo('<tr><td>
     105<p style="  overflow: auto;  width: 100%; height: '.$WinWidth.'px;">');
     106//todo select   
     107if($Search <> '')
     108{
     109  $sql = "SELECT * FROM `dictionary` WHERE LOWER(AJWord) LIKE LOWER('%$Search%') OR LOWER(CZWord) LIKE LOWER('%$Search%') OR LOWER(description) LIKE LOWER('%$Search%')";
     110} else
     111{
     112  $sql = "SELECT * FROM `dictionary`";
     113}
     114echo('<table border="1" cellpadding="2" cellspacing="0" width="100%">
     115  <tr><th>Eng</th>
     116  <th>Cze</th>
     117  <th>  Popis</th></tr>');
     118$ID = $Database->SQLCommand($sql);
     119while ($Line = mysql_fetch_array($ID))
     120{
     121  echo('<tr>
     122  <td>'.$Line['AJWord'].'</td>
     123  <th>'.$Line['CZWord'].'</th>
     124  <td>'.$Line['description'].'</td></tr>');
     125}
     126echo('</table>'); 
    85127
    86   echo '<table border="1" width="100%">';
    87  
    88   if (array_key_exists('search', $_GET)) {
    89     $Search = $_GET['search'];
    90   } else {
    91     $Search = '';
    92   }
    93  
    94          
    95     echo '<tr><td><form action="dictionary.php" method="get">
    96           <input type="text" value="'.$Search.'" name="search" size="30">
    97           <input type="submit" value="Vyhledat">';
    98     if (Licence(0))
    99      echo ' <a href="dictionary.php?insert">Vložit slovo</a>';
    100            
    101     echo '</form></td></tr>';
    102     echo '<tr><td>
    103     <p style="  overflow: auto;  width: 100%; height: '.$WinWidth.'px;">';
    104     //todo select   
    105     if ($Search <> '') {
    106       $sql = "SELECT * FROM `dictionary` WHERE LOWER(AJWord) LIKE LOWER('%$Search%') OR LOWER(CZWord) LIKE LOWER('%$Search%') OR LOWER(description) LIKE LOWER('%$Search%')";
    107     } else {
    108       $sql = "SELECT * FROM `dictionary`";
    109     }
    110         echo '<table border="1" cellpadding="2" cellspacing="0" width="100%">
    111           <tr><th>Eng</th>
    112           <th>Cze</th>
    113           <th>  Popis</th></tr>';
    114         $ID = $Database->SQLCommand($sql);
    115           while ($Line = mysql_fetch_array($ID)) {
    116             echo '<tr>
    117             <td>'.$Line['AJWord'].'</td>
    118             <th>'.$Line['CZWord'].'</th>
    119             <td>'.$Line['description'].'</td></tr>';
    120           }
    121         echo '</table>'; 
     128echo('</td></tr>');
    122129
    123     echo '</td></tr>';
    124    
    125   echo '</table>
    126   </body>';
     130echo('</table></body>');
     131
    127132?>
Note: See TracChangeset for help on using the changeset viewer.