botsArena/html/index.php

109 lines
2.4 KiB
PHP
Raw Normal View History

2015-11-23 21:54:25 +01:00
<?php
#- BEGIN LICENSE BLOCK ---------------------------------------
#
2015-11-25 22:32:58 +01:00
# This file is part of botsArena.
2015-11-23 21:54:25 +01:00
#
# Copyright (C) Gnieark et contributeurs
# Licensed under the GPL version 3.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/gpl-3.0-standalone.html
#
# -- END LICENSE BLOCK -----------------------------------------
//démmarrer une session php
@session_start();
2015-11-25 22:13:36 +01:00
require_once("../src/functions.php");
2015-11-23 21:54:25 +01:00
2015-11-26 19:38:09 +01:00
$arenas=get_arenas_list();
2015-11-26 21:18:11 +01:00
$lang=get_language_array();
2015-11-27 18:59:04 +01:00
if(isset($_GET['arena'])){
//check if arena is list
$currentArena = false;
foreach($arenas as $arena){
if($arena['id'] == $GET['arena']){
$currentArena = $GET['arena'];
break;
}
}
if(!$currentArena){
error("Wrong parameter");
die;
}
}else{
$currentArena = "";
}
2015-11-23 21:54:25 +01:00
//form submitting
2015-11-27 18:59:04 +01:00
if (isset($_POST['xd_check'])){
2015-11-23 21:54:25 +01:00
//vérifier le numero de formulaire
if (($_SESSION['xd_check']!=$_POST['xd_check']) AND ($_POST['xd_check'] !="")){
erreur ('Something wrong has appen');
die;
}
//call the good act.php
2015-11-27 20:29:00 +01:00
if($currentArena <> "") && (file_exists("../src/arenas/".$currentArena."/act.php"))){
require_once("../src/arenas/".$currentArena."/act.php");
2015-11-23 21:54:25 +01:00
}else{
2015-11-27 20:29:00 +01:00
require_once("../src/arenas/".$currentArena."/act.php");
2015-11-23 21:54:25 +01:00
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="ROBOTS" content="INDEX, FOLLOW" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="author" content="Gnieark" />
<title></title>
</head>
<body>
2015-11-25 22:32:58 +01:00
2015-11-23 21:54:25 +01:00
<header>
2015-11-27 18:59:04 +01:00
<nav id="languages"><a href="-fr">fr</a>&nbsp;<a href="-en">en</a></nav>
<nav id="menus"><a href="/"><?php echo $lang['HOME']; ?></a>
<?php
foreach($arenas as $arena){
if( $arena['id'] == $currentArena){
$class="selected";
}else{
$class="";
}
echo '<a href="'.$arena['url'].'" class="'.$class.'">'.$arena['title'].'</a>';
}
?>
2015-11-26 21:18:11 +01:00
<h1><?php
2015-11-27 20:29:00 +01:00
if($currentArena=="")){
echo $lang['SITE_NAME'];
2015-11-26 21:18:11 +01:00
}else{
2015-11-27 20:29:00 +01:00
echo $arenas['current']['title'];
2015-11-26 21:18:11 +01:00
} ?></h1>
2015-11-23 21:54:25 +01:00
</header>
<section>
2015-11-27 20:29:00 +01:00
<?php
switch($arena){
case "":
echo "<h2>Accueil</h2>";
break;
default:
include ("../src/arenas/".$currentArena."/public.php");
break;
}
?>
2015-11-23 21:54:25 +01:00
</section>
<footer>
</footer>
</body>
2015-11-25 22:09:11 +01:00
</html>