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(); } ?> Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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> Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
jakebur01 Posted August 12, 2008 Author Share Posted August 12, 2008 That was it. <?php echo $te;?> Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.