Home > Article > Backend Development > Alarm clock program written in php_PHP tutorial
php
//Alarm clock program
error_reporting(7);
ob_start();
if (!isset($i)) {
$msg= 'The current time is: '. date('h:i:s') ."
Go to bed quickly";
$t=time();
refresh($msg,"funny.php?i=1&t1=$t" ,5);
}elseif ($i==1){
$msg= 'The current time is: '. date('h:i:s');
$t2=time();
$t3=$t2-$t1 ;
$msg.="
You slept for $t3 seconds, it’s time to get up" ;
refresh($msg,'funny.php?i=2' );
}elseif ($i==2) {
//
print <<
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
align="baseline" border="0" standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&"
name="MediaPlayer" showcontrols="1" showpositioncontrols="0"
showaudiocontrols="1" showtracker="1" showdisplay="0"
showstatusbar="1"
autosize="0"
showgotobar="0" showcaptioning="0" autostart="1" autorewind="0"
animationatstart="0" transparentatstart="0" allowscan="1"
enablecontextmenu="1" clicktoplay="0"
defaultframe="datawindow" invokeurls="0">
EOT2;
}
function refresh($msg='',$url,$time='3'){
echo $msg."
";
echo "";
}
?>