1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| <div id="box_center1">
<div id="titre_cat">
<b>Catégorie :</b> <? echo $data['cat_article']; ?>
<br />
<b>Auteur :</b> <? echo $data['auteur']; ?>
<br />
<b>Crée le :</b> <? echo $data['date']; ?>
<br />
</div>
<h3><? echo $data['titre']; ?></h3>
<? echo $data['texte']; ?>
<?php
if($data['player'] == "0")
{
echo "<object
data=\"".$data['file_url']."\"
type=\"video/x-ms-wmv\"
width=\"532\" height=\"65\">
<param name=\"ShowStatusBar\" value=\"1\" />
<param name=\"src\" value=\"".$data['file_url']."\" />
<param name=\"enabled\" value=\"true\" />
<param name=\"defaultframe\" />
<param name=\"enablecontextmenu\" value=\"false\" />
<param name=\"stretchtofit\" value=\"true\" />
<param name=\"windowlessvideo\" value=\"true\" />
<param name=\"uimode\" value=\"full\" />
<param name=\"autostart\" value=\"0\" />
<param name=\"volume\" value=\"120\" />
</object>";
}
// Nombre de commentaires
$query = "SELECT id, COUNT(*) FROM comments WHERE art_id = ".$_GET['id']." GROUP BY id";
$query = mysql_query($query) or die(mysql_error());
$row_query= mysql_fetch_assoc($query);
$nb_comments = mysql_num_rows($query);
?>
<br /><br />
<ul>
<li class="puce1"><a href="articles.php?do=comments&id=<? echo $id ?>">Laisser un commentaire (<? echo $nb_comments ?>)</a></li>
</ul>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
//commentaires
function comments() {
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$username = "".$_SESSION['username_form']."";
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("INSERT INTO comments (art_id,auteur,date,texte) Values (".$_GET['id'].",'skippy',NOW(),%s)",
GetSQLValueString($_POST['texte'], "text"));
$Result1 = mysql_query($updateSQL) or die(mysql_error()); }
?>
<!--
Script. Insertion du plugin Tiny_mce, qui permet d'afficher un éditeur de texte modifiable
-->
<script language="javascript" type="text/javascript" src="modules/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "simple",
mode : "textareas"
});
</script>
<!-- fin du script -->
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<textarea name="texte" cols="32" rows="8"></textarea>
<br /><br />
<input type="submit" name="form1" value="Envoyer" />
<input type="hidden" name="MM_update" value="form1">
</form>
<br /><br />
<?php
$sql = "SELECT * FROM comments WHERE art_id = ".$_GET['id']." ORDER BY date DESC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$sql2 = "SELECT * FROM users WHERE statut='0'";
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$val2 = mysql_fetch_assoc($req2);
while($val = mysql_fetch_assoc($req)) {
echo "<li>". $val["texte"]."";
echo "<br />";
echo "". $val["date"]."</li>";
if ($username == $val2["username"]) { echo "Supprimer ce commentaire"; }
}
}
echo "</div>"; |
Partager