Changeset 49
- Timestamp:
- Jun 20, 2009, 4:22:51 PM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/sql/full.sql
r41 r49 4 4 -- 5 5 -- Počítač: localhost 6 -- Vygenerováno: Úterý 16. června 2009, 18:246 -- Vygenerováno: Sobota 20. června 2009, 13:49 7 7 -- Verze MySQL: 5.0.77 8 8 -- Verze PHP: 5.2.9 … … 20 20 -- 21 21 22 DROP TABLE IF EXISTS `Backup`; 22 23 CREATE TABLE IF NOT EXISTS `Backup` ( 23 24 `Id` int(11) NOT NULL auto_increment, … … 27 28 `Lock` int(11) NOT NULL, 28 29 `Database` int(11) NOT NULL, 29 PRIMARY KEY (`Id`) 30 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 30 PRIMARY KEY (`Id`), 31 KEY `Server` (`Server`), 32 KEY `Database` (`Database`) 33 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=53 ; 31 34 32 35 -- -------------------------------------------------------- … … 36 39 -- 37 40 41 DROP TABLE IF EXISTS `Client`; 38 42 CREATE TABLE IF NOT EXISTS `Client` ( 39 43 `Id` int(11) NOT NULL auto_increment, … … 43 47 `Title` varchar(255) NOT NULL, 44 48 PRIMARY KEY (`Id`) 45 ) ENGINE= MyISAM DEFAULT CHARSET=utf8;49 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=74 ; 46 50 47 51 -- -------------------------------------------------------- … … 51 55 -- 52 56 57 DROP TABLE IF EXISTS `Database`; 53 58 CREATE TABLE IF NOT EXISTS `Database` ( 54 59 `Id` int(11) NOT NULL auto_increment, … … 60 65 `ACIDRevision` int(11) NOT NULL, 61 66 `SourceFileName` varchar(255) NOT NULL, 62 `Emulator` int(11) NOT NULL, 63 PRIMARY KEY (`Id`) 64 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 65 66 -- -------------------------------------------------------- 67 68 -- 69 -- Struktura tabulky `DatabaseUpdate` 70 -- 71 72 CREATE TABLE IF NOT EXISTS `DatabaseUpdate` ( 73 `Id` int(11) NOT NULL auto_increment, 74 `Database` int(11) NOT NULL, 75 `Revision` int(11) NOT NULL, 76 `Updates` text NOT NULL, 77 PRIMARY KEY (`Id`) 78 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 67 `Emulator` int(11) default NULL, 68 `Update` text NOT NULL, 69 PRIMARY KEY (`Id`), 70 KEY `Emulator` (`Emulator`) 71 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ; 79 72 80 73 -- -------------------------------------------------------- … … 84 77 -- 85 78 79 DROP TABLE IF EXISTS `Debug`; 86 80 CREATE TABLE IF NOT EXISTS `Debug` ( 87 81 `Id` int(11) NOT NULL auto_increment, … … 97 91 `DbErrors` text NOT NULL, 98 92 `Configuration` text NOT NULL, 99 PRIMARY KEY (`Id`) 100 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 93 PRIMARY KEY (`Id`), 94 KEY `Server` (`Server`) 95 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; 101 96 102 97 -- -------------------------------------------------------- … … 106 101 -- 107 102 103 DROP TABLE IF EXISTS `Emulator`; 108 104 CREATE TABLE IF NOT EXISTS `Emulator` ( 109 105 `Id` int(11) NOT NULL auto_increment, … … 111 107 `Client` int(11) NOT NULL, 112 108 `Revision` int(11) NOT NULL, 113 `CommitHash` varchar(255) NOT NULL ,109 `CommitHash` varchar(255) NOT NULL COMMENT 'Určeno dle revize z http://github.com/mangos/mangos/commits/master', 114 110 `ScriptDev2PatchFileName` varchar(255) NOT NULL, 115 111 `ScriptDev2Revision` int(11) NOT NULL, 116 112 `Version` varchar(16) NOT NULL, 117 113 `Lock` int(11) NOT NULL, 118 PRIMARY KEY (`Id`) 119 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 114 `Enable` int(11) NOT NULL, 115 PRIMARY KEY (`Id`), 116 KEY `Client` (`Client`) 117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; 120 118 121 119 -- -------------------------------------------------------- … … 125 123 -- 126 124 125 DROP TABLE IF EXISTS `History`; 127 126 CREATE TABLE IF NOT EXISTS `History` ( 128 127 `Time` int(11) NOT NULL, … … 138 137 KEY `Server` (`Server`), 139 138 KEY `Period` (`Period`) 140 ) ENGINE= MyISAMDEFAULT CHARSET=utf8;139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 141 140 142 141 -- -------------------------------------------------------- … … 146 145 -- 147 146 147 DROP TABLE IF EXISTS `Log`; 148 148 CREATE TABLE IF NOT EXISTS `Log` ( 149 149 `Time` datetime NOT NULL default '0000-00-00 00:00:00', … … 152 152 `Operation` varchar(255) character set utf8 NOT NULL, 153 153 `Value` varchar(255) character set utf8 NOT NULL, 154 KEY `Time` (`Time`) 155 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; 154 KEY `Time` (`Time`), 155 KEY `User` (`User`) 156 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; 156 157 157 158 -- -------------------------------------------------------- … … 161 162 -- 162 163 164 DROP TABLE IF EXISTS `News`; 163 165 CREATE TABLE IF NOT EXISTS `News` ( 164 166 `Id` int(11) NOT NULL auto_increment, … … 167 169 `Title` varchar(255) NOT NULL, 168 170 `Content` text NOT NULL, 169 PRIMARY KEY (`Id`) 170 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 171 PRIMARY KEY (`Id`), 172 KEY `User` (`User`) 173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; 171 174 172 175 -- -------------------------------------------------------- … … 176 179 -- 177 180 181 DROP TABLE IF EXISTS `Server`; 178 182 CREATE TABLE IF NOT EXISTS `Server` ( 179 183 `Id` int(11) NOT NULL auto_increment, … … 193 197 `AccountCount` int(11) NOT NULL, 194 198 `Lock` int(11) NOT NULL, 195 PRIMARY KEY (`Id`) 196 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 199 PRIMARY KEY (`Id`), 200 KEY `User` (`User`), 201 KEY `Database` (`Database`) 202 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ; 197 203 198 204 -- -------------------------------------------------------- … … 202 208 -- 203 209 210 DROP TABLE IF EXISTS `Task`; 204 211 CREATE TABLE IF NOT EXISTS `Task` ( 205 212 `Id` int(11) NOT NULL auto_increment, … … 209 216 `Title` varchar(255) NOT NULL, 210 217 `CommandList` text NOT NULL, 211 `User` int(11) NOTNULL,218 `User` int(11) default NULL, 212 219 `State` int(11) NOT NULL, 213 220 `Output` text NOT NULL, 214 221 `Error` text NOT NULL, 215 PRIMARY KEY (`Id`) 216 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 222 PRIMARY KEY (`Id`), 223 KEY `User` (`User`) 224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; 217 225 218 226 -- -------------------------------------------------------- … … 222 230 -- 223 231 232 DROP TABLE IF EXISTS `User`; 224 233 CREATE TABLE IF NOT EXISTS `User` ( 225 234 `Id` int(11) NOT NULL auto_increment, … … 234 243 `Role` int(11) NOT NULL, 235 244 PRIMARY KEY (`Id`) 236 ) ENGINE= MyISAM DEFAULT CHARSET=utf8;245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ; 237 246 238 247 -- -------------------------------------------------------- … … 242 251 -- 243 252 253 DROP TABLE IF EXISTS `UserOnline`; 244 254 CREATE TABLE IF NOT EXISTS `UserOnline` ( 245 255 `Id` int(11) NOT NULL auto_increment, … … 253 263 PRIMARY KEY (`Id`), 254 264 KEY `User` (`User`) 255 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 265 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=19 ; 266 267 -- 268 -- Omezení pro exportované tabulky 269 -- 270 271 -- 272 -- Omezení pro tabulku `Database` 273 -- 274 ALTER TABLE `Database` 275 ADD CONSTRAINT `Database_ibfk_1` FOREIGN KEY (`Emulator`) REFERENCES `Emulator` (`Id`); 276 277 -- 278 -- Omezení pro tabulku `Debug` 279 -- 280 ALTER TABLE `Debug` 281 ADD CONSTRAINT `Debug_ibfk_2` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`), 282 ADD CONSTRAINT `Debug_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`); 283 284 -- 285 -- Omezení pro tabulku `Emulator` 286 -- 287 ALTER TABLE `Emulator` 288 ADD CONSTRAINT `Emulator_ibfk_1` FOREIGN KEY (`Client`) REFERENCES `Client` (`Id`); 289 290 -- 291 -- Omezení pro tabulku `History` 292 -- 293 ALTER TABLE `History` 294 ADD CONSTRAINT `History_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`); 295 296 -- 297 -- Omezení pro tabulku `Log` 298 -- 299 ALTER TABLE `Log` 300 ADD CONSTRAINT `Log_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`); 301 302 -- 303 -- Omezení pro tabulku `News` 304 -- 305 ALTER TABLE `News` 306 ADD CONSTRAINT `News_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`); 307 308 -- 309 -- Omezení pro tabulku `Server` 310 -- 311 ALTER TABLE `Server` 312 ADD CONSTRAINT `Server_ibfk_2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`), 313 ADD CONSTRAINT `Server_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`); 314 315 -- 316 -- Omezení pro tabulku `Task` 317 -- 318 ALTER TABLE `Task` 319 ADD CONSTRAINT `Task_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`); 320 321 -- 322 -- Omezení pro tabulku `UserOnline` 323 -- 324 ALTER TABLE `UserOnline` 325 ADD CONSTRAINT `UserOnline_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`); -
trunk/www/user.php
r46 r49 45 45 $SID = session_id(); 46 46 47 // Lookup user record 48 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 49 if($Query->num_rows == 0) 50 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 51 //echo($this->Database->LastQuery); 52 47 53 // Check login 48 54 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); … … 70 76 // Lookup user record 71 77 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 72 if($Query->num_rows > 0) 73 { 74 // Refresh time of last access 75 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 76 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 77 //echo($this->Database->LastQuery); 78 79 // Check login 80 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 81 $Row = $Query->fetch_assoc(); 82 if($Row['User'] != $this->AnonymousUserId) 83 { 84 $Query = $this->Database->select('User', '*', 'Id='.$Row['User']); 85 $this->User = $Query->fetch_assoc(); 86 $Result = USER_LOGGED; 87 } else 88 { 89 $Query = $this->Database->select('User', '*', 'Id='.$this->AnonymousUserId); 90 $this->User = $Query->fetch_assoc(); 91 $Result = USER_NOT_LOGGED; 92 } 78 if($Query->num_rows == 0) 79 $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()), 'ScriptName' => $_SERVER['PHP_SELF'])); 80 81 // Refresh time of last access 82 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 93 83 94 84 //$this->LoadPermission($this->User['Role']);
Note:
See TracChangeset
for help on using the changeset viewer.