Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
Countryman98
Hangin' Around


Joined: Feb 24, 2005
Posts: 30

PostPosted: Thu Sep 01, 2005 1:11 am Reply with quote

I have a FM radiostation as well as bradcast live over the net. I am currently using phpnuke with Sam broadcaster and need to get the following script to refresh after each song. Can a "Codewhizz" have a look at it for me please and put it right. I am trying to get it to "Refresh" th BLOCK ONLY after each song. This file is called by the block immediately following this script :

Any help would be very much appreciated as this is beyond me!
===============================================
<?
// Sam3 - PHPNuke Content Block
// Version 1 03/10/2005
//
//

// Edit this verable to point to your content page with your station wrap around.
// Or to whatever URL you have your radio station set to.

require("config2.php");

$db->open("SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist,songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S') ORDER BY historylist.date_played DESC",6);
$history = $db->rows();
reset($history);

$db->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S') AND (songlist.artist <> '') ORDER BY queuelist.sortID ASC",2);
$queue = $db->rows();
reset($queue);

//### Calculate the bezt time to refresh the webpage in order to show new updated song information
//==================================================================================================

list($key, $song) = each($history);
$listeners = $song["listeners"];

$starttime = strtotime($song["date_played"]);
$curtime = time();
$timeleft = $starttime+round($song["duration"]/1000)-$curtime;

//Set refesh interval
if($timeleft>0) # 30 second minimum wait
{ $timeout = $timeleft;} # if timeleft is valid, refresh on timeleft (should be end of song)
else
{ $timeout = 90; } # otherwise, fall back on 90 second refresh

if(($timeout>180) or ($timeout==0)) $timeout = 180;
if($timeout<30) $timeout = 30;

//$refreshURL = "playing.php?buster=".date('dhis').rand(1,1000);
$refreshURL = "nuke-block.php";

$radiostation = "http://www.hotcountry.co.nz/modules.php?name=Content&pa=showpage&pid=2";
$pic_cnt = 0;
function PicName()
{
global $pic_cnt;
echo "Picture".$pic_cnt;
}

function NextPicName()
{
global $pic_cnt;
$pic_cnt += 1;
PicName();
}

function PutSongRow(&$song)
{
global $rc, $showpic, $darkrow, $lightrow;
PrepareSong($song);
}


//PutSongRow
$rc=0;
PutSongRow($song);
$mainsong = $song;

// Image and Link to Radio Station

?>
<SC~RIPT LANGUAGE="JavaScript">

var refreshID = "";
refreshID = setTimeout("DoRefresh()", <? echo ($timeout*1000); ?>);

function DoRefresh()
{
// document.location.href = '<? echo $refreshURL; ?>';
}

</SC~RIPT>

<d~iv align="center"><i~mg id="<? NextPicName(); ?>" onError="PictureFail('<? PicName(); ?>')" src="<? echo $mainsong['picture']; ?>" border="0" width="<? echo $picwidth; ?>"><br>
<font size="2" face="arial" color="#000000">
Now Playing:</font>
</a><br>


<fo~nt size="2" color="#000000">
<mar~quee width="100%" scrolldelay="100" scrollamount="5"><font class="content"><font color="red"><? echo $mainsong['artist'];?> - <? echo $mainsong['title']; ?><font color="#000000"> - <? echo $mainsong['mmss']; ?></marquee></font></b>

</sm~all></fo~nt>
</d~iv>
<h r align="center">
<p align="center"><font size="2"><font color="#000000" face="arial">Tune In Here Using:<br>


<? // Remember to point these URLS to your streaming server.
// Also make sure to link the images to a hard URL to
// make it easier to share this block with affilliates. ?>

</f~ont></b></font><font size="1" color="#B4B7CA">(CHOOSE PLAYER)<br><br></font>
<a href="http://66.246.222.54:8840/listen.pls"><img src="/modules/Nuke-Cast/images/real.gif" border=0></a>&nbsp;
<a href="http://66.246.222.54:8840/listen.pls"><img src="/modules/Nuke-Cast/images/winamp.gif" border=0></a>&nbsp;
<a href="http://66.246.222.54:8840/listen.pls"><img src="/modules/Nuke-Cast/images/windowsmedia.gif" border=0></a>&nbsp;
<a h~ref="http://66.246.222.54:8840/listen.pls"><img src="/modules/Nuke-Cast/images/itunes.gif" border=0></a>&nbsp;

<d~iv align="center"><img src="http://www.hotcountry.co.nz/modules/Nuke-Cast/images/radio-logo.gif" border=0></a>

<di~v align="center"><font size="2" face="arial">Listeners <b><? echo "$listeners"; ?></b>/40
</fo~nt>
</di~v>
<h~r>
<d~iv align="center">
<di~v align="center"><a href="http://www.hotcountry.co.nz" target="_blank"><font size="1" color="#B4B7CA">(C) Hot Country FM</font></a></font>

</d~iv>

Heres the block that calls the above script.
Thanks in advance for any help that i may receive.

<?
/* #########################################################
## ##
## SAM 3 Nuke Block ##
## ##
## By Mike Norton (mnorton@gamingministries.com) ##
## ##
#########################################################*/

if (eregi("block-SAM3_Block.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
echo "<link rel=\"stylesheet\" href=\"themes/$ThemeSel/style/style.css\" type=\"text/css\">";
echo "<st~yle type=\"text/css\">body {background-color: transparent}</st~yle>";

if($refresh==""){
echo "<meta http-equiv=\"refresh\" content=\"60\"><font class=\"content\">";
}
else {
echo "<meta http-equiv=\"refresh\" content=\"$refresh\"><font class=\"content\">";
}


//################################
// Change the picwidth in the url to make the block fit your site.

$content .= "<center><iframe src=\"http://www.hotcountry.co.nz/nuke-block.php?picwidth=120/\" name=\"HOTCOUNTRY\" scrolling=\"no\" frameborder=\"no\" align=\"top\" width=\"135\" height=\"355\">";
$content .= " . \</iframe></center>";
?>
 
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9449
Location: Arizona

PostPosted: Thu Sep 01, 2005 6:36 am Reply with quote

I believe that the actual block will need to set up the iframe and then the src page of that iframe is going to have to drive the REFRESH that you are looking for, so that it refreshes itself. You cannot put a META tag in anything but the <head></head> tags of your page (I think).

Regards,
montego

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Countryman98
PostPosted: Thu Sep 01, 2005 6:50 pm Reply with quote

Thanks for the reply montego,

I am new to php and this is a bit "over my head". I dont suppose you could give me an example of what i need to do to get this working. Your help would be greatly appreciated.

Smile

Regards
Countryman98
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©