bcom/projets.php

41 lines
1.2 KiB
PHP

<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<title>Le site de tous les bernards !</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<?php
include 'includes/head.php';
?>
Mes projets :</br>
<?php
try{
$bdd = new PDO('mysql:host=mysql.hostinger.fr;dbname=u808188674_bcom;charset=utf8', 'u808188674_bcom', '*******************');
}catch(Exception $e){
die ('Erreur : ' . $e->getMessage());
}
$req=$bdd->prepare('SELECT * FROM users WHERE ID=? AND mdp=?');
if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp'])){
$req->execute(array($_SESSION['session_id'],$_SESSION['session_mdp']));
}
if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp']) && $req->fetch() ){
$req = $bdd->query('SELECT * FROM projets WHERE ownersID REGEXP \'[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?\'');
while($rep = $req->fetch()){
echo ('<a href="projet.php?id='. $rep['ID'] .'">Le projet ' . $rep['name'] . ' à la version ' . $rep['version'] . '</a></br>');
}
}else{
echo 'Erreur : vous n\'etes pas connécté';
}
?>
<?php
include 'includes/foot.php'
?>
</body>
</html>