Ik heb 1 vraagje.
hoe kan je in sam laten zijn wie en welk bericht een verzoek doet.
Heb er nu een andere manier voor via me webserver een php gemaakt alleen dat werkt niet echt fijn heb het liever direct in me sam zichtbaar.
hieronder heb ik inieder geval de code zichtbaar gemaakt voor diegene die het zouden willen weten.
Code: Selecteer alles
<?php
// SAM 4 Request Viewer for samPHPweb v0.3
// This php script will allow you to view all requests made by your visitors,
// regardless if they're pending in the queue, already played or ignored/failed; newest on top.
// If a dedication messages exist, it will be displayed on a line under.
// Page layout is similar to RacketRadio's script for SAM v2 at:
// http://www.spacialaudio.com/knowledge/question.php?qstId=263
// Put this file in your SAM directory.
// Your station name can be changed in your config.php file
/////////////////
// Configurables
/////////////////
// How many rows do you want to display per page?
$limit = 50;
// If you plan on using the script to monitor dedications in the queue, you'll want to
// refresh the page, add desired delay in seconds, or 0 to turn off.
$refresh_rate = 0;
//Display Track durations in table? (default = 1)
$dspl_duration = 1;
// Perform Reverse DNS? (May be slower) 1 to turn on, 0 to turn off.
// If this is enabled, use lower rows per page! (default = 1)
$reverse = 1;
//Display ETA? Use when requests are delayed. (default = 0)
$dspl_eta = 0;
// WordWrap. This will cut loooong words (like sticky fingers) into easier-to-read blocks in Name and
// Dedication fields, so you won't have to scroll left to right. Pick a number, use 1 million to turn off :)
$wrap = 25;
// Colors
$dark="FFDDDD"; //background color for the tables
$light="DDFFDD"; //background color for the tables
$pagebgcolor="DDDDFF"; //background color for the whole page
// If you want to change the Language, do so here.
// Error code descriptions can be translated at the bottom of the script
$lang['header'] = 'Request Viewer';
$lang['artist'] = 'Artist';
$lang['title'] = 'Title';
$lang['current_filter'] = 'Current Filter';
$lang['mmss'] = 'Duration';
$lang['host'] = 'IP Address';
$lang['domain'] = 'Hostname';
$lang['songid'] = 'Song ID';
$lang['t_stamp'] = 'Time Requested';
$lang['eta'] = 'ETA';
$lang['status'] = 'Status';
$lang['name'] = 'Requested by';
$lang['msg'] = 'Dedication';
$lang['nextpage'] = 'Next Page';
$lang['legend'] = 'Legend';
// If you changed the filename for your config.php, do so here, otherwise don't touch it.
require("config.php");
// End of Configurables
if ((empty($_GET["host"])) && (empty($_GET["songid"])) && (empty($_GET["code"])) && (empty($_GET["status"])) && (empty($_GET["nom"]))) $where = "";
else {
$where = " WHERE ";
if (!empty($_GET["host"])) $where = $where."(host='$host') AND ";
if (!empty($_GET["songid"])) $where = $where."(songid='$songid') AND ";
if (!empty($_GET["code"])) $where = $where."(code='$code') AND ";
if (!empty($_GET["status"])) $where = $where."(requestlist.status='$status') AND ";
if (!empty($_GET["nom"])) $where = $where."(name='$nom') AND ";
$where = substr($where,0,-4);
}
if (empty($start)) $start=0;
$db->open("SELECT requestlist.*,songlist.artist,songlist.title,songlist.duration FROM requestlist LEFT JOIN songlist ON requestlist.songid=songlist.id $where ORDER BY requestlist.id DESC",$limit,$start);
$reqlst = $db->rows();
reset($reqlst);
function GetTheDamnHost($addy){
global $reverse, $song;
if ($addy == "127.0.0.1") echo "<br>(localhost)";
elseif (substr($addy,0,7)=="192.168") echo "<br>(Local Area)";
elseif (substr($addy,0,3)=="10.") echo "<br>(Local Area)";
elseif ((substr($addy,0,3)=="172") && (substr($addy,4,4)>="16.0") && (substr($addy,4,4)<"32.0")) echo "<br>(Local Area)";
elseif ($reverse==1) echo "<br>(".gethostbyaddr($addy).")";
// You can add pointers about some IP addresses (like non-human requests) here by adding elseif entries.
if (substr($song['host'],0,5)=="74.6.") echo "<br>(Yahoo Bot)";
elseif (substr($song['host'],0,6)=="65.55.") echo "<br>(MSNbot)";
}
function PutSongRow(&$song)
{
global $rc, $lang, $dspl_duration, $dspl_eta, $reverse, $host, $songid, $code, $status, $nom, $wrap, $dark, $light;
PrepareSong($song);
$bgcolor = $dark;$rc = $song['id'];if ($rc % 2) $bgcolor = $light;
echo "<tr bgcolor=$bgcolor><td>".$song['id']."</td><td><a href=\"?host=".$host."&code=".$code."&status=".$status."&songid=".$song['songid']."&nom=".$nom."\">".$song['artist']." - ".$song['title']."</a>";
if ($dspl_duration==1) echo " (".$song['mmss'].")";
echo "</td><td align=\"center\"><a href=\"?songid=".$songid."&code=".$code."&status=".$status."&host=".$song['host']."&nom=".$nom."\">".$song['host']."</a>";
GetTheDamnHost($song['host']);
echo "</td><td align=\"center\">".$song['t_stamp']."</td>";
if ($dspl_eta==1) echo "<td align=\"center\">".$song['eta']."</td>";
echo "<td align=\"center\"><a href=\"?host=".$host."&songid=".$songid."&code=".$code."&status=".$song['status']."&nom=".$nom."\">".$song['status']."<br><a href=\"?host=".$host."&songid=".$songid."&status=".$status."&code=".$song['code']."&nom=".$nom."\">".$song['code']."</a></td><td align=\"center\"><a href=\"?host=".$host."&songid=".$songid."&code=".$code."&status=".$status."&nom=".$song['name']."\">".stripslashes(wordwrap($song['name'],$wrap," ",TRUE))."</a></td></tr>\n";
if (isset($song['msg'])) {
$the_msg = stripslashes(wordwrap($song['msg'],$wrap," ",TRUE));
echo "<tr><td colspan=7><b>".$lang['msg'].":</b> ".Text2Html(trim($the_msg))."</td></tr>\n";
}
}
if ($refresh_rate>0) echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$refresh_rate\">\n";
echo "<html><head><title>".$station." ".$lang['header']."</title></head>\n<body bgcolor=\"$pagebgcolor\">\n<center><h2>".$station." ".$lang['header']."</h2></center><br>\n";
echo "<b>".$lang['current_filter']."</b>: ";
if (!empty($host)) { echo $lang['domain']."=".$host;if ((!empty($songid)) || (!empty($status)) || (!empty($code)) || (!empty($nom))) echo " & "; }
if (!empty($songid)) { echo $lang['songid']."=".$songid;if ((!empty($status)) || (!empty($code)) || (!empty($nom))) echo " & "; }
if (!empty($status)) { echo $lang['status']."=".$status;if ((!empty($code)) || (!empty($nom))) echo " & "; }
if (!empty($code)) { echo "Code=".$code;if (!empty($nom)) echo " & "; }
if (!empty($nom)) echo "Name=".$nom;
// table headers
echo "<table border=0 width=\"100%\"><tr align=\"center\"><td>#</td><td><b>".$lang['artist']." - ".$lang['title'];
if ($dspl_duration==1) echo " (".$lang['mmss'].")";
echo "</b></td><td><b>".$lang['host'];if ($reverse==1) echo "<br>(".$lang['domain'].")";
echo "</b></td><td><b>".$lang['t_stamp']."</b></td>";
if ($dspl_eta==1) echo "<td><b>".$lang['eta']."</b></td>";
echo "<td><b>".$lang['status']."</b></td><td><b>".$lang['name']."</b></td></tr>\n";
$rc=0;
while(list($key, $song) = each($reqlst)) {
PutSongRow($song);
}
if ($rc>1) {
$start = $start+$limit;
echo "<tr><td colspan=\"7\"><center><a href=\"?host=$host&songid=$songid&status=$status&code=$code&nom=$nom&start=$start\">".$lang['nextpage']." >></a></center></td></tr>";
}
echo "</table><br>\n<table border=\"1\"><tr><td align=\"center\" colspan=\"2\"><b>".$lang['legend']."</b></td></tr><tr><td>
600 - Requested song is offline and can not be played<br>
601 - Song recently played.<br>
602 - Artist recently played<br>
603 - Song already in queue to be played<br>
604 - Artist already in queue to be played.<br>
605 - Song already in request list<br>
606 - Artist already in request list<br>
609 - Track recently played<br>
610 - Track already in queue to be played<br>
611 - Track already in request list<br>
612 - Album already in queue to be played</td><td valign=\"top\">
700 - Invalid request. (Unknown error with request)<br>
701 - Banned<br>
702 - Banned until mm:ss<br>
703 - Requested song ID invalid<br>
704 - Request limit reached. You can only request xx songs every xx minutes<br>
705 - Request limit reached. You can only request xx songs per day<br>
706 - Requests are disabled.<br>
707 - Authorization failed. IP not in allowed list.<br>
708 - You have already requested this song and it is waiting in the request queue to be played.</td>
</tr></table>
© ".date('Y')." $station</body></html>"
?>

