par
Skippy » 30 oct. 2009, 15:42
Non non je suivait bien tes instructions
Le hic, c'est que comme expliqué, j'ai un fichier php, qui va appeler un fichier xml pour afficher le titre, ainsi que l'url dans le lecteur mp3
Alors je ne sais plus où coller ton code. J'ai essayé dans les 2 fichiers, mais sans succès.
un exemple. Je dois mettre cela, dans le fichier music_playlist.php et non dans le fichier xml (playlist.php)
echo '<br>Contenu de la variable $link:'; var_dump($link);
echo '<br>Contenu de la variable $title:'; var_dump($title);
echo '<br>Contenu de la variable $_GET["file_link"]: '; var_dump($_GET['file_link']); echo '<br>';
Alors le mieux c'est que je donne mes fichiers originaux.
music_playlist.php
<?php
if (!function_exists("Mysql_Connexion")) {include ("../../mainfile.php");}
include ("header.php");
//affiche des blocs de gauche et droite ($pdst=1)
global $pdst; $pdst=1;
opentable ();
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['query_string'])) {
$editFormAction .= "?" . htmlentities($_SERVER['query_string']);
}
//recupération de l'IP
function get_ip() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif(isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = get_ip();
// Mise à jour du compteur de hits
// Recupere l'ID
$id = isset($_GET['id']) ? $_GET['id'] : '';
// Detection de l'ID
if (isset($id) && is_numeric($id)) {
// mise a jour de la table
mysql_query("UPDATE music_playlist SET hits = hits + 1 WHERE id = $id");
}
//par défaut pour ne pas la déclarer vide
elseif (empty($_GET['id'])) {
$id = "1";
}
$title = $_GET['title'];
//Detection du nom du user
global $username, $cookie; cookiedecode($user);
$username = $cookie[1]; if ($user =="") { $username = "anonyme"; }
$query = "SELECT * FROM music_playlist WHERE id=$id";
$query = mysql_query($query) or die (mysql_error());
$result = mysql_fetch_assoc($query);
//SELECT BY ORDER pour affichage du tableau
$orderby = $_GET['orderby'];
if (empty($_GET['orderby']) AND (empty($_GET['orderby']))) {
$orderby = "nom"; //par défaut pour ne pas la déclarer vide
$tri = "ASC"; //par défaut pour ne pas la déclarer vide
}
$query_all = "SELECT * FROM music_playlist ORDER BY $orderby $tri";
$query_all = mysql_query($query_all) or die (mysql_error());
//Affichage et calcul de la note + le vote du user
$result_vote= $result['nbre_vote'];
$result_note= $result['note']+$_POST['vote'];
// Reprise des valeurs votes / nb_votes
$nbr_votes = $result['nbre_vote'];
$note = $result['note'];
// Mise à jour du champ votes
if (isset($_POST["MM_update2"]) && ($_POST["MM_update2"] )) {
$updateSQL = sprintf("UPDATE music_playlist SET nbre_vote=$nbr_votes+1, note=$note+".$_POST['vote']." WHERE id=$id");
$Result1 = mysql_query($updateSQL) or die (mysql_error());
}
//affichage en image du résultat des votes
if ($nbr_votes/$note == 1/5) { $res_vote = "<img src=modules/$ModPath/img/5.gif />"; }
elseif ($nbr_votes/$note == 1/4 OR $nbr_votes/$note < 1/4) { $res_vote = "<img src=modules/$ModPath/img/4.gif />"; }
elseif ($nbr_votes/$note == 1/3 OR $nbr_votes/$note < 1/3) { $res_vote = "<img src=modules/$ModPath/img/3.gif />"; }
elseif ($nbr_votes/$note == 1/2 OR $nbr_votes/$note < 1/2) { $res_vote = "<img src=modules/$ModPath/img/2.gif />"; }
elseif ($nbr_votes/$note == 1/1 OR $nbr_votes/$note < 1/1) { $res_vote = "<img src=modules/$ModPath/img/1.gif />"; }
else { $res_vote = "<img src=modules/$ModPath/img/0.gif />"; }
//affichage du tableau
echo "<h3>Module en développement</h3>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:115px;height:15px;'>";
echo "<div style='float:left'><span style='font-weight:bold'>Titre</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=nom&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=nom&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Style</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=style&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=style&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Durée</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=duree&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=duree&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:75px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Auteur</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=auteur&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=auteur&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:55px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Hits</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=hits&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=hits&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:110px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold;'>Date</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=date&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a> <a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=date&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:25px;height:15px'>";
echo "<span style='font-weight:bold'>Play</span>";
echo "</div>";
echo "<div style='clear:left'>";
while($val = mysql_fetch_assoc($query_all)) {
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:115px;height:15px'>";
echo "<a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&title=". $val["nom"]."&id=". $val["id"]."&player=yes'>";
echo "". $val["nom"]."";
echo "</a>";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "". $val["style"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:65px;height:15px;text-align:center'>";
echo "". $val["duree"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:75px;height:15px'>";
echo "".$val["auteur"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:55px;height:15px;text-align:center'>";
echo "".$val["hits"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:110px;height:15px;font-size:10px'>";
echo "".$val["date"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:25px;height:15px;text-align:center'>";
echo "<a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&title=". $val["nom"]."&id=". $val["id"]."&player=yes'>";
echo "<img src='modules/$ModPath/img/listen_music.png' style='border:0px'/>";
echo "</a>";
echo "</div>";
echo "<div style='clear:left'>";
}
echo "<p> </p>";
//affichage des formulaires note, commentaires, player,...
if ($_GET['player'] == "yes") {
echo "<b>".$_GET['title']."</b>";
echo "<div style='width:400px'>";
echo "<p>".$result["texte"]."</p>";
echo "</div>";
echo "$res_vote"." pour ". $result_vote." vote(s)";
?>
<form method=post name="form2" action="<?php //echo $editFormAction; ?>">
1<input type=radio name="vote" checked="" value="1">
2<input type=radio name="vote" checked="" value="2">
3<input type=radio name="vote" checked="" value="3">
4<input type=radio name="vote" checked="" value="4">
5<input type=radio name="vote" checked="" value="5">
<input type=submit name="form2" value="Noter">
<input type="hidden" name="MM_update2" value="form2">
</form>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="15" id="xspf_player" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?php echo "modules/$ModPath/"; ?>xspf_player.swf?autoload=true&playlist_url=<?php echo "modules/$ModPath/"; ?>playlist.php?title=<?php echo $title; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#e6e6e6" />
<embed src="<?php echo "modules/$ModPath/"; ?>xspf_player.swf?autoload=true&playlist_url=<?php echo "modules/$ModPath/"; ?>playlist.php?title=<?php echo $title; ?>" quality="high" bgcolor="#e6e6e6" width="300" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<a href="<?php echo "modules/$ModPath/"; ?>title_player.php?title=<?php echo $title; ?>&target=popup" target=popup onclick="window.open('','popup','width=340,height=200,left=0,top=0,scrollbars=1')" title='Permet d écouter en surfant'>
Ouvrir dans une popup
</a>
|
<a href="<?php echo "modules/$ModPath/"; ?>title_player.php?title=<?php echo $title; ?>&target=all" target=popup onclick="window.open('','popup','width=340,height=200,left=0,top=0,scrollbars=1')" title='Permet d écouter en surfant'>
Ouvrir toute la playlist
</a>
<?php
//On compte le nombres de commentaires
$req = mysql_query("SELECT COUNT(*) as commentaires FROM music_playlist_comments WHERE id_comments=$id");
$row = mysql_fetch_array($req);
$nb = $row['commentaires'];
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"]
)) {
$updateSQL = sprintf("INSERT INTO music_playlist_comments (id_comments,auteur,commentaire,date,ip) Values (%s,%s,%s,NOW(),'$ip')",
GetSQLValueString($_POST['id'], "text"),
GetSQLValueString($_POST['auteur'], "text"),
GetSQLValueString($_POST['commentaire'], "text"));
$Result1 = mysql_query($updateSQL) or die(mysql_error());
header("location:test2.php?id=".$_POST['id']."");}
?>
<p>
<a href="modules.php?ModPath=music-playlist&ModStart=music-playlist&title=<?php echo $title; ?>&id=<?php echo $id; ?>&comments=post">Ecrire un commentaire</a>
|
<a href="modules.php?ModPath=music-playlist&ModStart=music-playlist&title=<?php echo $title; ?>&id=<?php echo $id; ?>&comments=view">Voir les commentaires</a> (<?php echo $nb; ?>)
|
<?php
//Si membre ou admin :
if (autorisation(1) OR autorisation(-127))
{
echo "<a href=\"#\">Poster votre titre</a>";
}
//si anonyme :
elseif (autorisation(-1)) {
echo "Poster votre titre (réservé aux membres)";
}
?>
</p>
<?php
}
//Affiche formulaire de commentaire, après clics sur liens Poster un commentaire
if ($_GET['comments']=="post") {
?>
<form name="form1" method="POST" action="<?php //echo $editFormAction; ?>">
Pseudo: <input type="text" name="auteur" value="<?php echo $username; ?>" maxlength="20" size="15"/>
<br /><br />
Commentaire:
<br />
<textarea name="commentaire" cols="32" rows="2"></textarea>
<br />
<br />
<input type="submit" class="btn" name="form1" value="Envoyer" />
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
</form>
<?php
}
?>
<?php
//Permet de voir les commentaires postés
if ($_GET['comments']=="view") {
$sql = "SELECT * FROM music_playlist_comments WHERE id_comments = '$id' ORDER BY date DESC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($val = mysql_fetch_assoc($req)) {
echo "<p>";
echo "<span class=small_texte>Ecrit par ". $val["auteur"]." le ". $val["date"]." - IP: ". $val["ip"]."</span> ";
echo "<br />";
echo "".$val["commentaire"]."";
echo "</p>";
}
}
?>
<?php
closetable ();
include ("footer.php");
?>
playlist.php
<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
$file = "modules/music-playlist/music_skippy/".$_GET['title'].".mp3";
$file_index = "".$_GET['title']."";
?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title><? print($file_index) ?></title>
<annotation></annotation>
<trackList>
<track>
<location><? print($file) ?></location>
<annotation><? print($file_index) ?></annotation>
</track>
</trackList>
</playlist>
Ce code fonctionne parfaitement pour les premier tableaux. normal, vu que le répertoire est écrit en texte
En tout cas merci pour ta patience !
Non non je suivait bien tes instructions ;-)
Le hic, c'est que comme expliqué, j'ai un fichier php, qui va appeler un fichier xml pour afficher le titre, ainsi que l'url dans le lecteur mp3
Alors je ne sais plus où coller ton code. J'ai essayé dans les 2 fichiers, mais sans succès.
un exemple. Je dois mettre cela, dans le fichier music_playlist.php et non dans le fichier xml (playlist.php)
[php]echo '<br>Contenu de la variable $link:'; var_dump($link);
echo '<br>Contenu de la variable $title:'; var_dump($title);
echo '<br>Contenu de la variable $_GET["file_link"]: '; var_dump($_GET['file_link']); echo '<br>';[/php]
Alors le mieux c'est que je donne mes fichiers originaux.
music_playlist.php
[php]<?php
if (!function_exists("Mysql_Connexion")) {include ("../../mainfile.php");}
include ("header.php");
//affiche des blocs de gauche et droite ($pdst=1)
global $pdst; $pdst=1;
opentable ();
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['query_string'])) {
$editFormAction .= "?" . htmlentities($_SERVER['query_string']);
}
//recupération de l'IP
function get_ip() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif(isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = get_ip();
// Mise à jour du compteur de hits
// Recupere l'ID
$id = isset($_GET['id']) ? $_GET['id'] : '';
// Detection de l'ID
if (isset($id) && is_numeric($id)) {
// mise a jour de la table
mysql_query("UPDATE music_playlist SET hits = hits + 1 WHERE id = $id");
}
//par défaut pour ne pas la déclarer vide
elseif (empty($_GET['id'])) {
$id = "1";
}
$title = $_GET['title'];
//Detection du nom du user
global $username, $cookie; cookiedecode($user);
$username = $cookie[1]; if ($user =="") { $username = "anonyme"; }
$query = "SELECT * FROM music_playlist WHERE id=$id";
$query = mysql_query($query) or die (mysql_error());
$result = mysql_fetch_assoc($query);
//SELECT BY ORDER pour affichage du tableau
$orderby = $_GET['orderby'];
if (empty($_GET['orderby']) AND (empty($_GET['orderby']))) {
$orderby = "nom"; //par défaut pour ne pas la déclarer vide
$tri = "ASC"; //par défaut pour ne pas la déclarer vide
}
$query_all = "SELECT * FROM music_playlist ORDER BY $orderby $tri";
$query_all = mysql_query($query_all) or die (mysql_error());
//Affichage et calcul de la note + le vote du user
$result_vote= $result['nbre_vote'];
$result_note= $result['note']+$_POST['vote'];
// Reprise des valeurs votes / nb_votes
$nbr_votes = $result['nbre_vote'];
$note = $result['note'];
// Mise à jour du champ votes
if (isset($_POST["MM_update2"]) && ($_POST["MM_update2"] )) {
$updateSQL = sprintf("UPDATE music_playlist SET nbre_vote=$nbr_votes+1, note=$note+".$_POST['vote']." WHERE id=$id");
$Result1 = mysql_query($updateSQL) or die (mysql_error());
}
//affichage en image du résultat des votes
if ($nbr_votes/$note == 1/5) { $res_vote = "<img src=modules/$ModPath/img/5.gif />"; }
elseif ($nbr_votes/$note == 1/4 OR $nbr_votes/$note < 1/4) { $res_vote = "<img src=modules/$ModPath/img/4.gif />"; }
elseif ($nbr_votes/$note == 1/3 OR $nbr_votes/$note < 1/3) { $res_vote = "<img src=modules/$ModPath/img/3.gif />"; }
elseif ($nbr_votes/$note == 1/2 OR $nbr_votes/$note < 1/2) { $res_vote = "<img src=modules/$ModPath/img/2.gif />"; }
elseif ($nbr_votes/$note == 1/1 OR $nbr_votes/$note < 1/1) { $res_vote = "<img src=modules/$ModPath/img/1.gif />"; }
else { $res_vote = "<img src=modules/$ModPath/img/0.gif />"; }
//affichage du tableau
echo "<h3>Module en développement</h3>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:115px;height:15px;'>";
echo "<div style='float:left'><span style='font-weight:bold'>Titre</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=nom&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=nom&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Style</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=style&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=style&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Durée</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=duree&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=duree&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:75px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Auteur</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=auteur&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=auteur&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:55px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold'>Hits</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=hits&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=hits&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:110px;height:15px'>";
echo "<div style='float:left'><span style='font-weight:bold;'>Date</span></div> <div style='float:right'><a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=date&tri=DESC'><img src=\"modules/$ModPath/img/fleche_up.png\" style='border:0px' /></a> <a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&orderby=date&tri=ASC'><img src=\"modules/$ModPath/img/fleche_down.png\" style='border:0px' /></a></div>";
echo "</div>";
echo "<div style='background-color:#6a6868;padding:5px;float:left;border:1px solid black; width:25px;height:15px'>";
echo "<span style='font-weight:bold'>Play</span>";
echo "</div>";
echo "<div style='clear:left'>";
while($val = mysql_fetch_assoc($query_all)) {
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:115px;height:15px'>";
echo "<a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&title=". $val["nom"]."&id=". $val["id"]."&player=yes'>";
echo "". $val["nom"]."";
echo "</a>";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:65px;height:15px'>";
echo "". $val["style"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:65px;height:15px;text-align:center'>";
echo "". $val["duree"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:75px;height:15px'>";
echo "".$val["auteur"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:55px;height:15px;text-align:center'>";
echo "".$val["hits"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:110px;height:15px;font-size:10px'>";
echo "".$val["date"]."";
echo "</div>";
echo "<div style='background-color:#868585;padding:5px;float:left;border:1px solid black; width:25px;height:15px;text-align:center'>";
echo "<a href='modules.php?ModPath=music-playlist&ModStart=music-playlist&title=". $val["nom"]."&id=". $val["id"]."&player=yes'>";
echo "<img src='modules/$ModPath/img/listen_music.png' style='border:0px'/>";
echo "</a>";
echo "</div>";
echo "<div style='clear:left'>";
}
echo "<p> </p>";
//affichage des formulaires note, commentaires, player,...
if ($_GET['player'] == "yes") {
echo "<b>".$_GET['title']."</b>";
echo "<div style='width:400px'>";
echo "<p>".$result["texte"]."</p>";
echo "</div>";
echo "$res_vote"." pour ". $result_vote." vote(s)";
?>
<form method=post name="form2" action="<?php //echo $editFormAction; ?>">
1<input type=radio name="vote" checked="" value="1">
2<input type=radio name="vote" checked="" value="2">
3<input type=radio name="vote" checked="" value="3">
4<input type=radio name="vote" checked="" value="4">
5<input type=radio name="vote" checked="" value="5">
<input type=submit name="form2" value="Noter">
<input type="hidden" name="MM_update2" value="form2">
</form>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="15" id="xspf_player" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?php echo "modules/$ModPath/"; ?>xspf_player.swf?autoload=true&playlist_url=<?php echo "modules/$ModPath/"; ?>playlist.php?title=<?php echo $title; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#e6e6e6" />
<embed src="<?php echo "modules/$ModPath/"; ?>xspf_player.swf?autoload=true&playlist_url=<?php echo "modules/$ModPath/"; ?>playlist.php?title=<?php echo $title; ?>" quality="high" bgcolor="#e6e6e6" width="300" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<a href="<?php echo "modules/$ModPath/"; ?>title_player.php?title=<?php echo $title; ?>&target=popup" target=popup onclick="window.open('','popup','width=340,height=200,left=0,top=0,scrollbars=1')" title='Permet d écouter en surfant'>
Ouvrir dans une popup
</a>
|
<a href="<?php echo "modules/$ModPath/"; ?>title_player.php?title=<?php echo $title; ?>&target=all" target=popup onclick="window.open('','popup','width=340,height=200,left=0,top=0,scrollbars=1')" title='Permet d écouter en surfant'>
Ouvrir toute la playlist
</a>
<?php
//On compte le nombres de commentaires
$req = mysql_query("SELECT COUNT(*) as commentaires FROM music_playlist_comments WHERE id_comments=$id");
$row = mysql_fetch_array($req);
$nb = $row['commentaires'];
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"]
)) {
$updateSQL = sprintf("INSERT INTO music_playlist_comments (id_comments,auteur,commentaire,date,ip) Values (%s,%s,%s,NOW(),'$ip')",
GetSQLValueString($_POST['id'], "text"),
GetSQLValueString($_POST['auteur'], "text"),
GetSQLValueString($_POST['commentaire'], "text"));
$Result1 = mysql_query($updateSQL) or die(mysql_error());
header("location:test2.php?id=".$_POST['id']."");}
?>
<p>
<a href="modules.php?ModPath=music-playlist&ModStart=music-playlist&title=<?php echo $title; ?>&id=<?php echo $id; ?>&comments=post">Ecrire un commentaire</a>
|
<a href="modules.php?ModPath=music-playlist&ModStart=music-playlist&title=<?php echo $title; ?>&id=<?php echo $id; ?>&comments=view">Voir les commentaires</a> (<?php echo $nb; ?>)
|
<?php
//Si membre ou admin :
if (autorisation(1) OR autorisation(-127))
{
echo "<a href=\"#\">Poster votre titre</a>";
}
//si anonyme :
elseif (autorisation(-1)) {
echo "Poster votre titre (réservé aux membres)";
}
?>
</p>
<?php
}
//Affiche formulaire de commentaire, après clics sur liens Poster un commentaire
if ($_GET['comments']=="post") {
?>
<form name="form1" method="POST" action="<?php //echo $editFormAction; ?>">
Pseudo: <input type="text" name="auteur" value="<?php echo $username; ?>" maxlength="20" size="15"/>
<br /><br />
Commentaire:
<br />
<textarea name="commentaire" cols="32" rows="2"></textarea>
<br />
<br />
<input type="submit" class="btn" name="form1" value="Envoyer" />
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
</form>
<?php
}
?>
<?php
//Permet de voir les commentaires postés
if ($_GET['comments']=="view") {
$sql = "SELECT * FROM music_playlist_comments WHERE id_comments = '$id' ORDER BY date DESC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($val = mysql_fetch_assoc($req)) {
echo "<p>";
echo "<span class=small_texte>Ecrit par ". $val["auteur"]." le ". $val["date"]." - IP: ". $val["ip"]."</span> ";
echo "<br />";
echo "".$val["commentaire"]."";
echo "</p>";
}
}
?>
<?php
closetable ();
include ("footer.php");
?> [/php]
playlist.php
[php]<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
$file = "modules/music-playlist/music_skippy/".$_GET['title'].".mp3";
$file_index = "".$_GET['title']."";
?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title><? print($file_index) ?></title>
<annotation></annotation>
<trackList>
<track>
<location><? print($file) ?></location>
<annotation><? print($file_index) ?></annotation>
</track>
</trackList>
</playlist>
[/php]
Ce code fonctionne parfaitement pour les premier tableaux. normal, vu que le répertoire est écrit en texte
En tout cas merci pour ta patience !