Kport
02-12-2013, 02:21 AM
Hi guys, does anyone have a working request line script that will only display the users in the DJ group and not every single radipanel user (for instance forum moderators show on the request line) - it's annoying when you want them to show on the staff page but hide it from the request line.
Secondly, is there a way for radipanel to automatically switch the DJ option to the person on air? My current script isn't doing it.
<?php require_once( "../_inc/glob.php" );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>radiPanel Request Line</title>
<div class="wrapper">
<font size="1" face="Verdana" color="#FFFFFF">
<?php
if( $_POST['submit'] ) {
try {
$habbo = $core->clean( $_POST['habbo'] );
$type = $core->clean( $_POST['type'] );
$dj = $core->clean( $_POST['dj'] );
$request = $core->clean( $_POST['request'] );
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
if( !$habbo or !$type or !$dj or !$request or !is_numeric( $dj ) or !is_numeric( $type ) ) {
throw new Exception( "All fields are required" );
}
else {
$db->query( "INSERT INTO requests VALUES (NULL, '{$type}', '{$dj}', '{$habbo}', '{$request}', '{$time}', '{$ip}');" );
echo "<div class=\"good\">";
echo "<strong>Success</strong>";
echo "<br />";
echo "Request sent!";
echo "</div>";
}
}
catch( Exception $e ) {
echo "<div class=\"bad\">";
echo "<strong>Error</strong>";
echo "<br />";
echo $e->getMessage();
echo "</div>";
}
}
?>
</font>
<form action="" method="post">
<font face="Verdana" color="#FFFFFF">
<label for="habbo"><b><font size="1">Habbo name:</font></b><font size="1"><br>
</font></label>
</font><font color="#FFFFFF" face="Verdana" size="1">
<input type="text" name="habbo" id="habbo" maxlength="255" />
<br /><br />
</font><font face="Verdana" color="#FFFFFF">
<b>
<label for="type"><font size="1">Message type:<br></font></label></b>
</font><font color="#FFFFFF" face="Verdana" size="1">
<select name="type" id="type">
<?php
$query = $db->query( "SELECT * FROM request_types" );
while( $array = $db->assoc( $query ) ) {
?>
<option value="<?php echo $array['id']; ?>">
<?php echo $array['name']; ?>
</option>
<?php
}
?>
</select>
<br /><br />
<label for="dj"><b>DJ:</b><br></label> <select name="dj" id="dj">
<?php
$query = $db->query( "SELECT * FROM connection_info ORDER BY id DESC LIMIT 1" );
$array = $db->assoc( $query );
$info = $core->radioInfo( "http://{$array['host']}:{$array['port']}" );
$query2 = $db->query( "SELECT * FROM users" );
while( $array2 = $db->assoc( $query2 ) ) {
?>
<option<?php if( preg_match( "/{$array2['username']}/", $info['streamtitle'] ) ) { ?> selected="selected"<?php } ?> value="<?php echo $array2['id']; ?>">
DJ <?php echo $array2['username']; ?>
</option>
<?php
}
?>
</select>
<br /><br />
</font><font face="Verdana" color="#FFFFFF">
<label for="request"><font size="1"><b>Message:</b><br></font></label>
</font><font color="#FFFFFF" face="Verdana" size="1">
<textarea name="request" id="request" rows="5"></textarea>
<br /><br />
<input class="button" type="submit" name="submit" value="Submit" />
</font>
</form>
</div>
<font size="1" face="Verdana" color="#FFFFFF">
</body></font>
Secondly, is there a way for radipanel to automatically switch the DJ option to the person on air? My current script isn't doing it.
<?php require_once( "../_inc/glob.php" );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>radiPanel Request Line</title>
<div class="wrapper">
<font size="1" face="Verdana" color="#FFFFFF">
<?php
if( $_POST['submit'] ) {
try {
$habbo = $core->clean( $_POST['habbo'] );
$type = $core->clean( $_POST['type'] );
$dj = $core->clean( $_POST['dj'] );
$request = $core->clean( $_POST['request'] );
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
if( !$habbo or !$type or !$dj or !$request or !is_numeric( $dj ) or !is_numeric( $type ) ) {
throw new Exception( "All fields are required" );
}
else {
$db->query( "INSERT INTO requests VALUES (NULL, '{$type}', '{$dj}', '{$habbo}', '{$request}', '{$time}', '{$ip}');" );
echo "<div class=\"good\">";
echo "<strong>Success</strong>";
echo "<br />";
echo "Request sent!";
echo "</div>";
}
}
catch( Exception $e ) {
echo "<div class=\"bad\">";
echo "<strong>Error</strong>";
echo "<br />";
echo $e->getMessage();
echo "</div>";
}
}
?>
</font>
<form action="" method="post">
<font face="Verdana" color="#FFFFFF">
<label for="habbo"><b><font size="1">Habbo name:</font></b><font size="1"><br>
</font></label>
</font><font color="#FFFFFF" face="Verdana" size="1">
<input type="text" name="habbo" id="habbo" maxlength="255" />
<br /><br />
</font><font face="Verdana" color="#FFFFFF">
<b>
<label for="type"><font size="1">Message type:<br></font></label></b>
</font><font color="#FFFFFF" face="Verdana" size="1">
<select name="type" id="type">
<?php
$query = $db->query( "SELECT * FROM request_types" );
while( $array = $db->assoc( $query ) ) {
?>
<option value="<?php echo $array['id']; ?>">
<?php echo $array['name']; ?>
</option>
<?php
}
?>
</select>
<br /><br />
<label for="dj"><b>DJ:</b><br></label> <select name="dj" id="dj">
<?php
$query = $db->query( "SELECT * FROM connection_info ORDER BY id DESC LIMIT 1" );
$array = $db->assoc( $query );
$info = $core->radioInfo( "http://{$array['host']}:{$array['port']}" );
$query2 = $db->query( "SELECT * FROM users" );
while( $array2 = $db->assoc( $query2 ) ) {
?>
<option<?php if( preg_match( "/{$array2['username']}/", $info['streamtitle'] ) ) { ?> selected="selected"<?php } ?> value="<?php echo $array2['id']; ?>">
DJ <?php echo $array2['username']; ?>
</option>
<?php
}
?>
</select>
<br /><br />
</font><font face="Verdana" color="#FFFFFF">
<label for="request"><font size="1"><b>Message:</b><br></font></label>
</font><font color="#FFFFFF" face="Verdana" size="1">
<textarea name="request" id="request" rows="5"></textarea>
<br /><br />
<input class="button" type="submit" name="submit" value="Submit" />
</font>
</form>
</div>
<font size="1" face="Verdana" color="#FFFFFF">
</body></font>