source: quests/dictionary.php@ 280

Last change on this file since 280 was 231, checked in by maron, 17 years ago
File size: 4.2 KB
Line 
1<?php
2
3session_start();
4include('includes/config.php');
5include('includes/databaseconection.php');
6
7//pøipojení do databáze
8$Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
9$Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
10$Database->SelectDatabase($Config['Database']['Database']);
11
12
13
14
15 function Licence($Licence)
16 { // BEGIN function Licence
17 global $Database;
18 if (isset($_SESSION['User']) and $_SESSION['User'] <> '') {
19 $User = $_SESSION['User'];
20 $Pass = $_SESSION['Pass'];
21
22 $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE LOWER(user) = LOWER('$User')"));
23 if (!$Line) {
24 return false;
25 } else {
26 if ($Licence == 1) {
27 if ($Line['gm'] == 1) {
28 return true;
29 } else return false;
30 }
31 If ($Line['pass'] == $Pass) {
32
33 // zapsání poslení použité IP
34 // $Addres = $_SERVER['REMOTE_ADDR'];
35 // $Database->SQLCommand("UPDATE user SET LastLogin = now(), LastIP = '$Addres' WHERE user = '$User'");
36
37 return True;
38 } else { return False;
39 // die('Nemáte zde pøístup, pøihlašte se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
40 }
41 }
42 } else { return False;
43 // die('Nemáte zde pøístup, pøihlašte se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
44 }
45
46 } // END function Licence
47
48
49
50
51echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
52<HTML>
53<HEAD>
54 <META http-equiv="Content-Language" content="cs">
55 <META http-equiv="Content-Type" content="text/html; charset='.$Config['Web']['Charset'].'">
56 <META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
57 <link rel="SHORTCUT ICON" href="/images/favicon.ico">
58 <TITLE>WoW server Heroes of Fantasy - Projekt pøekládání Questù do CZ</TITLE>
59</HEAD>
60 <body>
61
62 ';
63
64 if (array_key_exists('insert', $_GET)) {
65 echo '<form action="dictionary.php" method="post">
66 <input type="text" name="AJWord"> Anglické slovo<br>
67 <input type="text" name="CZWord"> Èeské slovo<br>
68 <input type="text" name="description"> Popis<br>
69 <input type="submit" value="Ulo¾it">
70 </form>
71 ';
72 $WinWidth = 230;
73 } else {
74 $WinWidth = 345;
75 if (array_key_exists('AJWord', $_POST)) {
76 $AJWord = $_POST['AJWord'];
77 $CZWord = $_POST['CZWord'];
78 $description = $_POST['description'];
79 $user = @$_SESSION['UserID'];
80 $Database->SQLCommand("INSERT INTO `dictionary` ( `AJWord` , `CZWord` , `description` , `user` )
81 VALUES ('$AJWord', '$CZWord', '$description', '$user');");
82 echo 'Záznam byl ulo¾en!';
83 $WinWidth = 325;
84 }
85 }
86
87
88 echo '<table border="1" width="100%">';
89
90 if (array_key_exists('search', $_GET)) {
91 $Search = $_GET['search'];
92 } else {
93 $Search = '';
94 }
95
96
97 echo '<tr><td><form action="dictionary.php" method="get">
98 <input type="text" value="'.$Search.'" name="search" size="30">
99 <input type="submit" value="Vyhledat">';
100 if (Licence(0))
101 echo ' <a href="dictionary.php?insert">Vlo¾it slovo</a>';
102
103 echo '</form></td></tr>';
104 echo '<tr><td>
105 <p style=" overflow: auto; width: 100%; height: '.$WinWidth.'px;">';
106 //todo select
107 if ($Search <> '') {
108 $sql = "SELECT * FROM `dictionary` WHERE LOWER(AJWord) LIKE LOWER('%$Search%') OR LOWER(CZWord) LIKE LOWER('%$Search%') OR LOWER(description) LIKE LOWER('%$Search%')";
109 } else {
110 $sql = "SELECT * FROM `dictionary`";
111 }
112 echo '<table border="1" cellpadding="2" cellspacing="0" width="100%">
113 <tr><th>Eng</th>
114 <th>Cze</th>
115 <th> Popis</th></tr>';
116 $ID = $Database->SQLCommand($sql);
117 while ($Line = mysql_fetch_array($ID)) {
118 echo '<tr>
119 <td>'.$Line['AJWord'].'</td>
120 <th>'.$Line['CZWord'].'</th>
121 <td>'.$Line['description'].'</td></tr>';
122 }
123 echo '</table>';
124
125 echo '</td></tr>';
126
127 echo '</table>
128 </body>';
129?>
Note: See TracBrowser for help on using the repository browser.