TimeCapsule/supinfo/header.php

46 lines
1.3 KiB
PHP

<?php
session_start();
$bdd = new PDO('mysql:host=mysql5-5.pro;dbname=crystalysup', 'crystalysup', 'Supinf0');
$bdd->query('SET NAMES UTF8');
if (isset($_POST['ID'])) {
$_SESSION['ID'] = $_POST['ID'];
}
if (!isset($_SESSION['ID'])) {
header("Status: 301 Moved Permanently", false, 301);
header("Location: index.html");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Laboratoire Supinfo des Technologies Microsoft</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<img alt="Background" id="background" src="imgs/Windows_7_Logon_Reloaded.jpg" />
<a id="mini_logo" href="report.php"><img alt="Mini Logo" src="imgs/Supinfo_mini.png" /></a>
<?php
$sql = $bdd->query('SELECT id FROM users');
$trouver = false;
while ($result = $sql->fetch()) {
if ($result['id'] == $_SESSION['ID']) {
$trouver = true;
}
}
if (!$trouver) {
echo '<div style="color:red;text-align:center">Tu ne fais pas parti du Laboratoire Microsoft d\'Orléans<br/>Allez, oust ! Du balais :P<br/><br/><a href="index.html">Retour à l\'acceuil</a></div>';
mysql_close();
exit();
}
?>