sorry i have another problem now
i'm trying to get the nav links in the top left or top right, in my case its top right
here's my code
<!doctype html>
<head>
<title>Hot Tunez Radio</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<center><!DOCTYPE html>
<html>
<body>
</body>
</html></center>
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: right;
}
li a {
display: block;
padding: 0px;
background-color: #dddddd;
}
</style>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* Style the body */
body {
font-family: Arial;
margin: 0;
}
/* Header/Logo Title */
.header {
padding: 60px;
text-align: center;
background: #1abc9c;
color: white;
font-size: 20px;
}
/* Page Content */
.content {padding:20px;}
</style>
</head>
<body>
<div align="left"><div class="header">
<ul>
<a href="
http://hottunez-radio.com">Home</a></li>
<a href="#news">News</a></li>
<a href="#contact">Contact</a></li>
<a href="#about">Request</a></li>
</ul>
</div>
<div class="content">
</div>
</body>
</html>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: ;
}
li {
float: right;
}
li a {
display: block;
color: dark blue;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #dddddd;
}
</style>
</head>
<body>
</body>
</html>
</body>
<center><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="
https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="
https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="
https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container mt-3">
<div align="right"><?php
$test = exec('curl -X GET "
http://176.9.139.122/api/nowplaying" -H "accept: */*"');
$test2 = json_decode($test, True);
if($test2[1]['live']['is_live']== 0)
{
$playing = $test2[1]['now_playing']['song']['text'];
$img = "
http://hottunez-radio.com/images/AutoDj.png";
echo "Now Live:<br /> <img src='$img' width='160'><br />Auto DJ<br /> <br>$playing<br>";
}
else
{
$live = $test2[1]['live']['streamer_name'];
$playing = $test2[1]['now_playing']['song']['text'];
$img = "images/$live.jpg";
echo "<font color='pink'>Now Live:</font><br /><img src='$img' width='200' height=\"200\"><br /> $live<br /><font color='black'> $playing</font>";
}
?>
</div>
</body>
</html>
</center>
<!DOCTYPE html>
<html>
<head>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<title>HotTunez Requests</title>
<meta charset="utf-8" />
<link href="
https://fonts.googleapis.com/css?family=Open+Sans:400,600,700" rel="stylesheet">
<style>
<?php include 'main.css'; ?>
</style>
</head>
<?php
include 'config.php';
include 'functions.php';
?>
<body>
<button id="toTop" title="Go to top">Top</button>
<?php
if (!$conn) {
echo "<center><table class=\"table\" style=\"width: 300px; text-align: center\"><td>".$lang['OFFLINE']."</td></table></center>";
} else {
?>
<div class="content">
<table class="table table1" style="width: 700px"><td><center><?php echo $lang['REQUESTED_TRACK_LIMITS'].''.$reqLimit.''.$lang['REQUESTED_TRACK_LIMITS1'].''.$req_wait.''.$lang['REQUESTED_TRACK_LIMITS2']; ?> </center></td></table>
<?php
if (!$req_event == 0) {
echo "<table class=\"table\" style=\"width: 400px; text-align: center\"><td>".$lang['REQ_EVENT']." ".$req_event." ",$lang['REQ_EVENT2']."</td></table>";
} ?>
<div style="text-align: center;"><?php echo $lang['REQ_A_TRACK']; ?></div>
<table class="table sbox" style="width: 70%">
<tr>
<td>
<?php
$targetpage = $_SERVER['SCRIPT_NAME']; //Link to this page
$srch = "";
$srchpath = "";
$srcquery = "";
$page = 1;
$reqid = "";
$notin = "AND id_subcat NOT IN(".$reqsubcat.")";
if (isset($_GET['searchterm'])) {
if ($_GET['searchterm'] != "") {
if (!empty($reqsubcat)) {
$srch = mysqli_real_escape_string($conn, $_GET['searchterm']);
$srchpath = "&searchterm=$srch";
$srcquery = "AND `enabled`= 1 AND (`artist` LIKE '%$srch%') OR (`title` LIKE '%$srch%') $notin "; //Search artist and title not in selected subcats only enabled tracks.
} else {
$srch = mysqli_real_escape_string($conn, $_GET['searchterm']);
$srchpath = "&searchterm=$srch";
$srcquery = "AND `enabled`= 1 AND (`artist` LIKE '%$srch%') OR (`title` LIKE '%$srch%')"; //Search artist and title only on enabled tracks.
}
}
echo "<center><div id=\"notfind\">".$lang['ERROR_FIND']."<br><br>
<A HREF=\"javascript:javascript:history.go(-1)\"><button class=\"button back\">".$lang['GO_BACK']."</button></A></div></center>";
}
//Get the page if it's requested
if (isset($_GET['page'])) {
$page = mysqli_real_escape_string($conn, $_GET['page']);
}
if ($page) {
$start = ($page - 1) * $page_limit;
} else {
$start = 0;
}
if (isset($_POST['reqsubmit'])) {
/*
ERROR CODES:
0 = No error
1 = no user name
2 = no requested track
3 = track already in queue
4 = request limit reached
5 = Waiting time not over
*/
$reqname = mysqli_escape_string($conn, $_POST['requsername']);
$reqmsg = mysqli_escape_string($conn, $_POST['reqmessage']);
$reqsongID = mysqli_escape_string($conn, $_POST['songID']);
$reqIP = getRealIpAddr();
$error = 0;
$reccount = 0;
if (!$reqname) {
$error = 1;
}
if (!$reqsongID) {
$error = 2;
}
if ($error == 0) {
//track is already requested?
$recheck = "SELECT COUNT(*) AS num FROM `requests` WHERE `songID`='$reqsongID' AND `played`='0' AND `song_type`='0';";
$total_req = mysqli_fetch_array(mysqli_query($conn, $recheck));
if ($total_req['num'] > 0) {
$error = 3;
}
@mysqli_free_result($conn, $total_req);
if ($error == 0) {
//user has reached the request limit?
$recheck = "SELECT COUNT(*) AS num FROM `requests` WHERE `userIP`='$reqIP' AND DATE(`requested`) = DATE(NOW());";
$total_req = mysqli_fetch_array(mysqli_query($conn, $recheck));
if ($total_req['num'] >= $reqLimit) {
$error = 4;
$reccount = $total_req['num'];
}
# check if waiting time is over for new request.
$sql= "SELECT * FROM `requests` WHERE `userIP`='$reqIP' ORDER BY `requested` DESC LIMIT 1 ";
$res = $conn->query($sql);
if ($res->num_rows > 0) {
while ($row = mysqli_fetch_assoc($res)) {
$timex= $row['requested'];
}
$calc = strtotime($timex);
$calc2 = date('Y-m-d H:i:s');
$calc3 = strtotime($calc2);
$calc4 = ($calc3-$calc) / 60;
$min = intval($calc4);
if ($min < $req_wait) {
$error = 5;
}
}
# check waiting time end.
@mysqli_free_result($conn, $total_req);
}
}
switch ($error) {
case 0:
echo "<center>";
$queryx = "INSERT INTO `requests` SET `songID`='$reqsongID', `username`='$reqname', `userIP`='$reqIP', `message`='$reqmsg', `requested`=now();";
$resultx = mysqli_query($conn, $queryx);
if ($resultx > 0) {
$nu1= $total_req['num'];
$nu2 = $nu1+1;
echo "<div class=\"noticediv\">" . $lang['MSG_REQSUCCESS'] . " <b>".$nu2."</b> ".$lang['MSG_REQSUCCESS_TOT']." <b>".$reqLimit."</b>";
if ($nu2 == $req_wait) {
echo "<center><div class=\"errordiv\">" . $lang['ERROR_LIMITREACHED2'] . "</div></center><br><br>";
} else {
echo "<br />".$lang['WAIT']." ".$req_wait." ".$lang['WAIT2']."</div>";
}
} else {
echo "<center><div class=\"errordiv\"><center>" . $lang['ERROR_UNKNOWN'] . "</center></div></center><br /><br>";
}
@mysqli_free_result($conn, $resultx);
echo '</center>';
break;
case 1:
echo '<center>';
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_USERNAME'] . "</center></div></center><br />";
echo "<div id=\"back\"><center><br><br><A HREF=\"javascript:javascript:history.go(-1)\"><button
class=\"back\">".$lang['GO_BACK']."</button></A></center>";
break;
echo '</center>';
case 2:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_TRACKID'] . " </center></div></center><br />";
echo "<center><A HREF=\"javascript:javascript:history.go(-1)\">".$lang['GO_BACK']."</A></center><br><br>";
break;
case 3:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_TRACKREQ'] . "</center></div></center><br /><br>";
break;
case 4:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_LIMITREACHED'] . " (" . $reccount . "/" . $reqLimit . ")" . "</center></div></center><br /><br>";
break;
case 5:
$wait_time= $req_wait-$min;
echo "<br><center><div class=\"errordiv\">" . $lang['ERROR_TRACKREQ_TIME'] . " ".$wait_time." ".$lang['ERROR_TRACKREQ_TIME2']."</div></center><br>";
break;
}
$reqid = "";
}
//Get the page if it's requested
if (isset($_GET['requestid'])) {
if ($_GET['requestid'] != "") {
$reqid = mysqli_escape_string($conn, $_GET['requestid']);
//Get track artist Name and title.
$querysong = "SELECT * FROM `songs` WHERE `ID` = $reqid AND `enabled`= '1' AND `song_type`='0' ";
$queryderp = mysqli_query($conn, $querysong);
while ($row = mysqli_fetch_assoc($queryderp)) {
$title= $row['title'];
$artist= $row['artist'];
}
echo "<div class=\"selection\">".$lang['REQ_SELECTED']. " ". $artist." - ".$title."</div></td></tr>";
echo "<table>";
echo " <form id=\"formrequest\" name=\"formrequest\" method=\"post\" action=\"$targetpage?page=$page$srchpath\">";
echo " <table align=\"center\" width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" class=\"nobar\">";
echo " <tr>";
echo "<td><div align=\"center\"><p>" . $lang['REQ_DESCRIPTION'] . "</p></div></td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type=\"text\" autofocus name=\"requsername\" placeholder=\"" . $lang['REQ_NAME'] . "\" /></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"3\"><div class=\"message\"><textarea name=\"reqmessage\" rows=\"5\" cols=\"80\" placeholder=\"" . $lang['REQ_MESSAGE'] . "\"></textarea></div></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"2\"><div align=\"center\"><input type=\"Submit\" name=\"reqsubmit\" value=\"" . $lang['REQ_BUTTON'] . "\" /></div></td>";
echo " </tr>";
echo " </table>";
echo " <INPUT TYPE=\"hidden\" name=\"songID\" value=\"$reqid\">";
echo " </form>";
echo " </div>";
echo "</td></table>";
echo "<div id=\"back\"><center><br><br><A HREF=\"javascript:javascript:history.go(-1)\"><button
class=\"back\">".$lang['GO_BACK']."</button></A></center>";
echo '</td></table></center></div>';
}
}
//================//
if ($reqid == "") {
//Get the number of items
if (!empty($reqsubcat)) {
$query = "SELECT COUNT(*) as num FROM `songs` WHERE `enabled`='1' $srcquery AND `song_type`='0' $notin ";
$total_pages = mysqli_fetch_array(mysqli_query($conn, $query));
$total_pages = $total_pages['num'];
} else {
$query = "SELECT COUNT(*) as num FROM `songs` WHERE `enabled`='1' $srcquery AND `song_type`='0' ";
$total_pages = mysqli_fetch_array(mysqli_query($conn, $query));
$total_pages = $total_pages['num'];
}
//Get page data (To inplant left join queuelist see)
if (!empty($reqsubcat)) {
$query1 = "SELECT `ID`, `artist`, `title`, `year`, `duration`, `date_played`, `artist_played`,`id_subcat` FROM `songs` WHERE `enabled`='1' $srcquery AND`song_type`='0' $notin ORDER BY `artist` ASC LIMIT $start, $page_limit";
$result = mysqli_query($conn, $query1);
} else {
$query1 = "SELECT `ID`, `artist`, `title`, `year`, `duration`, `date_played`, `artist_played`,`id_subcat` FROM `songs` WHERE `enabled`='1' $srcquery AND`song_type`='0' ORDER BY `artist` ASC LIMIT $start, $page_limit";
$result = mysqli_query($conn, $query1);
}
// Initial page num setup
if ($page == 0) {
$page = 1;
}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$page_limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if ($lastpage > 1) {
$paginate .= "<div class='paginate'>";
//Placeholder for previous so buttons don't move after page 1
if ($page == 1) {
$paginate.= "<span style\"visibility:normal;\"><a id='prev' style=\"background-color: var(--button-hover-color);cursor: default !important; opacity:0.6;\">" . $lang['NAV_PREV'] . "</a></span> ";
}
// Previous
if ($page > 1) {
$paginate.= "<a href='$targetpage?page=$prev$srchpath' id='prev'>" . $lang['NAV_PREV'] . "</a> ";
}
// Pages
if ($lastpage < 7 + ($adjacents * 2)) {
for ($counter = 1; $counter <= $lastpage; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
} elseif ($lastpage > 5 + ($adjacents * 2)) {
// Beginning only hide later pages
if ($page < 1 + ($adjacents * 2)) {
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
$paginate.= "<strong>...</strong>";
$paginate.= "<a href='$targetpage?page=$LastPagem1$srchpath'> $LastPagem1 </a>";
$paginate.= "<a href='$targetpage?page=$lastpage$srchpath'> $lastpage </a>";
} elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
$paginate.= "<a href='$targetpage?page=1$srchpath'> 1 </a>";
$paginate.= "<a href='$targetpage?page=2$srchpath'> 2 </a>";
$paginate.= "<strong>...</strong>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
$paginate.= "<strong>...</strong>";
$paginate.= "<a href='$targetpage?page=$LastPagem1$srchpath'> $LastPagem1 </a>";
$paginate.= "<a href='$targetpage?page=$lastpage$srchpath'> $lastpage </a>";
} else {
$paginate.= "<a href='$targetpage?page=1$srchpath'> 1 </a>";
$paginate.= "<a href='$targetpage?page=2$srchpath'> 2 </a>";
$paginate.= "<strong>...</strong>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
}
}
// Next
if ($page < $counter - 1) {
$paginate.= "<a href='$targetpage?page=$next$srchpath' id='next'> " . $lang['NAV_NEXT'] . "</a>";
}
//Placeholder for next so buttons don't move after last page
if ($page == $counter) {
$paginate.= "<span><a id='next' style=\"background-color: var(--button-hover-color);cursor: default !important; opacity:0.6;\">" . $lang['NAV_NEXT'] . "</a></span> ";
}
$paginate.= "</div>";
}
if (isset($_GET['random'])) {
if ($random = '1') {
$query1 = "select * from songs WHERE `enabled`='1' AND `song_type`='0' ORDER BY RAND() LIMIT 0,$random_limit";
$result = mysqli_query($conn, $query1);
}
}
//Search box
echo '<div align="center" class="sbox" style="width:50%;">';
echo "<form name=\"input\" action=\"$targetpage\" method=\"get\">";
echo " <input type=\"text\" value=\"$srch\" name=\"searchterm\"
placeholder=\"" . $lang['SEARCH_TXT'] . "\"> <input type=\"submit\" value=\"" . $lang['SEARCH_BUTTON'] . "\"><INPUT class=\"random\" Type=\"BUTTON\" VALUE=\"" . $lang['REQ_RANDOM'] . " " . $random_limit . "\" ONCLICK=\"window.location.href='?random=$random_seed'\">";
// echo '<br />';
echo '</form>';
echo '</div>';
if ($total_pages > 0) {
echo '<div id="paginate" $hidepages align="center">' . $paginate . '</div>';
//Results table
echo "<center>";
echo '<br><table class= "tablespec" border="0" cellspacing="0" cellpadding="5" width="90%">';
echo " <tr>" . "";
echo " <th style='width:6%;text-align: center;'>".$lang['COL_NUM']."</th>";
echo " <th style='width:35%;'>" . $lang['COL_ARTIST'] . "</th><th style='width:50%;'>".$lang['COL_TITLE']."</th>";
//echo " <th style='width:40%;'>" . $lang['COL_YEAR'] . "</th>";
echo " <th style='width:5%;'>" . $lang['COL_DURATION'] . "</th>";
echo " <th style='width:75px;'>" . $lang['COL_REQ'] . "</th>";
echo " </tr>" . "";
$cnt = 1+($page_limit*$page)-$page_limit; //Results counter
//Add results to the table
while ($row = mysqli_fetch_assoc($result)) {
echo " <tr>" . "";
echo " <td style='text-align: center;'>$cnt</td>";
echo " <td>" . $row['artist'] . "</td><td>".$row['title']."</td>";
// echo " <td>" . $row['year'] . "</td>";
echo " <td>" . convertTime($row['duration']) . "</td>";
if (track_can_play($row['date_played'], $row['artist_played']) == true) {
echo " <td class=\"entry_no\"><a href=\"$targetpage?page=$page&requestid=" . $row['ID'] . "\" title=\"" . $lang['ALT_REQ'] . "\"><button>".$lang['REQ_SELECT']."</button></a></td>";
} else {
echo " <td class=\"entry_no\"><center><span class=\"noreq\">".$lang['NOREQ']."</span></center></td>";
}
echo " </tr>";
$cnt++;
}
@mysqli_free_result($conn, $result);
echo "</center>"; ?>
</table>
<br />
<?php
if (isset($_GET['random'])) {
echo " <INPUT class=\"random\" Type=\"BUTTON\" style=\"width: auto; display:inline-block;padding: 10px !important;\" VALUE=\"" . $lang['REQ_RANDOM2'] . " " . $random_limit . "\" ONCLICK=\"window.location.href='?random=$random_seed'\">";
} else {
//Add the bottom pagination
echo '<div id="paginate" align="center">' . $paginate . '</div>';
}
} else {
echo "<center><div class=\"errordiv\">" . $lang['MSG_NORESULTS'] . "</div></center>";
}
} ?>
</td>
</tr>
</table>
</center>
</div>
<?php
}
?>
<script src="
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('#toTop').show();
} else {
$('#toTop').hide();
}
});
$('#toTop').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
</script>
</body>
</html>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">
Your browser does not support the HTML5 canvas tag.
</canvas>
</body>
</html>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<center><!DOCTYPE html>
<html>
<body text="green">
</body>
</html></center>
<!DOCTYPE html>
<html>
<head>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<title>HotTunez Requests</title>
<meta charset="utf-8" />
<link href="
https://fonts.googleapis.com/css?family=Open+Sans:400,600,700" rel="stylesheet">
<style>
<?php include 'main.css'; ?>
</style>
</head>
<?php
include 'config.php';
include 'functions.php';
?>
<body>
<button id="toTop" title="Go to top">Top</button>
<?php
if (!$conn) {
echo "<center><table class=\"table\" style=\"width: 300px; text-align: center\"><td>".$lang['OFFLINE']."</td></table></center>";
} else {
?>
<div class="content">
<table class="table table1" style="width: 700px"><td><center><?php echo $lang['REQUESTED_TRACK_LIMITS'].''.$reqLimit.''.$lang['REQUESTED_TRACK_LIMITS1'].''.$req_wait.''.$lang['REQUESTED_TRACK_LIMITS2']; ?> </center></td></table>
<?php
if (!$req_event == 0) {
echo "<table class=\"table\" style=\"width: 400px; text-align: center\"><td>".$lang['REQ_EVENT']." ".$req_event." ",$lang['REQ_EVENT2']."</td></table>";
} ?>
<div style="text-align: center;"><?php echo $lang['REQ_A_TRACK']; ?></div>
<table class="table sbox" style="width: 70%">
<tr>
<td>
<?php
$targetpage = $_SERVER['SCRIPT_NAME']; //Link to this page
$srch = "";
$srchpath = "";
$srcquery = "";
$page = 1;
$reqid = "";
$notin = "AND id_subcat NOT IN(".$reqsubcat.")";
if (isset($_GET['searchterm'])) {
if ($_GET['searchterm'] != "") {
if (!empty($reqsubcat)) {
$srch = mysqli_real_escape_string($conn, $_GET['searchterm']);
$srchpath = "&searchterm=$srch";
$srcquery = "AND `enabled`= 1 AND (`artist` LIKE '%$srch%') OR (`title` LIKE '%$srch%') $notin "; //Search artist and title not in selected subcats only enabled tracks.
} else {
$srch = mysqli_real_escape_string($conn, $_GET['searchterm']);
$srchpath = "&searchterm=$srch";
$srcquery = "AND `enabled`= 1 AND (`artist` LIKE '%$srch%') OR (`title` LIKE '%$srch%')"; //Search artist and title only on enabled tracks.
}
}
echo "<center><div id=\"notfind\">".$lang['ERROR_FIND']."<br><br>
<A HREF=\"javascript:javascript:history.go(-1)\"><button class=\"button back\">".$lang['GO_BACK']."</button></A></div></center>";
}
//Get the page if it's requested
if (isset($_GET['page'])) {
$page = mysqli_real_escape_string($conn, $_GET['page']);
}
if ($page) {
$start = ($page - 1) * $page_limit;
} else {
$start = 0;
}
if (isset($_POST['reqsubmit'])) {
/*
ERROR CODES:
0 = No error
1 = no user name
2 = no requested track
3 = track already in queue
4 = request limit reached
5 = Waiting time not over
*/
$reqname = mysqli_escape_string($conn, $_POST['requsername']);
$reqmsg = mysqli_escape_string($conn, $_POST['reqmessage']);
$reqsongID = mysqli_escape_string($conn, $_POST['songID']);
$reqIP = getRealIpAddr();
$error = 0;
$reccount = 0;
if (!$reqname) {
$error = 1;
}
if (!$reqsongID) {
$error = 2;
}
if ($error == 0) {
//track is already requested?
$recheck = "SELECT COUNT(*) AS num FROM `requests` WHERE `songID`='$reqsongID' AND `played`='0' AND `song_type`='0';";
$total_req = mysqli_fetch_array(mysqli_query($conn, $recheck));
if ($total_req['num'] > 0) {
$error = 3;
}
@mysqli_free_result($conn, $total_req);
if ($error == 0) {
//user has reached the request limit?
$recheck = "SELECT COUNT(*) AS num FROM `requests` WHERE `userIP`='$reqIP' AND DATE(`requested`) = DATE(NOW());";
$total_req = mysqli_fetch_array(mysqli_query($conn, $recheck));
if ($total_req['num'] >= $reqLimit) {
$error = 4;
$reccount = $total_req['num'];
}
# check if waiting time is over for new request.
$sql= "SELECT * FROM `requests` WHERE `userIP`='$reqIP' ORDER BY `requested` DESC LIMIT 1 ";
$res = $conn->query($sql);
if ($res->num_rows > 0) {
while ($row = mysqli_fetch_assoc($res)) {
$timex= $row['requested'];
}
$calc = strtotime($timex);
$calc2 = date('Y-m-d H:i:s');
$calc3 = strtotime($calc2);
$calc4 = ($calc3-$calc) / 60;
$min = intval($calc4);
if ($min < $req_wait) {
$error = 5;
}
}
# check waiting time end.
@mysqli_free_result($conn, $total_req);
}
}
switch ($error) {
case 0:
echo "<center>";
$queryx = "INSERT INTO `requests` SET `songID`='$reqsongID', `username`='$reqname', `userIP`='$reqIP', `message`='$reqmsg', `requested`=now();";
$resultx = mysqli_query($conn, $queryx);
if ($resultx > 0) {
$nu1= $total_req['num'];
$nu2 = $nu1+1;
echo "<div class=\"noticediv\">" . $lang['MSG_REQSUCCESS'] . " <b>".$nu2."</b> ".$lang['MSG_REQSUCCESS_TOT']." <b>".$reqLimit."</b>";
if ($nu2 == $req_wait) {
echo "<center><div class=\"errordiv\">" . $lang['ERROR_LIMITREACHED2'] . "</div></center><br><br>";
} else {
echo "<br />".$lang['WAIT']." ".$req_wait." ".$lang['WAIT2']."</div>";
}
} else {
echo "<center><div class=\"errordiv\"><center>" . $lang['ERROR_UNKNOWN'] . "</center></div></center><br /><br>";
}
@mysqli_free_result($conn, $resultx);
echo '</center>';
break;
case 1:
echo '<center>';
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_USERNAME'] . "</center></div></center><br />";
echo "<div id=\"back\"><center><br><br><A HREF=\"javascript:javascript:history.go(-1)\"><button
class=\"back\">".$lang['GO_BACK']."</button></A></center>";
break;
echo '</center>';
case 2:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_TRACKID'] . " </center></div></center><br />";
echo "<center><A HREF=\"javascript:javascript:history.go(-1)\">".$lang['GO_BACK']."</A></center><br><br>";
break;
case 3:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_TRACKREQ'] . "</center></div></center><br /><br>";
break;
case 4:
echo "<br><center><div class=\"errordiv\"><center>" . $lang['ERROR_LIMITREACHED'] . " (" . $reccount . "/" . $reqLimit . ")" . "</center></div></center><br /><br>";
break;
case 5:
$wait_time= $req_wait-$min;
echo "<br><center><div class=\"errordiv\">" . $lang['ERROR_TRACKREQ_TIME'] . " ".$wait_time." ".$lang['ERROR_TRACKREQ_TIME2']."</div></center><br>";
break;
}
$reqid = "";
}
//Get the page if it's requested
if (isset($_GET['requestid'])) {
if ($_GET['requestid'] != "") {
$reqid = mysqli_escape_string($conn, $_GET['requestid']);
//Get track artist Name and title.
$querysong = "SELECT * FROM `songs` WHERE `ID` = $reqid AND `enabled`= '1' AND `song_type`='0' ";
$queryderp = mysqli_query($conn, $querysong);
while ($row = mysqli_fetch_assoc($queryderp)) {
$title= $row['title'];
$artist= $row['artist'];
}
echo "<div class=\"selection\">".$lang['REQ_SELECTED']. " ". $artist." - ".$title."</div></td></tr>";
echo "<table>";
echo " <form id=\"formrequest\" name=\"formrequest\" method=\"post\" action=\"$targetpage?page=$page$srchpath\">";
echo " <table align=\"center\" width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" class=\"nobar\">";
echo " <tr>";
echo "<td><div align=\"center\"><p>" . $lang['REQ_DESCRIPTION'] . "</p></div></td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type=\"text\" autofocus name=\"requsername\" placeholder=\"" . $lang['REQ_NAME'] . "\" /></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"3\"><div class=\"message\"><textarea name=\"reqmessage\" rows=\"5\" cols=\"80\" placeholder=\"" . $lang['REQ_MESSAGE'] . "\"></textarea></div></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"2\"><div align=\"center\"><input type=\"Submit\" name=\"reqsubmit\" value=\"" . $lang['REQ_BUTTON'] . "\" /></div></td>";
echo " </tr>";
echo " </table>";
echo " <INPUT TYPE=\"hidden\" name=\"songID\" value=\"$reqid\">";
echo " </form>";
echo " </div>";
echo "</td></table>";
echo "<div id=\"back\"><center><br><br><A HREF=\"javascript:javascript:history.go(-1)\"><button
class=\"back\">".$lang['GO_BACK']."</button></A></center>";
echo '</td></table></center></div>';
}
}
//================//
if ($reqid == "") {
//Get the number of items
if (!empty($reqsubcat)) {
$query = "SELECT COUNT(*) as num FROM `songs` WHERE `enabled`='1' $srcquery AND `song_type`='0' $notin ";
$total_pages = mysqli_fetch_array(mysqli_query($conn, $query));
$total_pages = $total_pages['num'];
} else {
$query = "SELECT COUNT(*) as num FROM `songs` WHERE `enabled`='1' $srcquery AND `song_type`='0' ";
$total_pages = mysqli_fetch_array(mysqli_query($conn, $query));
$total_pages = $total_pages['num'];
}
//Get page data (To inplant left join queuelist see)
if (!empty($reqsubcat)) {
$query1 = "SELECT `ID`, `artist`, `title`, `year`, `duration`, `date_played`, `artist_played`,`id_subcat` FROM `songs` WHERE `enabled`='1' $srcquery AND`song_type`='0' $notin ORDER BY `artist` ASC LIMIT $start, $page_limit";
$result = mysqli_query($conn, $query1);
} else {
$query1 = "SELECT `ID`, `artist`, `title`, `year`, `duration`, `date_played`, `artist_played`,`id_subcat` FROM `songs` WHERE `enabled`='1' $srcquery AND`song_type`='0' ORDER BY `artist` ASC LIMIT $start, $page_limit";
$result = mysqli_query($conn, $query1);
}
// Initial page num setup
if ($page == 0) {
$page = 1;
}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$page_limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if ($lastpage > 1) {
$paginate .= "<div class='paginate'>";
//Placeholder for previous so buttons don't move after page 1
if ($page == 1) {
$paginate.= "<span style\"visibility:normal;\"><a id='prev' style=\"background-color: var(--button-hover-color);cursor: default !important; opacity:0.6;\">" . $lang['NAV_PREV'] . "</a></span> ";
}
// Previous
if ($page > 1) {
$paginate.= "<a href='$targetpage?page=$prev$srchpath' id='prev'>" . $lang['NAV_PREV'] . "</a> ";
}
// Pages
if ($lastpage < 7 + ($adjacents * 2)) {
for ($counter = 1; $counter <= $lastpage; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
} elseif ($lastpage > 5 + ($adjacents * 2)) {
// Beginning only hide later pages
if ($page < 1 + ($adjacents * 2)) {
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
$paginate.= "<strong>...</strong>";
$paginate.= "<a href='$targetpage?page=$LastPagem1$srchpath'> $LastPagem1 </a>";
$paginate.= "<a href='$targetpage?page=$lastpage$srchpath'> $lastpage </a>";
} elseif ($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) {
$paginate.= "<a href='$targetpage?page=1$srchpath'> 1 </a>";
$paginate.= "<a href='$targetpage?page=2$srchpath'> 2 </a>";
$paginate.= "<strong>...</strong>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
$paginate.= "<strong>...</strong>";
$paginate.= "<a href='$targetpage?page=$LastPagem1$srchpath'> $LastPagem1 </a>";
$paginate.= "<a href='$targetpage?page=$lastpage$srchpath'> $lastpage </a>";
} else {
$paginate.= "<a href='$targetpage?page=1$srchpath'> 1 </a>";
$paginate.= "<a href='$targetpage?page=2$srchpath'> 2 </a>";
$paginate.= "<strong>...</strong>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) {
if ($counter == $page) {
$paginate.= "<span class='current'> $counter </span>";
} else {
$paginate.= "<a href='$targetpage?page=$counter$srchpath'> $counter </a>";
}
}
}
}
// Next
if ($page < $counter - 1) {
$paginate.= "<a href='$targetpage?page=$next$srchpath' id='next'> " . $lang['NAV_NEXT'] . "</a>";
}
//Placeholder for next so buttons don't move after last page
if ($page == $counter) {
$paginate.= "<span><a id='next' style=\"background-color: var(--button-hover-color);cursor: default !important; opacity:0.6;\">" . $lang['NAV_NEXT'] . "</a></span> ";
}
$paginate.= "</div>";
}
if (isset($_GET['random'])) {
if ($random = '1') {
$query1 = "select * from songs WHERE `enabled`='1' AND `song_type`='0' ORDER BY RAND() LIMIT 0,$random_limit";
$result = mysqli_query($conn, $query1);
}
}
//Search box
echo '<div align="center" class="sbox" style="width:50%;">';
echo "<form name=\"input\" action=\"$targetpage\" method=\"get\">";
echo " <input type=\"text\" value=\"$srch\" name=\"searchterm\"
placeholder=\"" . $lang['SEARCH_TXT'] . "\"> <input type=\"submit\" value=\"" . $lang['SEARCH_BUTTON'] . "\"><INPUT class=\"random\" Type=\"BUTTON\" VALUE=\"" . $lang['REQ_RANDOM'] . " " . $random_limit . "\" ONCLICK=\"window.location.href='?random=$random_seed'\">";
// echo '<br />';
echo '</form>';
echo '</div>';
if ($total_pages > 0) {
echo '<div id="paginate" $hidepages align="center">' . $paginate . '</div>';
//Results table
echo "<center>";
echo '<br><table class= "tablespec" border="0" cellspacing="0" cellpadding="5" width="90%">';
echo " <tr>" . "";
echo " <th style='width:6%;text-align: center;'>".$lang['COL_NUM']."</th>";
echo " <th style='width:35%;'>" . $lang['COL_ARTIST'] . "</th><th style='width:50%;'>".$lang['COL_TITLE']."</th>";
//echo " <th style='width:40%;'>" . $lang['COL_YEAR'] . "</th>";
echo " <th style='width:5%;'>" . $lang['COL_DURATION'] . "</th>";
echo " <th style='width:75px;'>" . $lang['COL_REQ'] . "</th>";
echo " </tr>" . "";
$cnt = 1+($page_limit*$page)-$page_limit; //Results counter
//Add results to the table
while ($row = mysqli_fetch_assoc($result)) {
echo " <tr>" . "";
echo " <td style='text-align: center;'>$cnt</td>";
echo " <td>" . $row['artist'] . "</td><td>".$row['title']."</td>";
// echo " <td>" . $row['year'] . "</td>";
echo " <td>" . convertTime($row['duration']) . "</td>";
if (track_can_play($row['date_played'], $row['artist_played']) == true) {
echo " <td class=\"entry_no\"><a href=\"$targetpage?page=$page&requestid=" . $row['ID'] . "\" title=\"" . $lang['ALT_REQ'] . "\"><button>".$lang['REQ_SELECT']."</button></a></td>";
} else {
echo " <td class=\"entry_no\"><center><span class=\"noreq\">".$lang['NOREQ']."</span></center></td>";
}
echo " </tr>";
$cnt++;
}
@mysqli_free_result($conn, $result);
echo "</center>"; ?>
</table>
<br />
<?php
if (isset($_GET['random'])) {
echo " <INPUT class=\"random\" Type=\"BUTTON\" style=\"width: auto; display:inline-block;padding: 10px !important;\" VALUE=\"" . $lang['REQ_RANDOM2'] . " " . $random_limit . "\" ONCLICK=\"window.location.href='?random=$random_seed'\">";
} else {
//Add the bottom pagination
echo '<div id="paginate" align="center">' . $paginate . '</div>';
}
} else {
echo "<center><div class=\"errordiv\">" . $lang['MSG_NORESULTS'] . "</div></center>";
}
} ?>
</td>
</tr>
</table>
</center>
</div>
<?php
}
?>
<script src="
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('#toTop').show();
} else {
$('#toTop').hide();
}
});
$('#toTop').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
</script>
</body>
</html>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">
Your browser does not support the HTML5 canvas tag.
</canvas>
</body>
</html>