session_start();
session_register("user", "logined");
$user = array();
$user["name"] = "UnRegistered";
$user["stat"] = "unreg";
$user["cookie"] = 0;
$user["show_mes"] = $show_mes;
$user["place_show"] = $place_show;
$user["date_format"] = $date_format;
$user["redirect"] = array("go" => $redirect["go"],
"seconds" => $redirect["seconds"],
"page" => $redirect["page"]
);
unset($redirect);
if ($do != "logout") {
if (($user_name != "" and $user_pass != "") or !empty($logined)) {
$user_b = file($users_base);
$user_f = array();
$user_f["find"] = 0;
for ($c = 0; $c < count($user_b); $c++) {
list($_name,
$_pass,
$_cookie,
$_javascript,
$_city,
$_email,
$_showemail,
$_url,
$_icq,
$_avatar,
$_stat,
$_globalstat,
$_showmes,
$_placeshow,
$_rg,
$_rs,
$_rp,
$_dateformat
) = split("::", $user_b[$c]);
if ($_name == $user_name) {
$user_f["find"] = 1;
if ($_pass == $user_pass) {
$user_f["login"] = 1;
$user_f["c"] = $c;
} else {
$user_f["login"] = 0;
}
}
}
if ($user_f["find"] and $user_f["login"]) {
list($_name,
$_pass,
$_cookie,
$_javascript,
$_city,
$_email,
$_showemail,
$_url,
$_icq,
$_avatar,
$_stat,
$_globalstat,
$_showmes,
$_placeshow,
$_rg,
$_rs,
$_rp,
$_dateformat
) = split("::", $user_b[$user_f["c"]]);
$user["name"] = $_name;
$user["pass"] = $_pass;
$user["cookie"] = $_cookie;
$user["javascript"] = $_javascript;
$user["city"] = $_city;
$user["email"] = $_email;
$user["show_email"] = $_showemail;
$user["url"] = $_url;
$user["icq"] = $_icq;
$user["avatar"] = $_avatar;
$user["stat"] = $_stat;
$user["global_stat"] = $_globalstat;
$user["show_mes"] = $_showmes;
$user["place_show"] = $_placeshow;
$user["date_format"] = $_dateformat;
$user["redirect"] = array("go" => $rg,
"seconds" => $rs,
"page" => $rp,
);
$logined = 1;
} else {
$logined = 0;
}
unset($user_b);
unset($user_f);
}
if ($user["stat"] != "unreg") {
if ($user["cookie"]) {
setcookie("user_name", $user["name"], 2 * time());
setcookie("user_pass", $user["pass"], 2 * time());
} else {
setcookie("user_name", $user["name"]);
setcookie("user_pass", $user["pass"]);
}
}
} else {
session_destroy();
setcookie("user_name", "", 2 * time());
setcookie("user_pass", "", 2 * time());
$user_name = "";
$user_pass = "";
unset($user);
$user = array();
$user["name"] = "UnRegistered";
$user["stat"] = "unreg";
$user["cookie"] = 0;
$user["show_mes"] = $show_mes;
$user["place_show"] = $place_show;
}