Changeset 48 for trunk/index.php
- Timestamp:
- Dec 22, 2019, 11:43:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r39 r48 34 34 $this->PageHeaders = array(); 35 35 $this->Bars = array(); 36 } 37 38 function IsAdmin() 39 { 40 return ($_SESSION['IsAdmin'] == 1); 36 41 } 37 42 … … 70 75 return($PathItems); 71 76 } 72 77 73 78 function RegisterPage($Path, $Handler) 74 79 { … … 149 154 } 150 155 } 151 156 152 157 function RunCommon() 153 158 { … … 226 231 } 227 232 // MeetItems 228 $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` ');233 $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` WHERE (`Hidden`=0)'); 229 234 while ($DbRow = $DbResult->fetch_array()) 230 235 { … … 242 247 } 243 248 244 245 $Revision = 36; // Subversion revision 246 $DatabaseRevision = 36; // SQL structure revision 247 $ReleaseTime = strtotime('2019-05-05'); 249 class PageLogin extends Page 250 { 251 function Show() 252 { 253 global $Config; 254 255 $Output = ''; 256 if (array_key_exists('login', $_GET)) 257 { 258 if (array_key_exists('password', $_POST)) 259 { 260 if ($_POST['password'] == $Config['Web']['AdminPassword']) 261 { 262 $_SESSION['IsAdmin'] = 1; 263 $Output .= 'Úspěšně přihlášen jako správce.'; 264 } else { 265 $_SESSION['IsAdmin'] = 0; 266 $Output .= 'Heslo není správné.'; 267 $Output .= $this->ShowLoginForm(); 268 } 269 } else { 270 $Output .= 'Chybí heslo.'; 271 $Output .= $this->ShowLoginForm(); 272 } 273 } else 274 if (array_key_exists('logoff', $_GET)) 275 { 276 $_SESSION['IsAdmin'] = 0; 277 $Output .= 'Odhlášení úspěšné'; 278 $Output .= $this->ShowLoginForm(); 279 } else { 280 $Output .= $this->ShowLoginForm(); 281 } 282 if ($this->System->IsAdmin()) $Output .= '<div>Jsi přihlášen jako správce. <a href="?logoff">Odhlásit</a></div>'; 283 return $Output; 284 } 285 286 function ShowLoginForm() 287 { 288 return '<form method="post" action="?login">'. 289 'Heslo: <input type="password" name="password" value=""/><br/>'. 290 '<input type="submit" value="Přihlásit"/>'. 291 '</form>'; 292 } 293 } 294 295 $Revision = 48; // Subversion revision 296 $DatabaseRevision = 48; // SQL structure revision 297 $ReleaseTime = strtotime('2019-12-22'); 248 298 249 299 $Application = new ApplicationTanec(); … … 255 305 $Application->RegisterPage('robots.txt', 'PageRobots'); 256 306 $Application->RegisterPage('sitemap.xml', 'PageSiteMap'); 307 $Application->RegisterPage('admin', 'PageLogin'); 257 308 $Application->Run();
Note:
See TracChangeset
for help on using the changeset viewer.