source: trunk/www/index.php@ 74

Last change on this file since 74 was 74, checked in by george, 16 years ago
  • Přidáno: Zobrazení počítačů ve skupině.
  • Opraveno: Různé opravy změny struktury tříd.
File size: 1.5 KB
Line 
1<?php
2
3include('Include.php');
4if(array_key_exists('argv', $_SERVER))
5 $_GET = array_merge($_GET, ParseCommandLineArgs($_SERVER['argv']));
6
7// SQL injection hack protection
8foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
9foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
10
11if(isset($_SERVER['REMOTE_ADDR'])) session_start();
12
13$System = new System();
14$ScriptTimeStart = $System->GetMicrotime();
15$System->Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
16$System->Database->Prefix = $Config['Database']['Prefix'];
17$System->Database->charset($Config['Database']['Charset']);
18$System->Config = $Config;
19$System->AddModule(new Log($System));
20$System->AddModule(new User($System));
21if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check();
22 else $System->Modules['User']->User['Id'] = $Config['Web']['UserConsoleId'];
23
24if(array_key_exists('Module', $_GET)) $Module = $_GET['Module'];
25 else $Module = 'HomePage';
26if(array_key_exists('Action', $_GET)) $Action = $_GET['Action'];
27 else $Action = 'Show';
28
29$ControllerName = $Module.'Controller';
30if(class_exists($ControllerName))
31{
32 $Controller = new $ControllerName($System);
33 if(method_exists($Controller, $Action)) $Output = $Controller->$Action();
34 else $Output = 'Metoda '.$Action.' modulu '.$Module.' neexistuje.';
35} else $Output = 'Třída '.$ControllerName.' neexistuje.';
36
37echo($Output);
38
39?>
Note: See TracBrowser for help on using the repository browser.