Forum Moderators: coopster
i wonder if there's a PHP script for doing that.
thank you in advance
rogie
here enclosed the java script to give you an idea:
<a href="radio.asf" onclick="return controllaData();">stream</a>
<script>
function controllaData() {
var today = new Date();
var start = new Date(2002,05,26,12,00,00,00);
var end = new Date(2002,05,26,12,05,00,00);
// month starts from 0 (january) upto 11 (december)
if (today<start ¦¦ today>end) {
alert("not broadcasting at the moment")
return false;
}
}
<?
$start=(mktime(24,0,0,07,06,2002));
$finish=(mktime(24,0,0,07,06,2002));$date = getdate();
if ($start <= $date) {
echo ("Broadcasting right now!<br />");
}elseif ($finish >= $date) {
echo ("Broadcasting right now!<br />");
}else {
echo ("No broadcasting at the moment, sorry <br />");
}
?>
<?
$shour = 17; //start hour
$ehour = 18; //end hour
$min = "";
$sec = "";
$month = 7; //month will have to be changed monthly
$day = 6; //day will have to be changed daily
$year = 2002; //will have to be changed yearly$start=(mktime($shour,$min,$sec,$month,$day,$year));
$finish=(mktime($ehour,$min,$sec,$month,$day,$year));
$date = time();
if ($start <= $date && $finish >= $date) {
echo ("Broadcasting right now!<br />");
}else {
echo ("No broadcasting at the moment, sorry <br />");
}
?>
Im going to try and get this cleaned up to work better we will see.
<?
$date = getdate();
$shour = 18; //start hour
$ehour = 19; //end hour
$min = "";
$sec = "";
$month = $date["mon"];
$day = $date["wday"];
$year = $date["year"]; $start=(mktime($shour,$min,$sec,$month,$day,$year));
$finish=(mktime($ehour,$min,$sec,$month,$day,$year));
$date = time();
if ($start <= $date && $finish >= $date) {
echo ("Broadcasting right now!<br />");
}else {
echo ("No broadcasting at the moment, sorry <br />");
}
?>
thank you knowles, but whatever time n date i put on, it keeps me saying: not broadcasting at the moment.
anyway, as per my request this is supposed to work on server time, isn't it?
<added>
The issue seems to be the wday... when I changed to mday it started working
<?
$date = getdate();
$shour = 04; //start hour
$ehour = 05; //end hour
$min = "";
$sec = "";
$month = $date['mon'];
$day = $date['mday'];
$year = $date['year']; $start=(mktime($shour,$min,$sec,$month,$day,$year));
$finish=(mktime($ehour,$min,$sec,$month,$day,$year));
$date = time();
if ($start <= $date && $finish >= $date) {
echo ("Broadcasting right now!<br />");
}else {
echo ("No broadcasting at the moment, sorry <br />");
}
?>
thank you in advance for yr precious help.
rogie
<?
$shour = 17; //start hour
$ehour = 18; //end hour
$min = "";
$sec = "";
$month = 7; //month will have to be changed monthly
$day = 6; //day will have to be changed daily
$year = 2002; //will have to be changed yearly $start=(mktime($shour,$min,$sec,$month,$day,$year));
$finish=(mktime($ehour,$min,$sec,$month,$day,$year));
$date = time();
if ($start <= $date && $finish >= $date) {
echo ("<a href="radio.asf" onclick="return controllaData();">stream</a> <br />");
}else {
echo ("No broadcasting at the moment, sorry <br />");
}
?>
p.s. do you like house music? if so send me yr address on pm and i will send you a mix cd of soulful and deep house.