<?php
session_start();
include('classes/PlayerAccount.php');
include_once('config.inc.php');

$r_smo_db=mysql_connect($s_host,$s_user,$s_password);
mysql_select_db($s_database,$r_smo_db);

if(!isset($b_need_connect))
	$b_need_connect=false;

if($b_need_connect==true && (!isset($_SESSION['connected']) || $_SESSION['connected']==false))
	header('Location: index.php');

$o_player=new PlayerAccount();

if(isset($_SESSION['connected']) && $_SESSION['connected']==true)
	$o_player->SetPlayer($_SESSION["pseudo"],base64_decode($_SESSION["password"]));

$s_statut="Inconnu";
$s_color="#ec883f";

$s_result=shell_exec("ps -C ".$s_bin_name." 2> /dev/null | grep ".$s_bin_name);
if($s_result!="") 
{
	$s_statut="En ligne";
	$s_color="#9df26a";
}
else
{
	shell_exec("nohup ".$s_bin_path.$s_bin_name." > /dev/null &");
	sleep(1);
	$s_result=shell_exec("ps -C ".$s_bin_name." 2> /dev/null | grep ".$s_bin_name);
	if($s_result!="") 
	{
		$s_statut="Serveur Redémarré";
		$s_color="#ec883f";
	}
	else
	{
		$s_statut="Problème Serveur Signalé";
		if($b_send_error_mail)
			mail($s_error_mail,$s_mail_object,$s_mail_body);
		$s_color="#f03248";
	}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
	<title></title>
   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
	<meta http-equiv="imagetoolbar" content="no"/>
	<meta name="Indentifier-URL" content="http://www.stepmaniaonline.fr"/>
	<meta name="description" content="Serveur Stepmania Online Français "/>
	<meta name="keywords" content="SMO, stepmania, stepmaniaonline, online, KBMP, keyboard, ddr, dance, revolution, ITG, in the groove, PIU, pump it up,france,françe"/>
	<link rel="icon" type="image/png" href="./images/icons/favicon.png"/>
	<link rel='stylesheet' media='all' type='text/css' href='style.css'/>
	<script src="./js/setfooter.js" type="text/javascript"></script>
</head>

<body>

	<div id="w_div">
	
		<div id="h_div">
			<div id="h_div_1a"></div>
			<div id="h_div_1b" class="svinfo">
				<p><b>Serveur :</b> 81.80.167.186<br/><b>Statut : <font color="<?php echo $s_color;?>"><?php echo $s_statut;?></font></b><br/><b>Joueurs:</b>???</p>
				<?php
				if(isset($_SESSION['connected']) && $_SESSION['connected']==true)
				{
					?>
					<br/><div id="h_div_cnx" class="cnxstyle">|<b>Mes Contrôles :</b> <a href="player-stats.php">Mes Statistiques</a> <b>-</b><a href="connect.php?act=deconnect">Déconnexion</a>|</div>
					<?php
				}
				else
				{
					?>
					<br/><span id="h_div_cnx"></span>
					<?php
				}
				?>
			</div>
		</div>
		
		<?php
		if($_SERVER['PHP_SELF']=="/player-stats.php")
			$s_div="stats";
		else
			$s_div="c";
		
		if(isset($_SESSION['connected']) && $_SESSION['connected']==true)
		{
			?>
			<div id="<?php echo $s_div;?>_div">
				<center>
				<div id="menu_div">
					<a href="index.php"><span id="menu_div_1a"></span></a>
					<a href="news.php"><span id="menu_div_1b"></span></a>				
					<a href="ranking.php"><span id="menu_div_1d"></span></a>
					<a href="general-ranking.php"></a>
					<a href="player-search.php"><span id="menu_div_1e"></span></a>
					<a href="faq.php"><span id="menu_div_1f"></span></a>
				</div>	
				</center>
			<?php
		}
		else
		{
			?>
			<div id="<?php echo $s_div;?>_div">
				<center>
				<div id="menu_div">
					<a href="index.php"><span id="menu_div_1a"></span></a>
					<a href="news.php"><span id="menu_div_1b"></span></a> 
					<a href="connect.php?act=new_account"><span id="menu_div_1c"></span></a>
					<a href="ranking.php"><span id="menu_div_1d"></span></a>
					<a href="general-ranking.php"></a> 
					<a href="player-search.php"><span id="menu_div_1e"></span></a>
					<a href="faq.php"><span id="menu_div_1f"></span></a>
					<a href="connect.php"><span id="menu_div_1g"></span></a>
				</div>	
				</center>
			<?php
		}
?>