Файл: index.php
Строк: 94
<?php
include_once("settings.php");
include_once("param.php");
include_once("player.php");
include_once("constants.php");
include_once("players.php");
include_once("things.php");
include_once("phpbb.php");
if(!isset($_GET["mode"])){
$mode="";
}else{
$mode=$_GET["mode"];
}
if($mode=="login")
{
//destroy session
session_start();
session_unset();
session_destroy();
if(!isset($_POST["name"]) || !isset($_POST["password"])){
header("Location: index.php");
exit();
}
$name=$_POST["name"];
$password=$_POST["password"];
$player = new CPlayer($db,0);
$vnum=$player->checkPlayer($name,$password);
if(!$vnum){
header("Location: index.php?info_msg=1");
exit();
}
$pass=md5($password);
session_register("vnum");
session_register("pass");
$player->setVnum($vnum);
$player->setPlayerActivity();
//set ip for player
$ip=getUserIP();
$ip_cur_last=$player->getCurIP();
$player->setLastIP($ip_cur_last);
$player->setCurIP($ip);
//set last time
$ts = time();
$player->setLastActive($ts);
header("Location: area.php");
exit();
}
if(isset($info_msg))
{
if($info_msg==1){
$info_msg="пЫЙВЛБ";
}
$smarty->assign('INFO_MSG',$info_msg);
}
$players = new CPlayers($db);
$things = new CThings($db);
$smarty->assign('PROJECT_NAME',PROJECT_NAME);
$head=$smarty->fetch($templ_path.'/head.tpl');
$smarty->assign('HEAD',$head);
$header=$smarty->fetch($templ_path.'/index_head.tpl');
$smarty->assign('HEADER',$header);
$intro=$smarty->fetch($templ_path.'/intro.tpl');
$smarty->assign('INTRO',$intro);
$phpbb=showPHPBB($db);
$smarty->assign('PHPBB',$phpbb);
$count_player = $players->getCountPlayers();
$smarty->assign('PLAYERS',$count_player);
$count_player_online = $players->getOnlinePlayers();
$smarty->assign('PLAYERS_ONLINE',$count_player_online);
$count_things = $things->getCountThings();
$smarty->assign('THINGS',$count_things);
$login=$smarty->fetch($templ_path.'/login.tpl');
$smarty->assign('LOGIN',$login);
//get message from forum
$text=showNews($db);
$smarty->assign('NEWS',$text);
//add counter
$text=$smarty->fetch($templ_path.'/counter.tpl');
$smarty->assign('COUNTER',$text);
//main page
$text=$smarty->fetch($templ_path.'/index.tpl');
echo($text);
include_once("free_all.php");
?>