Voer een zoekterm in.';
exit;
}
// Beveiliging: escape
$keyword_esc = mysqli_real_escape_string($db_conx, $keyword);
// Correcte haakjes: zoek in artist OF title, en beperk tot song_type = 0
$sqlls = "SELECT * FROM `songs` WHERE song_type='0' AND (`artist` LIKE '%$keyword%' OR `title` LIKE '%$keyword%') ORDER BY `artist` LIMIT 50";
$lsresult = mysqli_query($db_conx, $sqlls);
if ($lsresult === false) {
// Query error -> toon (tijdelijk) debug info
echo '
Zoekfout: '.mysqli_error($db_conx).'
';
exit;
}
if (mysqli_num_rows($lsresult) > 0) {
while ($lsrow = mysqli_fetch_assoc($lsresult)) {
$lssongID = (int)$lsrow['ID'];
$lsartist = stripslashes($lsrow['artist']);
$lstitle = stripslashes($lsrow['title']);
$lsmmss = function_exists('convertTime') ? convertTime($lsrow['duration']) : '0:00';
$lsartist_pic = (file_exists('pictures/'.$lsartist.'.jpg') && $lsartist != '') ? 'pictures/'.$lsartist.'.jpg' : 'assets/img/noimg.jpg';
// REQUEST knop logic
$reqbtn = '';
if (defined('ALLOWREQS') && ALLOWREQS === 'YES') {
$interval = defined('REQINT') ? (int)REQINT : 1;
$sqlcheckreq = mysqli_query($db_conx, "SELECT 1 FROM `requests` WHERE `songID`='{$lssongID}' AND `requested` > NOW() - INTERVAL {$interval} HOUR LIMIT 1");
$isRequested = ($sqlcheckreq && mysqli_num_rows($sqlcheckreq) > 0);
$reqbtn = $isRequested ? 'REQUESTED
' : 'REQUEST ';
} else {
$reqbtn = 'LOCKED
';
}
// LIKE knop logic
$likesong = '';
if (defined('ALLOWLIKES') && ALLOWLIKES === 'YES') {
$sqlchecklikes = mysqli_query($db_conx, "SELECT 1 FROM `songlikes` WHERE `usrip`='".mysqli_real_escape_string($db_conx,$reqIP)."' AND `likes`='{$lssongID}' LIMIT 1");
if ($sqlchecklikes && mysqli_num_rows($sqlchecklikes) > 0) {
$likesong = ' ';
} else {
$likesong = '
';
}
} else {
$likesong = '
';
}
// Output (kort voorbeeld — behoud jouw originele markup als gewenst)
echo '
'.htmlspecialchars($lsartist).'
'.htmlspecialchars($lstitle).'
'.$lsmmss.'
'.$reqbtn.'
'.$likesong.'
';
// (Behoud je modal + form HTML zoals je had; ik heb hierboven enkel de kern getoond.)
}
} else {
echo '
No Results for : "'.htmlspecialchars($keyword).'"
Probeer een andere zoekterm.
';
}
} else {
echo '
ERROR: Parameters Missing
Er is geen zoekterm meegegeven.
';
}
?>