ec9f5496
Jean Wasilewski
Added add element...
|
1
|
<?php
|
cb5a3492
Jean Wasilewski
Fix for the UTF8 ...
|
2
|
require_once("creds.php");
|
02337ae1
Erwan Nanrocki
correction pour l...
|
3
|
|
ec9f5496
Jean Wasilewski
Added add element...
|
4
5
|
echo "<h2> News ";
if(isset($_SESSION["admin"])&&$_SESSION["admin"])
|
9f477c3a
Jean Wasilewski
News editing
|
6
|
echo '<h3><button type="button" class="btn btn-primary" onClick="addNews();"><span class="glyphicon glyphicon-plus"></span> Nouvel article</button></h3>';
|
ec9f5496
Jean Wasilewski
Added add element...
|
7
8
9
10
|
echo "</h2>";
$link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__)
or die("Impossible de se connecter : " . mysql_error());
|
1d10adb8
kevin
News.php modif Kevin
|
11
|
|
bad01aa4
kevin
modification dans...
|
12
|
|
ec9f5496
Jean Wasilewski
Added add element...
|
13
14
15
16
|
if(!mysql_select_db('crep', $link)){
echo 'Selection de la base de donnees impossible';
exit;
}
|
ac2c0ae5
henyxia
UTF8 should be be...
|
17
|
mysql_query("SET NAMES 'utf8'");
|
92042353
Jean Wasilewski
Prettier display
|
18
|
$requete = "select news.pk as pk, DATE_FORMAT(created,'%e-%m-%Y') AS created, title, content, users.realname as userName from news, users where news.fk_author=users.pk;";
|
ec9f5496
Jean Wasilewski
Added add element...
|
19
|
$resultat = mysql_query($requete);
|
bad01aa4
kevin
modification dans...
|
20
|
|
ec9f5496
Jean Wasilewski
Added add element...
|
21
22
23
24
25
26
|
//Pour debugger
if (!$resultat) {
$message = 'Requete invalide : ' . mysql_error() . "\n";
$message .= 'Requete complete : ' . $query;
die($message);
}
|
bad01aa4
kevin
modification dans...
|
27
|
|
ec9f5496
Jean Wasilewski
Added add element...
|
28
29
30
|
while ($row = mysql_fetch_assoc($resultat)) {
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
|
9f477c3a
Jean Wasilewski
News editing
|
31
32
|
echo '<h3 class="panel-title">'.$row['title'];
if(isset($_SESSION["admin"])&&$_SESSION["admin"])
|
1a8cdeb2
Jean Wasilewski
Minor fix 3
|
33
|
echo ' <a href="#" onclick="editNews('.$row["pk"].')" class="glyphicon glyphicon-pencil"></a>';
|
9f477c3a
Jean Wasilewski
News editing
|
34
|
echo '</h3>';
|
ec9f5496
Jean Wasilewski
Added add element...
|
35
36
37
38
39
|
echo '</div>';
echo '<div class="panel-body">';
echo '<p>'.$row['content'].'</p>';
echo '</div>';
echo '<div class="panel-footer">';
|
006420a6
Jean Wasilewski
Added date to news
|
40
|
echo '<p>'.$row['userName'].', le '.$row['created'].'</p>';
|
ec9f5496
Jean Wasilewski
Added add element...
|
41
42
|
echo '</div></div>';
}
|
bad01aa4
kevin
modification dans...
|
43
|
|
ec9f5496
Jean Wasilewski
Added add element...
|
44
45
|
//On libere l'espace de resultat
mysql_close($link);
|
bad01aa4
kevin
modification dans...
|
46
|
?>
|
db8bf362
kevin
modif sur news.php
|
|
|