Witam!! To znowoz ja!! heh
mam problem chce zrobic strone w ktorej jest formularz i on ma mi utworzyc nowy plik z rozszezeniem .php
i do niego zapisac dane w formie php. No i w tym problem nie wiem jak to zrobic. Wzorowalem sie z accmakera do ots. zmienialem kod:
<?php
include 'checkunique.php';
require '../config.php';
echo "<title>$site</title>"; echo '<link rel="stylesheet" href="style/style.css" type="text/css">';
$delay = "0";
$url = "index.php";
include 'redir.php';
include 'logout.inc';
$_SESSION['page'] = 'addchar.php';
echo "<title>$site by Isecross, Otfans.pl</title>"; 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'); // This is the config with paths
$nick = $_POST['nick'];
$charname = $nick;
$sex = $_POST['sex'];
$vocation = $_POST['vocation'];
$account = $_SESSION['user'];
$cookiename = md5($ip_serwera); $cookievalue = $cookiename;
$city = $_POST['city'];
($sex == 0
|| $sex == 1
) or
die ('Invalid sex!'); ($vocation >= 1
&& $vocation <= 4
) or
die ('Invalid vocation!');
if($sizeacc == "7"){
($account >= 1000000
&& $account <= 9999999
) or
die ('Niepoprawny account number!'); // Six numbers }
else if($sizeacc == "6"){
($account >= 100000
&& $account <= 999999
) or
die ('Niepoprawny account number!'); // Five numbers }
else{
($account >= 100000
&& $account <= 999999
) or
die ('Niepoprawny account number!'); // If not found then Five numbers. }
// ($account >= 100000 && $account <= 999999) or die ('Niepoprawny account number!'); // This is the old shit
preg_match("/^[a-zA-Z][a-zA-Z ]*$/", $nick) or
die ('Nick zawiera niedozwolone znaki!'); ($_COOKIE[$cookiename] != $cookievalue) or
die ('Nie możesz założyć już dzisiaj postaci. Spróbuj jutro.');
$diraccount = $folderacc;
$dirplayer = $folderplayer;
$account_file = "$diraccount/$account.xml";
$player_file = "$dirplayer/$nick.xml";
$myfile = ''.$folderacc.''.$account.'.xml';
//account file
$fh = fopen($myfile, 'r'); $tmpsrch = strpos($data, '</characters>'); $leftbit = substr($data, 0
, $tmpsrch); $rightbit = substr($data, $tmpsrch);
$charfile = ''.$folderplayer.'' . $nick . '.xml';
$_SESSION['msg'] = 'Postać o takim nicku już istnieje.';
}
else
{
//$accno, $charname, $voc, $sex
$filedata = $leftbit . '<character name="' . $charname . '" />
' . $rightbit;
$accno = $_SESSION['user'];
$fg = fopen($myfile, 'w');
$file = fopen($player_file, 'w'); '<?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" promoted="0" banned="0">
<spawn x="' . $sx[$city] . '" y="' . $sy[$city] . '" z="' . $sz[$city] . '"/>
<temple x="' . $tx[$city] . '" y="' . $ty[$city] . '" z="' . $tz[$city] . '"/>
<health now="' . $health[$vocation] . '" max="' . $health[$vocation] . '" food="0"/>
<mana now="' . $mana[$vocation] . '" max="' . $mana[$vocation] . '" spent="0"/>
<look type="' . $look[$vocation][$sex] . '" head="0" body="127" legs="0" feet="114"/>
<skills>' . "n" . skills($vocation) . '</skills>
<inventory>' . equip($vocation) . '</inventory>
<depots><depot depotid="1"><item id="2590"><inside><item id="2594"/></inside></item></depot></depots>
<storage/>
</player>');
$h = '3600';
$time = $t + $h * $new_acc_time;
print "<b>Postac $nick założona pomy¶lnie!</b>"; include 'success.php';
}
}
newacc();
?>
</center>
no i nic prosze o pomoc.<PLS>
Z góry
THX