|
<?
|
|
//uklada uzivatele do souboru servers.dat
|
|
session_start();
|
|
|
|
include "kontrola_formu.php";
|
|
|
|
if ($_POST['smazano']) {
|
|
$adr_files="../files/".$_SESSION["s_ipadresa".$_POST['smazat_co']];
|
|
|
|
$slozka = dir($adr_files);
|
|
while($soubor=$slozka->read()) {
|
|
if ($soubor=="." || $soubor=="..") continue;
|
|
unlink($adr_files."/".$soubor);
|
|
}
|
|
$slozka->close();
|
|
|
|
rmdir($adr_files);
|
|
unset($_SESSION["s_ipadresa".$_POST['smazat_co']]);
|
|
$akce="smazano";
|
|
}
|
|
|
|
if ($_POST['ulozeno'] || $_POST['smazano']) {
|
|
foreach($_POST as $ind => $val) $_SESSION[$ind]=$val;
|
|
if ($_POST['icko']==$_SESSION['pocet_servers']) {
|
|
$akce="vytvoreno";
|
|
$_SESSION['pocet_servers']++;
|
|
}
|
|
else if ($akce=="") $akce="upraveno";
|
|
|
|
$servery="";
|
|
for ($i=0;$i<$_SESSION['pocet_servers'];$i++) {
|
|
if ($_SESSION["s_ipadresa".$i]=="") continue;
|
|
$servery .= $_SESSION["s_ipadresa".$i].";".$_SESSION["s_poznamka".$i]."\n";
|
|
}
|
|
if (!file_exists("../files/".$_SESSION["s_ipadresa".$_POST['icko']]) && $_SESSION["s_ipadresa".$_POST['icko']]!="") {
|
|
mkdir("../files/".$_SESSION["s_ipadresa".$_POST['icko']], 0777);
|
|
}
|
|
$fp=fopen("servers.dat", "w");
|
|
fwrite($fp, $servery);
|
|
fclose($fp);
|
|
//echo nl2br($servery);
|
|
foreach($_SESSION as $ind => $val) {
|
|
if (!strstr($ind,"online_user")) $_SESSION[$ind]="";
|
|
}
|
|
if ($_POST['smazano']) header ("Location: ../index.php?id=servers&akce=".$akce."&lng=".$_GET['lng']."&smazat=server&".SID."");
|
|
if ($_POST['ulozeno']) header ("Location: ../index.php?id=servers&akce=".$akce."&lng=".$_GET['lng']."&jaky=".$_POST['icko']."&".SID."");
|
|
}
|
|
?>
|