jakebur01 Posted August 12, 2008 Share Posted August 12, 2008 I have this script that is supposed to check to see if it is meetingtime if not it is supposed to countdown then start the meeting. $meetingstarttime and $meetingendtime are unix time stamps. <?php //$meetingstarttime=1218973304; //just a test - delete this line for using database values $te = date("Y-m-d H:i:s", $meetingstarttime); $secondsDiff = $meetingstarttime - time(); if ( time() > $meetingendtime) { echo "Chat closed"; }else if ( time() <= $meetingstarttime) { ?> <div id="content"> <table class="countTable"> <tr><th colspan="2" id="remain"><?=$te;?></th> <script type="text/javascript"> v=new Date(); var remain=document.getElementById('remain'); function tremain(){ n=new Date(); s=<?=$secondsDiff;?>-Math.round((n.getTime()-v.getTime())/1000.); m=0; h=0; if(s<0){ remain.innerHTML='Chat Time ';document.location=document.location; }else{ if(s>59){ m=Math.floor(s/60); s=s-m*60 } if(m>59){ h=Math.floor(m/60); m=m-h*60 } if(s<10){ s="0"+s } if(m<10){ m="0"+m } remain.innerHTML=" "+h+"h "+m+"m "+s+'s';document.title=h+':'+m+':'+s+' .'; window.setTimeout("tremain();",999); } } tremain(); </script> </tr> </table> </div> <?php } else { $chat->printChat(); } ?> Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/ Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 It works perfect during the meeting time. And after meeting time, it displays "chat closed." I just can't get the countdown to work for before the meeting. `Jake Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614875 Share on other sites More sharing options...
revraz Posted August 12, 2008 Share Posted August 12, 2008 The countdown looks like its in Javascript, so you may want to ask there instead. Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614876 Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 yea but i'm getting a blank, does my php look ok? Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614878 Share on other sites More sharing options...
Psycho Posted August 12, 2008 Share Posted August 12, 2008 This would be a javascript problem not a PHP problem. Please post the generated HTML for a page that should be displaying the countdown. Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614879 Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 <div id="content"> <table class="countTable"> <tr><th colspan="2" id="remain"><?=$te;?></th> <script type="text/javascript"> v=new Date(); var remain=document.getElementById('remain'); function tremain(){ n=new Date(); s=<?=$secondsDiff;?>-Math.round((n.getTime()-v.getTime())/1000.); m=0; h=0; if(s<0){ remain.innerHTML='Chat Time ';document.location=document.location; }else{ if(s>59){ m=Math.floor(s/60); s=s-m*60 } if(m>59){ h=Math.floor(m/60); m=m-h*60 } if(s<10){ s="0"+s } if(m<10){ m="0"+m } remain.innerHTML=" "+h+"h "+m+"m "+s+'s';document.title=h+':'+m+':'+s+' .'; window.setTimeout("tremain();",999); } } tremain(); </script> </tr> </table> </div> Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614887 Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 Is my php not processing in the javascript? Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614892 Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 That was it. <?php echo $te;?> Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614900 Share on other sites More sharing options...
DarkWater Posted August 12, 2008 Share Posted August 12, 2008 Try not using short tags. Short tags are evil. Wait. Just saw your post because it said "someone posted while you were posting" or whatever. Don't use short tags and life is better. Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614901 Share on other sites More sharing options...
Jabop Posted August 12, 2008 Share Posted August 12, 2008 Try not using short tags. Short tags are evil. Don't use short tags and life is better. /facepalm Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614905 Share on other sites More sharing options...
DarkWater Posted August 12, 2008 Share Posted August 12, 2008 Try not using short tags. Short tags are evil. Don't use short tags and life is better. /facepalm D'oh. Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614911 Share on other sites More sharing options...
efficacious Posted August 12, 2008 Share Posted August 12, 2008 Try not using short tags. Short tags are evil. Don't use short tags and life is better. /facepalm D'oh. lol Link to comment https://forums.phpfreaks.com/topic/119361-solved-cant-get-countdown-to-work/#findComment-614970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.