Changeset 15
- Timestamp:
- Jun 12, 2009, 8:09:48 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/backup.php
r6 r15 13 13 } 14 14 15 function Restore( )15 function Restore($Id) 16 16 { 17 17 18 } 18 19 19 function Save( )20 function Save($Id) 20 21 { 22 21 23 } 22 24 } -
trunk/www/config.sample.php
r9 r15 30 30 'BaseDir' => '/opt/wowhosting/', 31 31 'MaxServerCount' => 20, 32 'CompilerParameters' => '', 32 33 ); 33 34 -
trunk/www/emulator.php
r14 r15 60 60 'mkdir objdir', 61 61 'cd objdir', 62 'export CFLAGS="- march=athlon64 -m64 -O2 -g -ggdb',63 'export CXXFLAGS="- march=athlon64 -m64 -O2 -g -ggdb',62 'export CFLAGS="-g -ggdb '.$Config['CompilerParameters'], 63 'export CXXFLAGS="-g -ggdb '.$Config['CompilerParameters'], 64 64 '../configure --prefix='.$Config['BaseDir'].'emulator/'.$this->Id.'/ --enable-cli --enable-ra', 65 65 'make', -
trunk/www/form.php
r11 r15 78 78 foreach($this->Definition['Items'] as $Index => $Item) 79 79 { 80 $this->Values[$I ndex] = $DbRow[$Index];80 $this->Values[$Item['Name']] = $DbRow[$Item['Name']]; 81 81 } 82 82 } -
trunk/www/index.php
r12 r15 10 10 function ShowServerListOnRow($Row) 11 11 { 12 $Server = new Server($this->Database, $Row['Id']);13 $ServerState = $Server->GetState();14 $Row['Online'] = $ServerState['Online'] * 1;15 12 $Row['NetworkPortRealmd'] = $this->System->Config['Web']['Host'].':'.$Row['NetworkPortRealmd']; 16 13 $Row['Name'] = '<a href="?Action=ServerShow&Id='.$Row['Id'].'">'.$Row['Name'].'</a>'; 17 $Row['AccountCount'] = $ServerState['AccountCount'];18 $Row['CharacterCount'] = $ServerState['CharacterCount'];19 $Row['OnlinePlayerCount'] = $ServerState['OnlinePlayerCount'];20 14 return($Row); 21 15 } … … 25 19 global $Config; 26 20 21 $Server = new Server($this->Database, 0); 22 $Server->UpdateServerList(); 27 23 $Output = '<h4>Seznam serverů</h4>'; 28 24 $Table = new Table('ServerList'); … … 125 121 $Form = new Form('UserLogin'); 126 122 $Form->OnSubmit = '?Action=Login'; 127 $Result = $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password']); 123 $Form->LoadValuesFromForm(); 124 $Result = $this->System->Modules['User']->Login($Form->Values['Username'], $Form->Values['Password']); 128 125 $Output .= $this->SystemMessage('Přihlášení', $Result); 129 126 if($Result <> USER_LOGGED_IN) 130 127 { 131 $Form->LoadValuesFromForm();132 128 $Form->Values['Password'] = ''; 133 129 $Output .= $Form->ShowEditForm(); -
trunk/www/server.php
r14 r15 18 18 $this->Id = $Id; 19 19 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); 20 $this->Server = $DbResult->fetch_assoc(); 21 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 22 if($DbResult->num_rows > 0) $this->Server['Database'] = $DbResult->fetch_assoc(); 23 else $this->Server['Database'] = array('Emulator' => 0); 24 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 25 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 26 else $this->Server['Database']['Emulator'] = array('ClientVersion' => 0); 27 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Server['Database']['Emulator']['ClientVersion']); 28 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator']['ClientVersion'] = $DbResult->fetch_assoc(); 29 else $this->Server['Database']['Emulator']['ClientVersion'] = array(); 20 if($DbResult->num_rows > 0) 21 { 22 $this->Server = $DbResult->fetch_assoc(); 23 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 24 if($DbResult->num_rows > 0) $this->Server['Database'] = $DbResult->fetch_assoc(); 25 else $this->Server['Database'] = array('Emulator' => 0); 26 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 27 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 28 else $this->Server['Database']['Emulator'] = array('ClientVersion' => 0); 29 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Server['Database']['Emulator']['ClientVersion']); 30 if($DbResult->num_rows > 0) $this->Server['Database']['Emulator']['ClientVersion'] = $DbResult->fetch_assoc(); 31 else $this->Server['Database']['Emulator']['ClientVersion'] = array(); 32 } 30 33 } 31 34 … … 125 128 $DbResult = $this->Database->query('SELECT COUNT(*) FROM server'.$this->Id.'_characters.characters AS T WHERE T.online = 1'); 126 129 $DbRow = $DbResult->fetch_row(); 127 $State[' OnlinePlayerCount'] = $DbRow[0];130 $State['CharacterOnlineCount'] = $DbRow[0]; 128 131 $DbResult = $this->Database->query('SELECT COUNT(*) FROM server'.$this->Id.'_characters.characters AS T'); 129 132 $DbRow = $DbResult->fetch_row(); … … 237 240 $Config->Save($ServerEtcDir.'scriptdev2.conf'); 238 241 } 242 243 function UpdateServerList() 244 { 245 $DbResult = $this->Database->select('Server', 'Id'); 246 while($DbRow = $DbResult->fetch_assoc()) 247 { 248 $Server = new Server($this->Database, $DbRow['Id']); 249 $ServerState = $Server->GetState(); 250 $this->Database->update('Server', 'Id='.$DbRow['Id'], array( 251 'Online' => $ServerState['Online'], 252 'CharacterOnlineCount' => $ServerState['CharacterOnlineCount'], 253 'CharacterCount' => $ServerState['CharacterCount'], 254 'AccountCount' => $ServerState['AccountCount'], 255 )); 256 } 257 } 239 258 } 240 259 -
trunk/www/table.php
r11 r15 8 8 var $Header; 9 9 var $OnRow; 10 var $QueryParameters; 10 11 11 12 function __construct($ClassName) … … 14 15 15 16 $this->Definition = &$FormClasses[$ClassName]; 17 $this->QueryParameters = array(); 16 18 } 17 19 18 20 function Show() 19 21 { 22 $Header = array(); 23 if(!array_key_exists('Order', $_GET)) $_GET['Order'] = 0; 24 if(!array_key_exists('Column', $_GET)) $_GET['Column'] = 0; 25 $QueryParts = explode('&', $_SERVER['QUERY_STRING']); 26 foreach($QueryParts as $Part) 27 { 28 $Part2 = explode('=', $Part); 29 $QueryItems[$Part2[0]] = $Part2[1]; 30 } 31 $QueryItems['Order'] = $_GET['Order']; 32 foreach($this->Definition['Items'] as $Index => $Item) 33 { 34 $QueryItems['Column'] = $Index; 35 if($_GET['Column'] == $Index) $QueryItems['Order'] = 1 - $_GET['Order']; 36 else $QueryItems['Order'] = $_GET['Order']; 37 $QueryParts = array(); 38 foreach($QueryItems as $Index2 => $Item2) 39 { 40 $QueryParts[] = $Index2.'='.$Item2; 41 } 42 $Header[] = '<a href="?'.implode('&', $QueryParts).'">'.$Item['Caption'].'</a>'; 43 } 20 44 $Table = array( 21 'Header' => $ this->Header,45 'Header' => $Header, 22 46 'Rows' => $this->Values, 23 47 ); … … 28 52 function LoadValuesFromDatabase($Database) 29 53 { 54 $OrderType = array('ASC', 'DESC'); 55 if(!array_key_exists('Order', $_GET)) $_GET['Order'] = 0; 56 else if($_GET['Order'] == 'Asc') $_GET['Order'] = 1; 57 if(!array_key_exists('Column', $_GET)) 58 { 59 $Keys = array_keys($this->Definition['Items']); 60 $_GET['Column'] = $Keys[0]; 61 } 30 62 $this->Header = array(); 31 63 foreach($this->Definition['Items'] as $Index => $Item) 32 64 { 33 65 $this->Header[] = $Item['Caption']; 34 35 66 } 36 67 $this->Values = array(); 37 $DbResult = $Database->query('SELECT * FROM '.$this->Definition['Table']); 68 $Table = $this->Definition['Table']; 69 foreach($this->QueryParameters as $Index => $Item) 70 $Table = str_replace('%'.$Index, $Item, $Table); 71 $DbResult = $Database->query('SELECT * FROM '.$Table.' ORDER BY T.'.$_GET['Column'].' '.$OrderType[$_GET['Order']]); 38 72 while($DbRow = $DbResult->fetch_assoc()) 39 73 { -
trunk/www/types/Password.php
r11 r15 23 23 global $Database; 24 24 25 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 25 $Result = sha1($_POST[$Item['Name']]); 26 /* 27 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 26 28 else 27 29 { … … 34 36 } else $Result = sha1($_POST[$Item['Name']]); 35 37 } 38 */ 36 39 return($Result); 37 40 } -
trunk/www/user.php
r14 r15 141 141 { 142 142 $Row = $Query->fetch_assoc(); 143 if($Row['Password'] != sha1($Password)) $Result = BAD_PASSWORD;143 if($Row['Password'] != $Password) $Result = BAD_PASSWORD; 144 144 else if($Row['Locked'] == 1) $Result = ACCOUNT_LOCKED; 145 145 else
Note:
See TracChangeset
for help on using the changeset viewer.