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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
| <?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
if (isset($_POST['recherche'])) {
$where = array();
if (isset($_POST['label']) && strlen($label = trim($_POST['label']))) {
$where[] = "jos_muscol_albums.label LIKE '%".mysql_real_escape_string($label)."%'";
}
if (isset($_POST['ndisc']) && strlen($ndisc = trim($_POST['ndisc']))) {
$where[] = "jos_muscol_albums.ndisc LIKE '%".mysql_real_escape_string($ndisc)."%'";
}
if (isset($_POST['types']) && strlen($types = trim($_POST['types']))) {
$where[] = "jos_muscol_albums.types LIKE '%".mysql_real_escape_string($types)."%'";
}
if (isset($_POST['tags']) && strlen($tags = trim($_POST['tags']))) {
$where[] = "jos_muscol_albums.tags LIKE '%".mysql_real_escape_string($tags)."%'";
}
if (isset($_POST['artist']) && strlen($artist_id = trim($_POST['artist']))) {
$where[] = "jos_muscol_albums.artist_id LIKE '%".mysql_real_escape_string($artist_id)."%'";
}
if (isset($_POST['format']) && strlen($format_id = trim($_POST['format']))) {
$where[] = "jos_muscol_albums.format_id LIKE '%".mysql_real_escape_string($format_id)."%'";
}
//if (isset($_POST['mot'])) {
// $mot = $_POST['mot'];
// $where[] = "jos_muscol_albums.name LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.label LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.review LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.name2 LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.artist2 LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.subartist LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.keywords LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.metakeywords LIKE '%".mysql_real_escape_string($mot)."%' OR jos_muscol_albums.metadescription LIKE '%".mysql_real_escape_string($mot)."%'";
// }
if (empty($where)){
echo 'Vous devez remplir au moins un des champs de recherche !';
} else {
mysql_select_db($database_dbprotect, $dbprotect);
$query_resultats = "SELECT * FROM jos_muscol_albums WHERE ". implode(' AND ', $where) . "";
$resultats = mysql_query($query_resultats, $dbprotect) or die(mysql_error());
$row_resultats = mysql_fetch_assoc($resultats);
$totalRows_resultats = mysql_num_rows($resultats);
function time_to_string($total_time){
$segons = $total_time % 60;
if($segons < 10) $segons = "0".$segons;
$minuts = ($total_time - $segons)/60;
if($minuts >= 60){
$minuts_60 = $minuts % 60;
$hores = ($minuts - $minuts_60)/60;
if($minuts_60 < 10) $minuts_60 = "0".$minuts_60;
}
else $hores=0;
if($hores>0){
$total_time = $hores."h".$minuts_60."min".$segons;
}
else $total_time = $minuts."min".$segons;
return $total_time;
}
function time_to_array($total_time){
$segons = $total_time % 60;
$minuts = ($total_time - $segons)/60;
if($minuts >= 60){
$minuts_60 = $minuts % 60;
$hores = ($minuts - $minuts_60)/60;
}
else {
$hores=0;
$minuts_60 = $minuts;
}
$return["hours"] = $hores;
$return["minuts"] = $minuts_60;
$return["seconds"] = $segons;
return $return;
}
function month_name($month){
$month_array = array(
0 => "",
1 => "Janvier",
2 => "Février" ,
3 => "Mars" ,
4 => "Avril" ,
5 => "Mai" ,
6 => "Juin" ,
7 => "Juillet" ,
8 => "Août" ,
9 => "Septembre" ,
10 => "Octobre" ,
11 => "Novembre" ,
12 => "Décembre" );
return $month_array[$month];
}
?>
<div class="article-result">
<h4>Resultat de recherche</h4>
<?php if (mysql_num_rows($resultats) === 0){ ?>
<h3 style="text-align:center; margin:10px 0;">Pas de résultats pour cette recherche</h3>
<?php }else{ ?>
<?php do {
$support = $row_resultats['format_id'];
$dep = $row_resultats['types'];
$ville = $row_resultats['tags'];
$art = $row_resultats['artist_id'];
$song= $row_resultats['id'];
if (($row_resultats['format_id']) == "2") {
$icone = "audio.png";}
if (($row_resultats['format_id']) == "3") {
$icone = "video.png";}
$jour = $row_resultats['day'];
$mois= $row_resultats['month'];
$annee = $row_resultats['year'];
mysql_select_db($database_dbprotect, $dbprotect);
$query_supports = "SELECT * FROM jos_muscol_format WHERE jos_muscol_format.id='$support'";
$supports = mysql_query($query_supports, $dbprotect) or die(mysql_error());
$row_supports = mysql_fetch_assoc($supports);
$totalRows_supports = mysql_num_rows($supports);
mysql_select_db($database_dbprotect, $dbprotect);
$query_dep = "SELECT * FROM jos_muscol_type WHERE jos_muscol_type.id='$dep'";
$dep = mysql_query($query_dep, $dbprotect) or die(mysql_error());
$row_dep = mysql_fetch_assoc($dep);
$totalRows_dep = mysql_num_rows($dep);
mysql_select_db($database_dbprotect, $dbprotect);
$query_ville = "SELECT * FROM jos_muscol_tags WHERE jos_muscol_tags.id='$ville'";
$ville = mysql_query($query_ville, $dbprotect) or die(mysql_error());
$row_ville = mysql_fetch_assoc($ville);
$totalRows_ville = mysql_num_rows($ville);
mysql_select_db($database_dbprotect, $dbprotect);
$query_info = "SELECT * FROM jos_muscol_artists WHERE jos_muscol_artists.id='$art'";
$info = mysql_query($query_info, $dbprotect) or die(mysql_error());
$row_info = mysql_fetch_assoc($info);
$totalRows_info = mysql_num_rows($info);
mysql_select_db($database_dbprotect, $dbprotect);
$query_sequences = "SELECT * FROM jos_muscol_songs WHERE jos_muscol_songs.album_id='$song'";
$sequences = mysql_query($query_sequences, $dbprotect) or die(mysql_error());
$row_sequences = mysql_fetch_assoc($sequences);
$totalRows_sequences = mysql_num_rows($sequences);
$duree= time_to_string($row_resultats['length']);
$mois = month_name($row_resultats['month']);
?> |
Partager