1 | <?php
|
---|
2 | include '../SubFiles/TestLicence.php';
|
---|
3 | ?>
|
---|
4 | <?
|
---|
5 |
|
---|
6 | $SavesDirectory = 'D:/UWC1.3.4/saves/';
|
---|
7 |
|
---|
8 | $AccountsDatFile = fopen($SavesDirectory.'accounts.dat', 'r');
|
---|
9 | $AccountsData = fread($AccountsDatFile, 128000);
|
---|
10 | fclose($AccountsDatFile);
|
---|
11 |
|
---|
12 | $AccountsStrFile = fopen($SavesDirectory.'accounts.str', 'r');
|
---|
13 | $AccountsStr = fread($AccountsStrFile, 65000);
|
---|
14 | fclose($AccountsStrFile);
|
---|
15 |
|
---|
16 | $PlayersFile = fopen($SavesDirectory.'players.save', 'r');
|
---|
17 | while(!feof($PlayersFile))
|
---|
18 | {
|
---|
19 | $Row = trim(fgets($PlayersFile));
|
---|
20 | //echo('.'.$Row.'.<br>');
|
---|
21 | if(substr($Row, 0, 8) == '[OBJECT]')
|
---|
22 | {
|
---|
23 | $Row = trim(fgets($PlayersFile));
|
---|
24 | $Player['GUID'] = substr($Row, 5);
|
---|
25 | //echo($Player['GUID'].'<br>');
|
---|
26 | $Row = trim(fgets($PlayersFile));
|
---|
27 | $Type = substr($Row, 5);
|
---|
28 | if($Type == 4)
|
---|
29 | {
|
---|
30 | $Row = trim(fgets($PlayersFile));
|
---|
31 | while(strlen($Row) != 0)
|
---|
32 | {
|
---|
33 | //echo(strlen($Row).' '.$Player['GUID'].'-'.$Row.'<br>');
|
---|
34 | //echo($Row);
|
---|
35 | $RowParts = explode('=', $Row);
|
---|
36 | if(count($RowParts)>1) $Player[$RowParts[0]] = $RowParts[1];
|
---|
37 | $Row = trim(fgets($PlayersFile));
|
---|
38 | //echo($GUID.' '.$Type.'<br>');
|
---|
39 | }
|
---|
40 | $Players[$Player['GUID']] = $Player;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|
44 | //print_r($Players['0DD000000DD14E8AD']);
|
---|
45 | //print_r($Players);
|
---|
46 | fclose($PlayersFile);
|
---|
47 |
|
---|
48 | function SubStrToNull($Source, $Start)
|
---|
49 | {
|
---|
50 | $Result = substr($Source, $Start);
|
---|
51 | $Result = substr($Result, 0 , strpos($Result, "\0"));
|
---|
52 | return($Result);
|
---|
53 | }
|
---|
54 |
|
---|
55 | function StrToLongint($Str)
|
---|
56 | {
|
---|
57 | $Result = 0;
|
---|
58 | for($I=0; $I<strlen($Str); $I++)
|
---|
59 | {
|
---|
60 | //echo(ord(substr($Str, $I, 1))*256^$I.'<br>');
|
---|
61 | $Result = $Result + ord(substr($Str, $I, 1))*pow(256, $I);
|
---|
62 | }
|
---|
63 | //echo($Result.'<br>');
|
---|
64 | return($Result);
|
---|
65 | }
|
---|
66 |
|
---|
67 | function StrToHexStr($Str)
|
---|
68 | {
|
---|
69 | $Result = '';
|
---|
70 | for($J=0; $J<strlen($Str); $J++)
|
---|
71 | {
|
---|
72 | $Number = dechex(ord($Str{$J}));
|
---|
73 | $Result = substr('00', 0, 2-strlen($Number)).$Number.$Result;
|
---|
74 | }
|
---|
75 | if(hexdec(substr(dechex(ord($Str{7})), 0, 1)) > 9) $Result = '0'.$Result;
|
---|
76 | return($Result);
|
---|
77 | }
|
---|
78 |
|
---|
79 | $StartAddr = 0x24;
|
---|
80 | $UserRecordSize = 0xee;
|
---|
81 | $i = 0;
|
---|
82 | while($i < ((strlen($AccountsData)/$UserRecordSize)-1))
|
---|
83 | {
|
---|
84 | $UserRecord = substr($AccountsData, $StartAddr + $i * $UserRecordSize);
|
---|
85 | $User = array('LastIp' => ' ', 'SessionKey' => ' ', 'Characters' => array());
|
---|
86 | $User['Name'] = SubStrToNull($AccountsStr, StrToLongint(substr($UserRecord, 0, 4)));
|
---|
87 | $User['Password'] = SubStrToNull($AccountsStr, StrToLongint(substr($UserRecord, 4, 4)));
|
---|
88 | $SessionKeyAddr = StrToLongint(substr($UserRecord, 60, 4));
|
---|
89 | if($SessionKeyAddr) $User['SessionKey'] = SubStrToNull($AccountsStr, $SessionKeyAddr);
|
---|
90 | $LastIpAddr = StrToLongint(substr($UserRecord, 64, 4));
|
---|
91 | if($LastIpAddr) $User['LastIp'] = SubStrToNull($AccountsStr, $LastIpAddr);
|
---|
92 | for($K = 0; $K<10; $K++)
|
---|
93 | {
|
---|
94 | $GUID = StrToHexStr(substr($UserRecord, 68+8*$K, 8));
|
---|
95 | if($GUID != '0000000000000000')
|
---|
96 | {
|
---|
97 | $User['Characters'][] = strtoupper($GUID);
|
---|
98 | }
|
---|
99 | }
|
---|
100 | $User['PLevel'] = StrToLongint(substr($UserRecord, 148, 4));
|
---|
101 | $User['Banned'] = StrToLongint(substr($UserRecord, 232, 1));
|
---|
102 | $User['Locked'] = StrToLongint(substr($UserRecord, 233, 1));
|
---|
103 | $User['LastAccess'] = StrToLongint(substr($UserRecord, 234, 4));
|
---|
104 | $UserList[$User['Name']] = $User;
|
---|
105 | $i++;
|
---|
106 | }
|
---|
107 |
|
---|
108 | //echo($AccountsData[$Addr]+$AccountsData[$Addr+1]*256+$AccountsData[$Addr+2]*256*256+$AccountsData[$Addr+3]*256*256*256);
|
---|
109 |
|
---|
110 |
|
---|
111 | echo('<table border="1" cellpadding="3" cellspacing="0">
|
---|
112 | <tr><th>Jméno</th><th>Poèet<br>postav</th><th>Jména postav</th><th>IP adresa</th><th>PLevel</th><th>Banned</th><th>Locked</th><th>Naposledy</th><th>Neaktivní<br>dnù</th></tr>');
|
---|
113 | $CharacterCount = 0;
|
---|
114 | foreach($UserList as $User)
|
---|
115 | {
|
---|
116 | $CharacterNames = '';
|
---|
117 | foreach($User['Characters'] as $Character)
|
---|
118 | {
|
---|
119 | $CharacterNames .= $Players[$Character]['NAME'].', ';
|
---|
120 | }
|
---|
121 | $CharacterNames = substr($CharacterNames, 0, -2).' ';
|
---|
122 | echo('<tr><td>'.$User['Name'].'</td><td>'.count($User['Characters']).'</td><td>'.$CharacterNames.'</td><td>'.$User['LastIp'].'</td><td>'.$User['PLevel'].'</td><td>'.$User['Banned'].'</td><td>'.$User['Locked'].'</td><td>'.date('h:i:s d.m.Y', $User['LastAccess']).'</td><td>'.(round((time()-$User['LastAccess'])/360/24)/10).'</td></tr>');
|
---|
123 | //'.gethostbyaddr($User['LastIp']).'
|
---|
124 | $CharacterCount = $CharacterCount + count($User['Characters']);
|
---|
125 | flush();
|
---|
126 | }
|
---|
127 | echo('</table>');
|
---|
128 | echo('Registrovaných u¾ivatelù: '.count($UserList).'<br>');
|
---|
129 | echo('Celkem postav: '.$CharacterCount.'<br>');
|
---|
130 | ?>
|
---|