From ec9f5496aeef98cd6e32553048dddc24b8c3ca01 Mon Sep 17 00:00:00 2001 From: Jean Wasilewski Date: Sun, 9 Nov 2014 17:12:55 +0100 Subject: [PATCH] Added add element on news.php --- news.php | 65 ++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/news.php b/news.php index 420c65e..3168a0a 100644 --- a/news.php +++ b/news.php @@ -1,40 +1,43 @@ -

News

+ News "; +if(isset($_SESSION["admin"])&&$_SESSION["admin"]) + echo ' Nouvel article'; +echo ""; + +$link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__) + or die("Impossible de se connecter : " . mysql_error()); - if(!mysql_select_db('crep', $link)){ - echo 'Selection de la base de donnees impossible'; - exit; - } +if(!mysql_select_db('crep', $link)){ + echo 'Selection de la base de donnees impossible'; + exit; +} - $requete = "select title, content, users.realname as userName from news, users where news.fk_author=users.pk;"; - $resultat = mysql_query($requete); +$requete = "select title, content, users.realname as userName from news, users where news.fk_author=users.pk;"; +$resultat = mysql_query($requete); - //Pour debugger - if (!$resultat) { - $message = 'Requete invalide : ' . mysql_error() . "\n"; - $message .= 'Requete complete : ' . $query; - die($message); - } +//Pour debugger +if (!$resultat) { + $message = 'Requete invalide : ' . mysql_error() . "\n"; + $message .= 'Requete complete : ' . $query; + die($message); +} - while ($row = mysql_fetch_assoc($resultat)) { - echo '
'; - echo '
'; - echo '

'.$row['title'].'

'; - echo '
'; - echo '
'; - echo '

'.$row['content'].'

'; - echo '
'; - echo '
'; - } +while ($row = mysql_fetch_assoc($resultat)) { + echo '
'; + echo '
'; + echo '

'.$row['title'].'

'; + echo '
'; + echo '
'; + echo '

'.$row['content'].'

'; + echo '
'; + echo '
'; +} - //On libere l'espace de resultat - mysql_close($link); +//On libere l'espace de resultat +mysql_close($link); ?> -- libgit2 0.21.2