source: quests/includes/global.php@ 225

Last change on this file since 225 was 225, checked in by maron, 17 years ago
File size: 5.4 KB
Line 
1<?php
2
3session_start();
4include('config.php');
5include('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//pøihlá¹ení
13 if (array_key_exists('LoginUser',$_POST)) {
14 $_SESSION['User'] = $_POST['LoginUser'];
15 $_SESSION['Pass'] = $_POST['LoginPass'];
16
17 $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE LOWER(user) = LOWER('".$_SESSION['User']."')"));
18 $_SESSION['UserID'] = $Line['ID'];
19 $_SESSION['User'] = $Line['user'];
20 }
21//odhlá¹ení
22 if (array_key_exists('Logout',$_GET)) {
23 $_SESSION['User'] = '';
24 $_SESSION['Pass'] = '';
25 $_SESSION['UserID'] = '';
26 }
27//záznam o aktivitì
28 if (Licence(0))
29 $Database->SQLCommand("UPDATE user SET LastIP = '".$_SERVER['REMOTE_ADDR']."', LastLogin = now() WHERE ID = ".$_SESSION['UserID']);
30
31 function Licence($Licence)
32 { // BEGIN function Licence
33 global $Database;
34 if (isset($_SESSION['User']) and $_SESSION['User'] <> '') {
35 // $User = $_SESSION['User'];
36 $Pass = $_SESSION['Pass'];
37
38 $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE ID = ".$_SESSION['UserID']));
39 if (!$Line) {
40 return false;
41 } else {
42 if ($Licence == 1) {
43 if ($Line['gm'] == 1) {
44 return true;
45 } else return false;
46 }
47 If ($Line['pass'] == $Pass) {
48
49 // zapsání poslení pou¾ité IP
50 // $Addres = $_SERVER['REMOTE_ADDR'];
51 // $Database->SQLCommand("UPDATE user SET LastLogin = now(), LastIP = '$Addres' WHERE user = '$User'");
52
53 return True;
54 } else { return False;
55 // die('Nemáte zde pøístup, pøihla¹te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
56 }
57 }
58 } else { return False;
59 // die('Nemáte zde pøístup, pøihla¹te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
60 }
61
62 } // END function Licence
63
64
65$Texts = array(
66// array('Title'),
67 array('Details'),
68 array('Objectives'),
69 array('OfferRewardText'),
70 array('RequestItemsText'),
71 array('EndText'),
72 array('ObjectiveText1'),
73 array('ObjectiveText2'),
74 array('ObjectiveText3'),
75 array('ObjectiveText4'),
76);
77
78
79echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
80<HTML>
81<HEAD>
82 <META http-equiv="Content-Language" content="cs">
83 <META http-equiv="Content-Type" content="text/html; charset='.$Config['Web']['Charset'].'">
84 <META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
85 <link rel="SHORTCUT ICON" href="/images/favicon.ico">
86 <TITLE>WoW server Heroes of Fantasy - Projekt pøekládání Questù do CZ</TITLE>
87</HEAD>
88 <body>
89 <table border="0" width="100%">
90 <tr>
91 <td width="150" valign="top">
92 <br />
93 <b>Odkazy:</b><br />
94 <a href="index.php">Domù</a><br />
95 <a href="http://wow.zdechov.net/forum/viewforum.php?f=22">Forum projektu</a><br />
96 <a href="http://wow.zdechov.net/">Web serveru</a><br />
97 <a href="registrace.php" style="color: red">Registrace</a><br />
98 <a href="Options.php" Title="Nastavení u¾ivatele">Nastavení</a><br />
99 <a href="statistic.php">Statistika</a><br />
100 <a Title="Slovník wow výrazù" href="javascript: window.open(\'dictionary.php\', \'Slovník\', \'width=400, height=412\'); blur()">Slovníèek</a><br />
101 <a href="export.php" Title="Zdes i mù¾ete stáhnout pøelo¾ené texty">Download</a><br />
102 <br />
103 <a href="ListQuests.php?selection">Nepøelo¾ené questy</a><br />
104 <a href="ListQuests.php?Translate">Pøelo¾ené questy</a><br />';
105
106 if (Licence(0)) {
107 echo '<a href="ListQuests.php?mydevelop">Rozepsané questy</a><br />
108 <a href="ListQuests.php?my">Moje questy</a><br />';
109 }
110
111 if (Licence(1)) {
112 // echo 'Administrace:';
113 echo '<br /><a href="priorite.php" Title="Naètení priority questù (Moderator only)">Priorita</a><br />';
114 }
115
116 echo '<br /><form action="action.php" method="get">
117<input type="text" name="search" size="13"><br>
118<input type="submit" value="Hledat">
119</form>
120 ';
121
122if (Licence(0)) {
123 echo 'Jste pøihlá¹en jako: <b>'.$_SESSION['User'].'</b> <a href="index.php?Logout">Odhlásit</a>';
124} else {
125 echo '
126 <b>Login:</b><br>
127 <form action="index.php" method="post">
128 <table>
129 <tr>
130 <td><input type="text" name="LoginUser" size="13"></td>
131 </tr>
132 <tr>
133 <td><input type="password" name="LoginPass" size="13"></td>
134 </tr>
135 <tr>
136 <th><input type="submit" value="Pøihlásit"></th>
137 </tr>
138 </table>
139 </form>
140 ';
141}
142 echo '<br /><br />Online u¾ivatelé:<br />';
143 $ID = $Database->SQLCommand("SELECT user FROM `user` WHERE LastLogin >= Now()-300");
144 while ($Line = mysql_fetch_array($ID))
145 echo '<b>'.$Line['user'].'</b><br />';
146
147
148 echo '</td>
149 <td>';
150
151
152
153
154 function ShowFooter()
155 { // BEGIN function ShowFooter
156 global $Database;
157
158 echo '
159 </td>
160 </tr>
161 <tr><td></td><td> <span style="color: grey">Program naprogramoval maron (maron2@cetrum.cz)</span> </td></tr>
162 </table>
163 </body>
164</html>
165';
166
167 $Database->Disconnect();
168 } // END function ShowFooter
169
170?>
Note: See TracBrowser for help on using the repository browser.