<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<script type="text/javascript">
<!--
function Active(what)
{
what.style.backgroundColor='#CCCCCC';
}
function NotActive(what)
{
what.style.backgroundColor='';
}
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//-->
</script>
<title>Drathia Account Maker - Search Player</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #FFCC00}
-->
</style>
</head>
<body>
<div align="center"> 
  <p><font color="#FFCC00">DeadTouch Account Creator</font> </p>
  <table width="14%" border="0" cellspacing="2" cellpadding="2">
    <tr> 
      <td bgcolor="#CCCCCC"> <div class="odn"><font color="#000000" size="1"><a href="index.php">&nbsp;<font color="#1C3359"> 
          Home</font></a></font></div>
        <font color="#000000" size="1"> 
        <div align="center">Home Page</div>
        </font></td>
    </tr>
    <tr> 
      <td bgcolor="#CCCCCC"><font color="#000000" size="1"> 
        <div class="odn"><a href="zaloz.php">&nbsp;<font color="#1C3359"> Player 
          Creator</font></a></div>
        </font><div align="center"><font size="1"> Create Character</font></div></td>
    </tr>
    <tr> 
      <td bgcolor="#CCCCCC"><font color="#000000" size="1"> 
        <div class="odn"><a href="players.php">&nbsp;<font color="#1C3359"> Search Player</font></a></div>
        </font> <div align="center"><font size="1"> Find Character</font></div></td>
    </tr>
    <tr> 
      <td bgcolor="#CCCCCC"><font color="#000000" size="1"> 
        <div class="odn"><a href="kontakt.php">&nbsp;<font color="#1C3359"> Kontakt</font></a></div>
        </font>
<div align="center"><font size="1"> Contact with GM</font></div></td>
    </tr>
  </table>
  <table width="14%" border="0" cellpadding="2" cellspacing="2">
    <tr> 
      <td bgcolor="#CCCCCC"><font color="#000000" size="1"></font>
      <div class="odn"><font color="#000000" size="1"><a href="http://www.otscenter.pl">&nbsp; 
          <font color="#1C3359">OtsCenter.pl</font></a></font></div>
         <div align="center">Polish World of OTS          </div>
         <div align="center"><font size="1"> </font></div></td>
    </tr>
  </table>
  <table width="14%" border="0" cellpadding="2" cellspacing="2">
    <tr> 
      <td align="center" bgcolor="#CCCCCC"><div class="odn"><font color="#000000" size="1"><a href="http://www.graviriarpg.fora.pl">&nbsp;<font color="#1C3359"> 
          </font></a>Statistics</font></div>
        <div align="center"><font color="#000000" size="1"><a target="Graviria Level Ranking" href="rank/lvl.php" onclick="window.open('rank/lvl.php', 'Graviria Level Ranking').focus(); return false">LVL</a> 
          / <a target="Graviria Level Ranking" href="rank/mlvl.php" onclick="window.open('rank/mlvl.php', 'Graviria Level Ranking').focus(); return false">MLVL</a> 
          </font> <font size="1"><br />
          Statystyki</font></div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <hr width="560">
  <form method="get" action="<?=$PHP_SELF?>">
    <div align="center"><center>
<?


function skills($vocation)
{
	require('config.php');
	$str = "";

	for ($id = 0; $id <= 6; $id++)
		$str .= ('<skill skillid="' . $id . '" level="' . $skill[$vocation][$id] . '" tries="0"/>' . "\n");

	return $str;
}

function equip($vocation)
{
	require('config.php');
	$str = "";

	for ($id = 1; $id <= 10; $id++)
	{
		if ($equip[$vocation][$id-1] != 0)
		{
			$str .= ('<slot slotid="' . $id . '"><item id="' . $equip[$vocation][$id-1] . '"');
			if ($id == 3)	// backpack
				$str .= ('><inside>' . $bp[$vocation] . '</inside></item>');
			else
				$str .= ('/>');
			$str .= ('</slot>' . "\n");
		}
	}

	return $str;
}

function newacc()
{
	require('config.php');
	$nick = $_POST['nick'];
	$sex = $_POST['sex'];
	$vocation = $_POST['vocation'];
	$spawn = $_POST['spawn'];
	$account = $_POST['account'];
	$pass = $_POST['pass'];

	($pass != $account) or die ('Password is same as account number!');
	($pass != $nick) or die ('Password is same as character name!');
	($pass != 'tibia' && $pass != 'lol') or die ('Password is too simple!');

	($sex == 0 || $sex == 1) or die ('Invalid sex!');
	($vocation >= 1 && $vocation <= 4) or die ('Invalid vocation!');
	($account >= 100000 && $account <= 999999) or die ('Invalid account number!');
	preg_match("/^[a-zA-Z][a-zA-Z ]*$/", $nick) or die ('Name contains illegal characters!');
	preg_match("/^[a-zA-Z0-9]+$/", $pass) or die ('Password contains illegal characters!');
	!preg_match("/^gm/i", $nick) or die ('GM is only one!');
	!preg_match("/^demon/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^dragon lord/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^fire devil/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^monk/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^dragon/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^serpent spawn/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^giant spider/i", $nick) or die ('This Monsters is only one!');
	!preg_match("/^noob/i", $nick) or die ('Realy you are noob?');
	!preg_match("/^tutor/i", $nick) or die ('Tutors is only one!');
	!preg_match("/^gejmaster/i", $nick) or die ('GM is only one!');
	!preg_match("/^god/i", $nick) or die ('God is only one!');

	$account_file = "$diraccount/$account.xml";
	$player_file = "$dirplayer/$nick.xml";
	$vip_file = "$dirvip/$account.xml";

	!file_exists($account_file) or die ('Taki numer konta jest juz uzywany!');
	!file_exists($player_file) or die ("Postac o imieniu $nick jest juz uzywana sprubuj inny nick!");

	$file = fopen($account_file, 'w');
	fwrite($file,
'<?xml version="1.0"?>
<account pass="' . $pass . '" type="1" premDays="1">
<characters>
	<character name="' . $nick . '"/>
</characters>
</account>');
	fclose($file);

	$file = fopen($player_file, 'w');
	fwrite($file,
'<?xml version="1.0"?>
<player name="' . $nick . '" account="' . $account . '" sex="' . $sex . '" lookdir="1" exp="' . $exp . '" voc="' . $vocation . '" level="' . $lvl . '" access="0" cap="' . $cap . '" maglevel="' . $mlvl[$vocation] . '" lastlogin="0" premticks="3600" promoted="1">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="' . $spawnz . '"/>
<temple x="' . $templex . '" y="' . $templey . '" z="' . $templez . '"/>
<spawn x="' . $spawnx[$spawn] . '" y="' . $spawny[$spawn] . '" z="' . $spawnz[$spawn] . '"/>
<temple x="' . $templex[$spawn] . '" y="' . $templey[$spawn] . '" z="' . $templez[$spawn] . '"/>
<health now="' . $health[$vocation] . '" max="' . $health[$vocation] . '" food="0"/>
<mana now="' . $mana[$vocation] . '" max="' . $mana[$vocation] . '" spent="0"/>
<look type="' . $look[$vocation][$sex] . '" head="20" body="30" legs="40" feet="50"/>
<skills>' . "\n" . skills($vocation) . '</skills>
<inventory>' . equip($vocation) . '</inventory>
<depots><depot depotid="4"><item id="2590"><inside><item id="2594"/></inside></item></depot><depot depotid="3"><item id="2590"><inside><item id="2594"/></inside></item></depot><depot depotid="2"><item id="2590"><inside><item id="2594"/></inside></item></depot><depot depotid="1"><item id="2590"><inside><item id="2594"/></inside></item></depot></depots>
<storage/>
</player>');
	fclose($file);

	$file = fopen($vip_file, 'w');
	fwrite($file,
'<?xml version="1.0"?>
<vips/>');
	fclose($file);

	print "Account $account is created! <br> "; 
	print "Your password is $pass! <br> ";  
}

newacc();
?>
</center></div>
  </form>
  <div align="center"> 
    <table width="40%" border="0" cellpadding="2" cellspacing="2">
      <tr> 
        <td> 
          <div align="center">Account Maker created by Guts!<br />
            <a href="http://www.otscenter.pl/">www.otscenter.pl</a> - <span class="style1">Polish World of OTS
          </span></div>
          <div align="center"></div>
          <div align="center"></div></td>
      </tr>
    </table>
    <br />
    <br />
  </div>
</div>
</body>
</html>
