|
<?
|
|
//uklada uzivatele do souboru users.dat
|
|
session_start();
|
|
|
|
include "kontrola_formu.php";
|
|
include "vezmi.php";
|
|
|
|
$nazvy_v_menu=file("../menu.dat");
|
|
|
|
if (file_exists("../servers/servers.dat")) $servers=file("../servers/servers.dat");
|
|
|
|
|
|
if ($_POST['smazano']) {
|
|
unset($_SESSION["prihlas_jmeno".$_POST['smazat_co']]);
|
|
$akce="smazano";
|
|
}
|
|
|
|
if ($_POST['ulozeno'] || $_POST['smazano']) {
|
|
|
|
foreach($_POST as $ind => $val) $_SESSION[$ind]=$val;
|
|
if ($_POST['icko']==$_SESSION['pocet_users']) {
|
|
$akce="vytvoreno";
|
|
$_SESSION['pocet_users']++;
|
|
}
|
|
else if ($akce=="") $akce="upraveno";
|
|
|
|
$uzivatele="";
|
|
for ($i=0;$i<$_SESSION['pocet_users'];$i++) {
|
|
if ($_SESSION["prihlas_jmeno".$i]=="") continue;
|
|
$uzivatele .= $_SESSION["prihlas_jmeno".$i].";";
|
|
if ($_GET['novy']==1 && $i==$_GET['jaky']) $uzivatele .= md5($_SESSION["heslo".$i]).";";
|
|
else $uzivatele .= $_SESSION["heslo".$i].";";
|
|
$uzivatele .= $_SESSION["jmeno".$i].";";
|
|
$uzivatele .= $_SESSION["email".$i].";";
|
|
$uzivatele .= $_SESSION["poznamka".$i].";";
|
|
if ($i==$_GET['jaky'] && $_GET['jaky']!="") {
|
|
for ($u=0;$u<sizeof($nazvy_v_menu);$u++)
|
|
if ($_SESSION["pravaM".$i."_".$u]!="") $uzivatele .= $_SESSION["pravaM".$i."_".$u];
|
|
for ($u=0;$u<sizeof($servers);$u++)
|
|
if ($_SESSION["pravaS".$i."_".$u]!="") $uzivatele .= $_SESSION["pravaS".$i."_".$u];
|
|
}
|
|
else $uzivatele .= chop($_SESSION["prava".$i]);
|
|
$uzivatele .= "\n";
|
|
}
|
|
$fp=fopen("users.dat", "w");
|
|
fwrite($fp, $uzivatele);
|
|
fclose($fp);
|
|
//echo nl2br($uzivatele);
|
|
foreach($_SESSION as $ind => $val) {
|
|
if (!strstr($ind,"online_user")) $_SESSION[$ind]="";
|
|
}
|
|
if ($_POST['smazano']) header ("Location: ../index.php?id=users&akce=".$akce."&lng=".$_GET['lng']."&smazat=user&jaky=".$_POST['icko']."&".SID."");
|
|
if ($_POST['ulozeno']) header ("Location: ../index.php?id=users&akce=".$akce."&lng=".$_GET['lng']."&jaky=".$_POST['icko']."&".SID."");
|
|
}
|
|
?>
|