PDA

View Full Version : help on tutorial for DJ Says



:Lively
01-08-2006, 12:08 PM
Hey, i followed the tutorial for a DJ says in the tutorial forum. However it only allows a message, and i also want a Dj name put into it aswell.

I have coded most of it, however on the below bit of code, i need it to also get "name" from "djsays", however i don't know how to get it in.

Help plz, and + rep for whoever does.


<?php
include('include/session.php');
$select = mysql_query("SELECT message from djsays order by id DESC LIMIT 1");
$message = mysql_fetch_array($select)
?>

reindeer.
01-08-2006, 01:12 PM
Hi, a little thing I made using my radio stats. You wont need your above code. PLease note before doing this, the DJ name wont appear in your DJ says box, but just above it. Thanks.

First, make a file called djsaysframe.php. In it, put:

<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.
include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.'Radio Stats';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
################################################## ################################################## ##################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);

// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
################################################## ################################################## ##################
################################################## ################################################## ##################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info

fclose($scfp);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="40;URL=djsaysframe.php">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="verdana" bgcolor="#FFDE00">
<font face="verdana" size="1" color="black"><b></b>&nbsp;'.$servertitle.'</font><font face="verdana" size="1" color="#000000"> Says:</font>
</body>

</html>';
}
if($streamstatus == "0")

{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=djsaysframe.php">
<link rel=stylesheet href="" type="text/css">
<title>YOURSITE Stats</title>
</head>
<body text="verdana" bgcolor="#FFDE00"><font face="verdana" size="1" color="black"><b>No DJ DJing, the current DJ says is from the previous DJ.</font></p>
</body><a href=""></a>

</html>';
}
?>

Make sure config_radio.php is configured to your radio details.

Then, above the DJ says box, put this code:

<iframe src="djsaysframe.php" scrolling="no" frameborder="0" height="50" width="200"></iframe><br>
YOUR DJ SAYS CODE HERE

This does mean that when there is no DJ on it doesnt have a DJ name. You can edit what it says when there is no DJ on in the code above. Just find the writing that says: No DJ DJing, the current DJ says is from the previous DJ.

I also suppose youll want to change bg colour, but Im guessing youll know how to do that :P


Hope that is of help. You can see mine at work by clicking here (http://www.samsterteenzradio.com/djsays.html).

:Lively
01-08-2006, 01:40 PM
nah its ok thanx, i managed to do it anover way using


<?php
include('include/session.php');
$select = mysql_query("SELECT name from djsays order by id DESC LIMIT 1");
$name = mysql_fetch_array($select);
?>
<?php

$select = mysql_query("SELECT message from djsays order by id DESC LIMIT 1");
$message = mysql_fetch_array($select);
?>

Thanks anyway!

Want to hide these adverts? Register an account for free!