include('root.php');
include('config.php');
include('db.php');
DB_Init($Options['DB_Host'],$Options['DB_User'],$Options['DB_Password'], $Options['DB_Database']);
if(array_key_exists('player', $_GET))
{
DB_Select('players', 'guid', 'name="'.addslashes($_GET['player']).'"');
if(DB_NumRows() > 0)
{
echo('Poznámky k hráči:
');
$Player = DB_Row();
if(array_key_exists('save', $_POST))
{
DB_Select('player_notice', '*', 'guid="'.$Player['guid'].'"');
if(DB_NumRows() > 0) DB_Update('player_notice', 'guid="'.$Player['guid'].'"', array('notice' => $_POST['notice']));
else DB_Insert('player_notice', array('guid' =>$Player['guid'], 'notice' => $_POST['notice']));
//echo('Uloženo
');
}
if(array_key_exists('edit', $_GET))
{
echo('
');
} else echo('
Editovat poznámky
');
}
$Skills = array();
$DefinesFile = fopen($ScriptsDirectory.'extra/defines.scp', 'r');
while(!feof($DefinesFile))
{
$Row = trim(fgets($DefinesFile));
if(substr($Row, 0, 14) == '#define SKILL_')
{
$Row = substr($Row, 14);
$RowParts = explode(' ', $Row);
$Skills[$RowParts[1]] = $RowParts[0];
}
}
fclose($DefinesFile);
$SpellsFile = fopen($ScriptsDirectory.'spellcost.scp', 'r');
while(!feof($SpellsFile))
{
$Row = trim(fgets($SpellsFile));
//echo('.'.$Row.'.
');
if(substr($Row, 0, 6) == '[spell')
{
$RowParts = explode(' ', substr($Row, 0, -1));
$Spell = array('id' => $RowParts[1]);
$Row = trim(fgets($SpellsFile));
while(strlen($Row) != 0)
{
//echo(strlen($Row).' '.$Player['GUID'].'-'.$Row.'
');
//echo($Row);
$RowParts = explode('=', $Row);
if(count($RowParts)>1) $Spell[$RowParts[0]] = $RowParts[1];
$Row = trim(fgets($SpellsFile));
//echo($GUID.' '.$Type.'
');
}
$Spells[$Spell['id']] = $Spell;
}
}
fclose($SpellsFile);
//print_r($Spells);
echo('Záznam postavy '.$_GET['player'].':
');
echo('');
echo('');
$Finished = 0;
$Rows = array();
$PlayersFile = fopen($SavesDirectory.'players.save', 'r');
while(!feof($PlayersFile))
{
$Row = trim(fgets($PlayersFile));
//echo('.'.$Row.'. ');
if(substr($Row, 0, 8) == '[OBJECT]')
{
$Row = trim(fgets($PlayersFile));
$Player['GUID'] = substr($Row, 5);
//echo($Player['GUID'].' ');
$Row = trim(fgets($PlayersFile));
$Type = substr($Row, 5);
if($Type == 4)
{
$Row = trim(fgets($PlayersFile));
while(strlen($Row) != 0)
{
//echo(strlen($Row).' '.$Player['GUID'].'-'.$Row.' ');
//echo($Row);
$Rows[] = $Row;
$RowParts = explode('=', $Row);
if(($RowParts[0] == 'NAME') and ($RowParts[1] == $_GET['player'])) $Finished = 1;
if(count($RowParts)>1) $Player[$RowParts[0]] = $RowParts[1];
$Row = trim(fgets($PlayersFile));
//echo($GUID.' '.$Type.' ');
}
if($Finished)
{
foreach($Rows as $Row)
{
$RowParts = explode('=', $Row);
if($RowParts[0] == 'SPELL')
{
$RowParts2 = explode(' ', $RowParts[1]);
$RowParts[1] .= ' ('.$Spells[$RowParts2[0]]['name'].')';
}
if($RowParts[0] == 'SKILL')
{
$RowParts2 = explode(' ', $RowParts[1]);
$RowParts[1] .= ' ('.$Skills[$RowParts2[0]].')';
}
echo(''.$RowParts[0].' | '.$RowParts[1].' | ');
}
break;
} else $Rows = array();
}
}
}
fclose($PlayersFile);
echo(' ');
echo(' | ');
$File = fopen($CashStateDirectory.$_GET['player'].'.log', 'r');
if($File)
{
while(!feof($File))
echo(fgets($File, 128000).' ');
fclose($File);
}
echo(' |
');
} else
{
echo('
Jméno | Počet postav | Jména postav | IP adresa | PLevel | Banned | Locked | Naposledy | Neaktivní dnů |
');
$CharacterCount = 0;
DB_Select('accounts', '*');
while($User = DB_Row())
{
if($User['last_ip'] == '') $User['last_ip'] = ' ';
DB_Save();
$CharacterNames = '';
$PlayersCount = 0;
//DB_Select('players', 'COUNT(*)', 'account='.$User['id']);
//$PlayersCount = DB_Row();
DB_Select('players', '*', 'account='.$User['id']);
while($Player = DB_Row())
{
$CharacterNames .= ''.$Player['name'].'('.$Player['level'].'), ';
$PlayersCount += 1;
}
$CharacterNames = substr($CharacterNames, 0, -2).' ';
echo(''.$User['name'].' | '.$PlayersCount.' | '.$CharacterNames.' | '.$User['last_ip'].' | '.$User['plevel'].' | '.$User['banned'].' | '.$User['locked'].' | '.date('G:i:s', $User['last_access']).' '.date('d.m.Y', $User['last_access']).' | '.(round((time()-$User['last_access'])/360/24)/10).' |
');
//'.gethostbyaddr($User['LastIp']).'
DB_Load();
//flush();
}
echo('
');
DB_Select('accounts', 'COUNT(*)');
$AccountsCount = DB_Row();
echo('Registrovaných uľivatelů: '.$AccountsCount[0].'
');
DB_Select('players', 'COUNT(*)');
$PlayersCount = DB_Row();
echo('Celkem postav: '.$PlayersCount[0].'
');
}
?>