File size: 2.18Kb
<?php
if ($_POST['auth_user'] == 'auth' && !isset($_SESSION['user_login']))
{
if ($_POST['login'] != "" and $_POST['pass'] != "")
{
$login = substr(htmlspecialchars(strtolower($_POST['login'])),0,20);
$pass_in = md5(substr(htmlspecialchars($_POST['pass']),0,20));
if (is_dir('user/'.$login))
{
include($cms.'user/'.$login.'/profile.php');
if ($pass_in == $pass)
{
$_SESSION['user_login'] = $login;
$_SESSION['cms_theme'] = file_get_contents($cms.'user/'.$_SESSION['user_login'].'/tema.txt');
}
}
}
}
if ($_POST['auth_user'] == 'exit' && isset($_SESSION['user_login']))
{
session_destroy();
exit('<script type="text/javascript">
document.location.href="'.$_SERVER['REQUEST_URI'].'";
</script>');
}
if ($_SESSION['login'] == '')
$_SESSION['login'] = $_SERVER['REMOTE_ADDR']; // login - ip пользователя
if (is_file($cms.'user/'.$_SESSION['user_login'].'/profile.php'))
{
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/balans.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/balans.txt', "w+");
fwrite ($fp, '0');
fclose ($fp);
}
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/mess_stat.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/mess_stat.txt', "w+");
fclose ($fp);
}
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/mess_in.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/mess_in.txt', "w+");
fclose ($fp);
}
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/avatar.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/avatar.txt', "w+");
fwrite ($fp, 'moduls/avatar/cms_avatar/Dolphin.jpg');
fclose ($fp);
@mkdir($cms.'moduls/avatar/user_avatar/'.$_SESSION['user_login'].'/',0777);
}
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/tema.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/tema.txt', "w+");
fwrite ($fp, $cms_theme_UP);
fclose ($fp);
}
if (!is_file($cms.'user/'.$_SESSION['user_login'].'/x_status.txt'))
{
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/x_status.txt', "w+");
fwrite ($fp, 'Только прибывший');
fclose ($fp);
}
}
?>