error function

This commit is contained in:
gnieark 2015-11-27 22:25:57 +01:00
parent 66e7650ae6
commit 1f457dd4c4
2 changed files with 16 additions and 3 deletions

View File

@ -24,13 +24,13 @@ if(isset($_GET['arena'])){
//check if arena is list //check if arena is list
$currentArena = false; $currentArena = false;
foreach($arenas as $arena){ foreach($arenas as $arena){
if($arena['id'] == $GET['arena']){ if($arena['id'] == $_GET['arena']){
$currentArena = $GET['arena']; $currentArena = $_GET['arena'];
break; break;
} }
} }
if(!$currentArena){ if(!$currentArena){
error("Wrong parameter"); error(404,"Wrong parameter");
die; die;
} }
}else{ }else{

View File

@ -79,4 +79,17 @@ function get_language_array(){
include (__DIR__."/../lang/".$language.".php"); include (__DIR__."/../lang/".$language.".php");
return $lang; return $lang;
}
function error($code,$message){
switch($error){
case 404:
header("HTTP/1.0 404 Not Found");
echo '<!DOCTYPE html><html lang="fr"><head><meta charset="UTF-8" /><title>Page Not found</title></head><body><p>'.$message.'</p></body></html>';
die;
default:
die;
break;
}
} }