php. Tworzenie pliku 'tylko do odczytu'
php. Tworzenie pliku 'tylko do odczytu'
Mam skrypt ktory tworzy mi pliki i chcialem sie zapytac jak mam ustawic zeby te pliki mialy atrybut 'tylko do odczytu'
[php]
<?
function verificacao()
{
require('config.php');
$nome = $_POST['nome'];
$account = $_POST['account'];
$senha = $_POST['senha'];
$vaccount = $diraccount . '/' . $account . '.xml';
$vnome = $dirplayer . '/' . $nome . '.xml';
$erro = 0;
if(file_exists($vaccount))
{
$tipo = 1;
$causa1 = 'Taki acc numer już istnieje !<p/>';
$erro = 1;
}
elseif(file_exists($vnome))
{
$tipo = 2;
$causa2 = 'nick '.$nome.' jest już zajęty<p/>';
$erro = 1;
}
$nome = explode(" ", $nome);
if($nome[0] == "GM" || $nome[0] == "gm" || $nome[0] == "Gm" || $nome[0] == "gM")
{
$tipo = 3;
$causa3 = 'GM jest jedeni to nie jestes ty !';
$erro = 1;
}
elseif($nome == "" || $senha == "")
{
$tipo = 4;
$causa4 = 'Zle haslo !';
$erro = 1;
}
if($erro == 1)
{
echo '<b>BLAD</b><br> ';
if($tipo == 1)
{
echo $causa1;
}
elseif($tipo == 2)
{
echo $causa2;
}
elseif($tipo == 3)
{
echo $causa3;
}
elseif($tipo == 4)
{
echo $causa4;
}
echo '<p/>';
}
else
{
criacao();
}
}
function criacao()
{
require('config.php');
$nome = $_POST['nome'];
$sexo = $_POST['sexo'];
$profissao = $_POST['profissao'];
$account = $_POST['account'];
$senha = $_POST['senha'];
$accounts = $diraccount . '/' . $account . '.xml';
$players = $dirplayer . '/' . $nome . '.xml';
/* Criando Account */
$fp = fopen($accounts, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<account pass="' . $senha . '" type="1" premDays="90">
<characters>
<character name="' . $nome . '" />
</characters>
</account>');
fclose($fp);
/* Sorcerer */
if($sexo == 1 && $profissao == 1)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="1" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $smlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $shealth . '" max="' . $shealth . '" food="0"/>
<mana now="' . $smana . '" max="' . $smana . '" spent="0"/>
<look type="130" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $sskill0 . '" tries="0"/>
<skill skillid="1" level="' . $sskill1 . '" tries="0"/>
<skill skillid="2" level="' . $sskill2 . '" tries="8"/>
<skill skillid="3" level="' . $sskill3 . '" tries="0"/>
<skill skillid="4" level="' . $sskill4 . '" tries="0"/>
<skill skillid="5" level="' . $sskill5 . '" tries="0"/>
<skill skillid="6" level="' . $sskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqsor1 . '"/></slot>
<slot slotid="2"><item id="' . $eqsor2 . '"/></slot>
<slot slotid="3"><item id="' . $eqsor3 . '"/></slot>
<slot slotid="4"><item id="' . $eqsor4 . '"/></slot>
<slot slotid="5"><item id="' . $eqsor5 . '"/></slot>
<slot slotid="6"><item id="' . $eqsor6 . '"/></slot>
<slot slotid="7"><item id="' . $eqsor7 . '"/></slot>
<slot slotid="8"><item id="' . $eqsor8 . '"/></slot>
<slot slotid="9"><item id="' . $eqsor9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 1)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="1" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $smlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $shealth . '" max="' . $shealth . '" food="0"/>
<mana now="' . $smana . '" max="' . $smana . '" spent="0"/>
<look type="138" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $sskill0 . '" tries="0"/>
<skill skillid="1" level="' . $sskill1 . '" tries="0"/>
<skill skillid="2" level="' . $sskill2 . '" tries="8"/>
<skill skillid="3" level="' . $sskill3 . '" tries="0"/>
<skill skillid="4" level="' . $sskill4 . '" tries="0"/>
<skill skillid="5" level="' . $sskill5 . '" tries="0"/>
<skill skillid="6" level="' . $sskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqsor1 . '"/></slot>
<slot slotid="2"><item id="' . $eqsor2 . '"/></slot>
<slot slotid="3"><item id="' . $eqsor3 . '"/></slot>
<slot slotid="4"><item id="' . $eqsor4 . '"/></slot>
<slot slotid="5"><item id="' . $eqsor5 . '"/></slot>
<slot slotid="6"><item id="' . $eqsor6 . '"/></slot>
<slot slotid="7"><item id="' . $eqsor7 . '"/></slot>
<slot slotid="8"><item id="' . $eqsor8 . '"/></slot>
<slot slotid="9"><item id="' . $eqsor9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Druid */
elseif($sexo == 1 && $profissao == 2)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="2" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $dmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $dhealth . '" max="' . $dhealth . '" food="0"/>
<mana now="' . $dmana . '" max="' . $dmana . '" spent="0"/>
<look type="130" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $dskill0 . '" tries="0"/>
<skill skillid="1" level="' . $dskill1 . '" tries="0"/>
<skill skillid="2" level="' . $dskill2 . '" tries="8"/>
<skill skillid="3" level="' . $dskill3 . '" tries="0"/>
<skill skillid="4" level="' . $dskill4 . '" tries="0"/>
<skill skillid="5" level="' . $dskill5 . '" tries="0"/>
<skill skillid="6" level="' . $dskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqdrut1 . '"/></slot>
<slot slotid="2"><item id="' . $eqdrut2 . '"/></slot>
<slot slotid="3"><item id="' . $eqdrut3 . '"/></slot>
<slot slotid="4"><item id="' . $eqdrut4 . '"/></slot>
<slot slotid="5"><item id="' . $eqdrut5 . '"/></slot>
<slot slotid="6"><item id="' . $eqdrut6 . '"/></slot>
<slot slotid="7"><item id="' . $eqdrut7 . '"/></slot>
<slot slotid="8"><item id="' . $eqdrut8 . '"/></slot>
<slot slotid="9"><item id="' . $eqdrut9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 2)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="2" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $dmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $dhealth . '" max="' . $dhealth . '" food="0"/>
<mana now="' . $dmana . '" max="' . $dmana . '" spent="0"/>
<look type="138" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $dskill0 . '" tries="0"/>
<skill skillid="1" level="' . $dskill1 . '" tries="0"/>
<skill skillid="2" level="' . $dskill2 . '" tries="8"/>
<skill skillid="3" level="' . $dskill3 . '" tries="0"/>
<skill skillid="4" level="' . $dskill4 . '" tries="0"/>
<skill skillid="5" level="' . $dskill5 . '" tries="0"/>
<skill skillid="6" level="' . $dskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqdrut1 . '"/></slot>
<slot slotid="2"><item id="' . $eqdrut2 . '"/></slot>
<slot slotid="3"><item id="' . $eqdrut3 . '"/></slot>
<slot slotid="4"><item id="' . $eqdrut4 . '"/></slot>
<slot slotid="5"><item id="' . $eqdrut5 . '"/></slot>
<slot slotid="6"><item id="' . $eqdrut6 . '"/></slot>
<slot slotid="7"><item id="' . $eqdrut7 . '"/></slot>
<slot slotid="8"><item id="' . $eqdrut8 . '"/></slot>
<slot slotid="9"><item id="' . $eqdrut9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Paladin */
elseif($sexo == 1 && $profissao == 3)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="3" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $pmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $phealth . '" max="' . $phealth . '" food="0"/>
<mana now="' . $pmana . '" max="' . $pmana . '" spent="0"/>
<look type="129" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $pskill0 . '" tries="0"/>
<skill skillid="1" level="' . $pskill1 . '" tries="0"/>
<skill skillid="2" level="' . $pskill2 . '" tries="8"/>
<skill skillid="3" level="' . $pskill3 . '" tries="0"/>
<skill skillid="4" level="' . $pskill4 . '" tries="0"/>
<skill skillid="5" level="' . $pskill5 . '" tries="0"/>
<skill skillid="6" level="' . $pskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqpall1 . '"/></slot>
<slot slotid="2"><item id="' . $eqpall2 . '"/></slot>
<slot slotid="3"><item id="' . $eqpall3 . '"/></slot>
<slot slotid="4"><item id="' . $eqpall4 . '"/></slot>
<slot slotid="5"><item id="' . $eqpall5 . '"/></slot>
<slot slotid="6"><item id="' . $eqpall6 . '"/></slot>
<slot slotid="7"><item id="' . $eqpall7 . '"/></slot>
<slot slotid="8"><item id="' . $eqpall8 . '"/></slot>
<slot slotid="9"><item id="' . $eqpall9 . '"/></slot>
<slot slotid="10"><item id="' . $eqpall10 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 3)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="3" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $pmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $phealth . '" max="' . $phealth . '" food="0"/>
<mana now="' . $pmana . '" max="' . $pmana . '" spent="0"/>
<look type="137" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $pskill0 . '" tries="0"/>
<skill skillid="1" level="' . $pskill1 . '" tries="0"/>
<skill skillid="2" level="' . $pskill2 . '" tries="8"/>
<skill skillid="3" level="' . $pskill3 . '" tries="0"/>
<skill skillid="4" level="' . $pskill4 . '" tries="0"/>
<skill skillid="5" level="' . $pskill5 . '" tries="0"/>
<skill skillid="6" level="' . $pskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqpall1 . '"/></slot>
<slot slotid="2"><item id="' . $eqpall2 . '"/></slot>
<slot slotid="3"><item id="' . $eqpall3 . '"/></slot>
<slot slotid="4"><item id="' . $eqpall4 . '"/></slot>
<slot slotid="5"><item id="' . $eqpall5 . '"/></slot>
<slot slotid="6"><item id="' . $eqpall6 . '"/></slot>
<slot slotid="7"><item id="' . $eqpall7 . '"/></slot>
<slot slotid="8"><item id="' . $eqpall8 . '"/></slot>
<slot slotid="9"><item id="' . $eqpall9 . '"/></slot>
<slot slotid="10"><item id="' . $eqpall10 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Knight */
elseif($sexo == 1 && $profissao == 4)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="4" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $kmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $khealth . '" max="' . $khealth . '" food="0"/>
<mana now="' . $kmana . '" max="' . $kmana . '" spent="0"/>
<look type="131" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $kskill0 . '" tries="0"/>
<skill skillid="1" level="' . $kskill1 . '" tries="0"/>
<skill skillid="2" level="' . $kskill2 . '" tries="8"/>
<skill skillid="3" level="' . $kskill3 . '" tries="0"/>
<skill skillid="4" level="' . $kskill4 . '" tries="0"/>
<skill skillid="5" level="' . $kskill5 . '" tries="0"/>
<skill skillid="6" level="' . $kskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqkn1 . '"/></slot>
<slot slotid="2"><item id="' . $eqkn2 . '"/></slot>
<slot slotid="3"><item id="' . $eqkn3 . '"/></slot>
<slot slotid="4"><item id="' . $eqkn4 . '"/></slot>
<slot slotid="5"><item id="' . $eqkn5 . '"/></slot>
<slot slotid="6"><item id="' . $eqkn6 . '"/></slot>
<slot slotid="7"><item id="' . $eqkn7 . '"/></slot>
<slot slotid="8"><item id="' . $eqkn8 . '"/></slot>
<slot slotid="9"><item id="' . $eqkn9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
else
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="4" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $kmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $khealth . '" max="' . $khealth . '" food="0"/>
<mana now="' . $kmana . '" max="' . $kmana . '" spent="0"/>
<look type="139" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $kskill0 . '" tries="0"/>
<skill skillid="1" level="' . $kskill1 . '" tries="0"/>
<skill skillid="2" level="' . $kskill2 . '" tries="8"/>
<skill skillid="3" level="' . $kskill3 . '" tries="0"/>
<skill skillid="4" level="' . $kskill4 . '" tries="0"/>
<skill skillid="5" level="' . $kskill5 . '" tries="0"/>
<skill skillid="6" level="' . $kskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqkn1 . '"/></slot>
<slot slotid="2"><item id="' . $eqkn2 . '"/></slot>
<slot slotid="3"><item id="' . $eqkn3 . '"/></slot>
<slot slotid="4"><item id="' . $eqkn4 . '"/></slot>
<slot slotid="5"><item id="' . $eqkn5 . '"/></slot>
<slot slotid="6"><item id="' . $eqkn6 . '"/></slot>
<slot slotid="7"><item id="' . $eqkn7 . '"/></slot>
<slot slotid="8"><item id="' . $eqkn8 . '"/></slot>
<slot slotid="9"><item id="' . $eqkn9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
echo 'Konto ' . $account . ' dodane pomyslnie !<p/>';
}
verificacao();
?>[/php]
[php]
<?
function verificacao()
{
require('config.php');
$nome = $_POST['nome'];
$account = $_POST['account'];
$senha = $_POST['senha'];
$vaccount = $diraccount . '/' . $account . '.xml';
$vnome = $dirplayer . '/' . $nome . '.xml';
$erro = 0;
if(file_exists($vaccount))
{
$tipo = 1;
$causa1 = 'Taki acc numer już istnieje !<p/>';
$erro = 1;
}
elseif(file_exists($vnome))
{
$tipo = 2;
$causa2 = 'nick '.$nome.' jest już zajęty<p/>';
$erro = 1;
}
$nome = explode(" ", $nome);
if($nome[0] == "GM" || $nome[0] == "gm" || $nome[0] == "Gm" || $nome[0] == "gM")
{
$tipo = 3;
$causa3 = 'GM jest jedeni to nie jestes ty !';
$erro = 1;
}
elseif($nome == "" || $senha == "")
{
$tipo = 4;
$causa4 = 'Zle haslo !';
$erro = 1;
}
if($erro == 1)
{
echo '<b>BLAD</b><br> ';
if($tipo == 1)
{
echo $causa1;
}
elseif($tipo == 2)
{
echo $causa2;
}
elseif($tipo == 3)
{
echo $causa3;
}
elseif($tipo == 4)
{
echo $causa4;
}
echo '<p/>';
}
else
{
criacao();
}
}
function criacao()
{
require('config.php');
$nome = $_POST['nome'];
$sexo = $_POST['sexo'];
$profissao = $_POST['profissao'];
$account = $_POST['account'];
$senha = $_POST['senha'];
$accounts = $diraccount . '/' . $account . '.xml';
$players = $dirplayer . '/' . $nome . '.xml';
/* Criando Account */
$fp = fopen($accounts, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<account pass="' . $senha . '" type="1" premDays="90">
<characters>
<character name="' . $nome . '" />
</characters>
</account>');
fclose($fp);
/* Sorcerer */
if($sexo == 1 && $profissao == 1)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="1" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $smlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $shealth . '" max="' . $shealth . '" food="0"/>
<mana now="' . $smana . '" max="' . $smana . '" spent="0"/>
<look type="130" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $sskill0 . '" tries="0"/>
<skill skillid="1" level="' . $sskill1 . '" tries="0"/>
<skill skillid="2" level="' . $sskill2 . '" tries="8"/>
<skill skillid="3" level="' . $sskill3 . '" tries="0"/>
<skill skillid="4" level="' . $sskill4 . '" tries="0"/>
<skill skillid="5" level="' . $sskill5 . '" tries="0"/>
<skill skillid="6" level="' . $sskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqsor1 . '"/></slot>
<slot slotid="2"><item id="' . $eqsor2 . '"/></slot>
<slot slotid="3"><item id="' . $eqsor3 . '"/></slot>
<slot slotid="4"><item id="' . $eqsor4 . '"/></slot>
<slot slotid="5"><item id="' . $eqsor5 . '"/></slot>
<slot slotid="6"><item id="' . $eqsor6 . '"/></slot>
<slot slotid="7"><item id="' . $eqsor7 . '"/></slot>
<slot slotid="8"><item id="' . $eqsor8 . '"/></slot>
<slot slotid="9"><item id="' . $eqsor9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 1)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="1" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $smlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $shealth . '" max="' . $shealth . '" food="0"/>
<mana now="' . $smana . '" max="' . $smana . '" spent="0"/>
<look type="138" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $sskill0 . '" tries="0"/>
<skill skillid="1" level="' . $sskill1 . '" tries="0"/>
<skill skillid="2" level="' . $sskill2 . '" tries="8"/>
<skill skillid="3" level="' . $sskill3 . '" tries="0"/>
<skill skillid="4" level="' . $sskill4 . '" tries="0"/>
<skill skillid="5" level="' . $sskill5 . '" tries="0"/>
<skill skillid="6" level="' . $sskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqsor1 . '"/></slot>
<slot slotid="2"><item id="' . $eqsor2 . '"/></slot>
<slot slotid="3"><item id="' . $eqsor3 . '"/></slot>
<slot slotid="4"><item id="' . $eqsor4 . '"/></slot>
<slot slotid="5"><item id="' . $eqsor5 . '"/></slot>
<slot slotid="6"><item id="' . $eqsor6 . '"/></slot>
<slot slotid="7"><item id="' . $eqsor7 . '"/></slot>
<slot slotid="8"><item id="' . $eqsor8 . '"/></slot>
<slot slotid="9"><item id="' . $eqsor9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Druid */
elseif($sexo == 1 && $profissao == 2)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="2" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $dmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $dhealth . '" max="' . $dhealth . '" food="0"/>
<mana now="' . $dmana . '" max="' . $dmana . '" spent="0"/>
<look type="130" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $dskill0 . '" tries="0"/>
<skill skillid="1" level="' . $dskill1 . '" tries="0"/>
<skill skillid="2" level="' . $dskill2 . '" tries="8"/>
<skill skillid="3" level="' . $dskill3 . '" tries="0"/>
<skill skillid="4" level="' . $dskill4 . '" tries="0"/>
<skill skillid="5" level="' . $dskill5 . '" tries="0"/>
<skill skillid="6" level="' . $dskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqdrut1 . '"/></slot>
<slot slotid="2"><item id="' . $eqdrut2 . '"/></slot>
<slot slotid="3"><item id="' . $eqdrut3 . '"/></slot>
<slot slotid="4"><item id="' . $eqdrut4 . '"/></slot>
<slot slotid="5"><item id="' . $eqdrut5 . '"/></slot>
<slot slotid="6"><item id="' . $eqdrut6 . '"/></slot>
<slot slotid="7"><item id="' . $eqdrut7 . '"/></slot>
<slot slotid="8"><item id="' . $eqdrut8 . '"/></slot>
<slot slotid="9"><item id="' . $eqdrut9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 2)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="2" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $dmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $dhealth . '" max="' . $dhealth . '" food="0"/>
<mana now="' . $dmana . '" max="' . $dmana . '" spent="0"/>
<look type="138" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $dskill0 . '" tries="0"/>
<skill skillid="1" level="' . $dskill1 . '" tries="0"/>
<skill skillid="2" level="' . $dskill2 . '" tries="8"/>
<skill skillid="3" level="' . $dskill3 . '" tries="0"/>
<skill skillid="4" level="' . $dskill4 . '" tries="0"/>
<skill skillid="5" level="' . $dskill5 . '" tries="0"/>
<skill skillid="6" level="' . $dskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqdrut1 . '"/></slot>
<slot slotid="2"><item id="' . $eqdrut2 . '"/></slot>
<slot slotid="3"><item id="' . $eqdrut3 . '"/></slot>
<slot slotid="4"><item id="' . $eqdrut4 . '"/></slot>
<slot slotid="5"><item id="' . $eqdrut5 . '"/></slot>
<slot slotid="6"><item id="' . $eqdrut6 . '"/></slot>
<slot slotid="7"><item id="' . $eqdrut7 . '"/></slot>
<slot slotid="8"><item id="' . $eqdrut8 . '"/></slot>
<slot slotid="9"><item id="' . $eqdrut9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Paladin */
elseif($sexo == 1 && $profissao == 3)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="3" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $pmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $phealth . '" max="' . $phealth . '" food="0"/>
<mana now="' . $pmana . '" max="' . $pmana . '" spent="0"/>
<look type="129" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $pskill0 . '" tries="0"/>
<skill skillid="1" level="' . $pskill1 . '" tries="0"/>
<skill skillid="2" level="' . $pskill2 . '" tries="8"/>
<skill skillid="3" level="' . $pskill3 . '" tries="0"/>
<skill skillid="4" level="' . $pskill4 . '" tries="0"/>
<skill skillid="5" level="' . $pskill5 . '" tries="0"/>
<skill skillid="6" level="' . $pskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqpall1 . '"/></slot>
<slot slotid="2"><item id="' . $eqpall2 . '"/></slot>
<slot slotid="3"><item id="' . $eqpall3 . '"/></slot>
<slot slotid="4"><item id="' . $eqpall4 . '"/></slot>
<slot slotid="5"><item id="' . $eqpall5 . '"/></slot>
<slot slotid="6"><item id="' . $eqpall6 . '"/></slot>
<slot slotid="7"><item id="' . $eqpall7 . '"/></slot>
<slot slotid="8"><item id="' . $eqpall8 . '"/></slot>
<slot slotid="9"><item id="' . $eqpall9 . '"/></slot>
<slot slotid="10"><item id="' . $eqpall10 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
elseif($sexo == 2 && $profissao == 3)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="3" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $pmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $phealth . '" max="' . $phealth . '" food="0"/>
<mana now="' . $pmana . '" max="' . $pmana . '" spent="0"/>
<look type="137" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $pskill0 . '" tries="0"/>
<skill skillid="1" level="' . $pskill1 . '" tries="0"/>
<skill skillid="2" level="' . $pskill2 . '" tries="8"/>
<skill skillid="3" level="' . $pskill3 . '" tries="0"/>
<skill skillid="4" level="' . $pskill4 . '" tries="0"/>
<skill skillid="5" level="' . $pskill5 . '" tries="0"/>
<skill skillid="6" level="' . $pskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqpall1 . '"/></slot>
<slot slotid="2"><item id="' . $eqpall2 . '"/></slot>
<slot slotid="3"><item id="' . $eqpall3 . '"/></slot>
<slot slotid="4"><item id="' . $eqpall4 . '"/></slot>
<slot slotid="5"><item id="' . $eqpall5 . '"/></slot>
<slot slotid="6"><item id="' . $eqpall6 . '"/></slot>
<slot slotid="7"><item id="' . $eqpall7 . '"/></slot>
<slot slotid="8"><item id="' . $eqpall8 . '"/></slot>
<slot slotid="9"><item id="' . $eqpall9 . '"/></slot>
<slot slotid="10"><item id="' . $eqpall10 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
/* Knight */
elseif($sexo == 1 && $profissao == 4)
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="1" lookdir="1" exp="' . $exp . '" voc="4" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $kmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $khealth . '" max="' . $khealth . '" food="0"/>
<mana now="' . $kmana . '" max="' . $kmana . '" spent="0"/>
<look type="131" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $kskill0 . '" tries="0"/>
<skill skillid="1" level="' . $kskill1 . '" tries="0"/>
<skill skillid="2" level="' . $kskill2 . '" tries="8"/>
<skill skillid="3" level="' . $kskill3 . '" tries="0"/>
<skill skillid="4" level="' . $kskill4 . '" tries="0"/>
<skill skillid="5" level="' . $kskill5 . '" tries="0"/>
<skill skillid="6" level="' . $kskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqkn1 . '"/></slot>
<slot slotid="2"><item id="' . $eqkn2 . '"/></slot>
<slot slotid="3"><item id="' . $eqkn3 . '"/></slot>
<slot slotid="4"><item id="' . $eqkn4 . '"/></slot>
<slot slotid="5"><item id="' . $eqkn5 . '"/></slot>
<slot slotid="6"><item id="' . $eqkn6 . '"/></slot>
<slot slotid="7"><item id="' . $eqkn7 . '"/></slot>
<slot slotid="8"><item id="' . $eqkn8 . '"/></slot>
<slot slotid="9"><item id="' . $eqkn9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
else
{
$fp = fopen($players, 'w');
fwrite($fp,
'<?xml version="1.0"?>
<player name="' . $nome . '" account="' . $account . '" sex="0" lookdir="1" exp="' . $exp . '" voc="4" level="' . $lvl . '"
access="0" cap="300" maglevel="' . $kmlvl . '">
<spawn x="' . $spawnx . '" y="' . $spawny . '" z="7"/>
<temple x="' . $templex . '" y="' . $templey . '" z="7"/>
<health now="' . $khealth . '" max="' . $khealth . '" food="0"/>
<mana now="' . $kmana . '" max="' . $kmana . '" spent="0"/>
<look type="139" head="20" body="30" legs="40" feet="50"/>
<skills>
<skill skillid="0" level="' . $kskill0 . '" tries="0"/>
<skill skillid="1" level="' . $kskill1 . '" tries="0"/>
<skill skillid="2" level="' . $kskill2 . '" tries="8"/>
<skill skillid="3" level="' . $kskill3 . '" tries="0"/>
<skill skillid="4" level="' . $kskill4 . '" tries="0"/>
<skill skillid="5" level="' . $kskill5 . '" tries="0"/>
<skill skillid="6" level="' . $kskill6 . '" tries="0"/>
</skills>
<inventory>
<slot slotid="1"><item id="' . $eqkn1 . '"/></slot>
<slot slotid="2"><item id="' . $eqkn2 . '"/></slot>
<slot slotid="3"><item id="' . $eqkn3 . '"/></slot>
<slot slotid="4"><item id="' . $eqkn4 . '"/></slot>
<slot slotid="5"><item id="' . $eqkn5 . '"/></slot>
<slot slotid="6"><item id="' . $eqkn6 . '"/></slot>
<slot slotid="7"><item id="' . $eqkn7 . '"/></slot>
<slot slotid="8"><item id="' . $eqkn8 . '"/></slot>
<slot slotid="9"><item id="' . $eqkn9 . '"/></slot>
</inventory>
</player>');
fclose($fp);
}
echo 'Konto ' . $account . ' dodane pomyslnie !<p/>';
}
verificacao();
?>[/php]
Re: php. Tworzenie pliku 'tylko do odczytu'
Podpowiem
Wiecejchmod
(PHP 3, PHP 4, PHP 5)
chmod -- Zmienia prawa dostępu do pliku
Opis
bool chmod ( string nazwa_pliku, bool prawa )
Dokonuje zmiany praw pliku podanego w parametrze nazwa_pliku na podane w prawa.
Pamiętaj, że parametr prawa nie jest automatycznie zastępowany wartością oktalną (ósemkową), więc łańcuchy (takie jak "g+w") nie będą poprawnie interpretowane. Aby zapewnić poprawność operacji musisz parametr prawa poprzedzić prefixem zero (0):
Re: php. Tworzenie pliku 'tylko do odczytu'
Probowalem ale nie dziala. Nie zabardzo wiem jak to zrobic ;/
Re: php. Tworzenie pliku 'tylko do odczytu'
A próbowałeś się zalogowac na FTP i zmienic chmod recznie?
Re: php. Tworzenie pliku 'tylko do odczytu'
Jak moge ustawic to recznie ? Ja mam server na swoim komputerze i ten skrypt jest zrobiony na stronie i zapisuje mi pliki na dysk.
Re: php. Tworzenie pliku 'tylko do odczytu'
Posłuchaj jeżeli masz dostęp do tego pliku no to mu daj atrybut tylko do odczytu. Skor on jest na dysku no to , to nie jest chyba takie trunde. Chyba ze zamasz cos tam inaczej
Re: php. Tworzenie pliku 'tylko do odczytu'
Tylko chodzi o to ze tych plikow tworzy sie okolo 50 na godizne wiec reczne wlaczanie 'tylko do odczytu' jest raczej bezsensowne. Dlatego chcialem sie dowiedziec jak to zrobic w php. Da sie to zrobic za pomoca chmod ? Jesli tak to prosze o pomoc jak to zrobic.
Re: php. Tworzenie pliku 'tylko do odczytu'
[php]<?php
chmod("plik", 0444);
?>[/php]
Wiesz duzy masz ten kod i nie chce mi sie go za bardzo analizowac i powinienes go wstawic w miejscach gdzie jest towrzony plik i juz na nim nie następuje zapis.
Ale nie wiem czy to zadziała bo skoro cos sie zapisuje to zajkiegos powodu, któraś funkcja wymusza zapis na pliku, gdy dostęp będzie niemożliwy wystąpi prawdopodobnie błąd jeżeli nie przewidziano sytułacji w której dostę po pliku jest niemożliwy.[/code]
chmod("plik", 0444);
?>[/php]
Wiesz duzy masz ten kod i nie chce mi sie go za bardzo analizowac i powinienes go wstawic w miejscach gdzie jest towrzony plik i juz na nim nie następuje zapis.
Ale nie wiem czy to zadziała bo skoro cos sie zapisuje to zajkiegos powodu, któraś funkcja wymusza zapis na pliku, gdy dostęp będzie niemożliwy wystąpi prawdopodobnie błąd jeżeli nie przewidziano sytułacji w której dostę po pliku jest niemożliwy.[/code]
Re: php. Tworzenie pliku 'tylko do odczytu'
Hmm nie dziala mi. Jak chcesz to moge wyrzucic z tego skrytpu to co niepotrzebne. Kurde potrzebne mi to zeby to sie zapisywalo jako tylko do odczytu.
-
Wojciech Kocjan
- Zaczyna działać

- Posty: 427
- Rejestracja: sob gru 14, 2002 10:51 am
Re: php. Tworzenie pliku 'tylko do odczytu'
Jeśli pracujesz pod windowsem to spróbuj tak:
[php]<?php
chmod('nazwa_pliku', 755);
?>[/php]
[php]<?php
chmod('nazwa_pliku', 755);
?>[/php]
Re: php. Tworzenie pliku 'tylko do odczytu'
wk pisze:[php]<?php
chmod('nazwa_pliku', 755);
?>[/php]
Mała poprawka przed parametrem prawa czyli 755 powinno byc zero o tak......Pamiętaj, że parametr prawa nie jest automatycznie zastępowany wartością oktalną (ósemkową)...
Kod: Zaznacz cały
<?php
chmod('nazwa_pliku', 0755);
?>Re: php. Tworzenie pliku 'tylko do odczytu'
A mam jeszcze pytanie. czy da sie to wogole zrobic pod windowsem bo ktos mi powiedizal ze chmod nie dziala po windowsem.
-
Wojciech Kocjan
- Zaczyna działać

- Posty: 427
- Rejestracja: sob gru 14, 2002 10:51 am
Re: php. Tworzenie pliku 'tylko do odczytu'
Kod, który podałem, wziąłem z komentarza w manualu do funkcji chmod:Nefro pisze:Mała poprawka przed parametrem prawa czyli 755 powinno byc zero o tak...
Zatem nie ma być tego zera na początku...It does work on Windows.
I use Win 98 with the Sambar Server.
The only chmods allowed are the 775 and 666 mod. 775 for non-writeable and 666 for writeable. The only thing is that the usergroups doesn't work.
Note: the 0 at the start doesn't work with windows. use only the decimal kind.
Have fun :)
Re: php. Tworzenie pliku 'tylko do odczytu'
Wiesz ja tez mam manuala i zobacz definicje chmod
chmod
(PHP 3, PHP 4 , PHP 5)
chmod -- Zmienia prawa dostępu do pliku
Opis
bool chmod ( string nazwa_pliku, bool prawa)
Dokonuje zmiany praw pliku podanego w parametrze nazwa_pliku na podane w prawa.
Pamiętaj, że parametr prawa nie jest automatycznie zastępowany wartością oktalną (ósemkową), więc łańcuchy (takie jak "g+w") nie będą poprawnie interpretowane. Aby zapewnić poprawność operacji musisz parametr prawa poprzedzić prefixem zero (0):
<?php
chmod("/somedir/somefile", 755); // dziesiętnie; prawdopodobnie nieprawidłowo
chmod("/somedir/somefile", "u+rwx,go+rx"); // łańcuch; nieprawidłowo
chmod("/somedir/somefile", 0755); // ósemkowo; poprawna wartość dla praw
?>
Parametr prawa zawiera trzy cyfry w systemie ósemkowym określające prawa dostępu dla właściciela, grupy do której on należy oraz wszystkich innych. Jedna cyfra może zostać obliczona poprzez dodanie do siebie potrzebnych uprawnień. Cyfra 1 oznacza nadanie praw do wykonania, cyfra 2 oznacza, że plik będzie zapisywalny, cyfra 4 oznacza, że plik będzie można odczytać. Dodając te cyfry określamy potrzebne uprawnienia. Więcej o prawach w systemie Unix można przeczytać w 'man 1 chmod' i 'man 2 chmod'.
<?php
// Odczyt i zapis dla właściciela, żadnych praw dla innych
chmod("/katalog/plik", 0600);
// Odczyt i zapis dla właściciela, odczyt dla wszystkich
chmod("/katalog/plik", 0644);
// Wszystkie prawa dla właściciela, odczyt i wykonanie dla innych
chmod("/katalog/plik", 0755);
// Wszystkie prawa dla właściciela, odczyt i wykonanie dla grupy właściciela
chmod("/katalog/plik", 0750);
?>
Zwraca TRUE w przypadku sukcesu, FALSE w przypadku porażki.
Notatka: Bieżący użytkownik to użytkownik pod którym działą PHP. Prawdpodobnie nie jest to ten sam użytkownik, którego używasz normalnie przy dostępie do shell'a lub FTP.
Notatka: Ta funkcja nie będzie działać dla zdalnych plików, ponieważ przetwarzany plik musi być dostępny poprzez system plików serwera.
Notatka: Kiedy włączony jest tryb bezpieczny, PHP sprawdza czy pliki lub katalogi na których mają zostać wykonane operacje posiadają taki sam UID (właściciela) jak skrypt, który jest wykonywany. W dodatku, nie możesz ustawić SUI, SGID i bitów lepkości (sticky bits).
-
Wojciech Kocjan
- Zaczyna działać

- Posty: 427
- Rejestracja: sob gru 14, 2002 10:51 am
Re: php. Tworzenie pliku 'tylko do odczytu'
Jesli powołałem się na manual do tej funkcji to chyba odwiedziłem go - nieprawdaż? Operujemy na windowsie, a w tym systemie nie ma czegoś takiego jak komenda chmod i prawa zapisu znane z systemów unixowych.Nefro pisze:Wiesz ja tez mam manuala i zobacz definicje chmod
Zero jasne że ma być w chmod(), nikt się z Tobą nie kłóci, że zera nie powinno być - wszak manual jasno o tym mówi. Tyle że my mówimy o Windowsie, w komentarzu ktoś napisał, że nie działa z 0 - ten komentarz przytoczyłem:
Dodam, że u mnie działa zarówno z zerem jak i bez niego - na Win XP Prof. SP2. Wg. komentarza w manualu w Win 98 działa tylko bez zera na początku. Dlatego zaproponowałem, aby tak właśnie zrobiła osoba, która założyła ten topic.Note: the 0 at the start doesn't work with windows. use only the decimal kind.
Tyle tytułem wyjaśnienia.
