Jump to content

WAMFT1

Members
  • Content Count

    72
  • Joined

  • Last visited

Community Reputation

0 Neutral

About WAMFT1

  • Rank
    Regular Member

Profile Information

  • Gender
    Male
  1. I really have no idea what I am do with this, any change I make to the countdown it just stops working altogether. I have no IT background other than what is self taught. I can't make sense of this to work it out properly.
  2. I know very little other than the basics. That is why I am asking for help. I don't know how to incorporate the countdown timer script into the code so that it stops when it is hidden.
  3. I have made some changed and managed to get the video to stop on visibility change but I can't figure out what to do with the timer script. I need that to stop too. Can I get some help please. This is doing my head in. <? //PD Day Specifications $PresTitle="Video Presenation"; // Name of Presentation $Video="../pdpresentations/202005/202005-TFLG-10.IressXplanPresentation.mp4"; // URL of video file $Time="1800"; // video lenght in seconds $CPDCode="Insert Code Here" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Virtual Professional Development Day</title> <link href="2020.css" rel="stylesheet" type="text/css" /> </head> <body class="standard_center_red"> <p class="heading">PRESENTATION: <span class="Text_Heading_Black1"><?php echo $PresTitle?></span></p> <p class="heading">CPD CODE: <span style="font-size:16px; font-weight:bold; color:#F00; font-family:Arial, Helvetica, sans-serif" id="countdown"></span> <Script> var upgradeTime = <?php echo $Time?>; var seconds = upgradeTime; function timer() { var days = Math.floor(seconds/24/60/60); var hoursLeft = Math.floor((seconds) - (days*86400)); var hours = Math.floor(hoursLeft/3600); var minutesLeft = Math.floor((hoursLeft) - (hours*3600)); var minutes = Math.floor(minutesLeft/60); var remainingSeconds = seconds % 60; function pad(n) { return (n < 10 ? '0' + n : n); } document.getElementById('countdown').innerHTML = 'Available in ' + pad(hours) + ':' + pad(minutes) + ':' + pad(remainingSeconds); if (seconds == 0) { clearInterval(countdownTimer); document.getElementById('countdown').innerHTML = '<?php echo $CPDCode?>'; } else { seconds--; } } var countdownTimer = setInterval('timer()', 1000); </script> </p> <strong>Remember to record CPD Claim code above before closing this page</strong><br/> <div class="standard_center">&nbsp; <main> <video id="videoElement" autoplay="autoplay" height="600px" controls="controls" oncontextmenu="return false;" disablepictureinpicture controlsList="nofullscreen nodownload"> <source src="<?php echo $Video?>" /> </div> <script> (function() { 'use strict'; // Set the name of the "hidden" property and the change event for visibility var hidden, visibilityChange; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; } else if (typeof document.mozHidden !== "undefined") { // Firefox up to v17 hidden = "mozHidden"; visibilityChange = "mozvisibilitychange"; } else if (typeof document.webkitHidden !== "undefined") { // Chrome up to v32, Android up to v4.4, Blackberry up to v10 hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; } var videoElement = document.getElementById("videoElement"); // If the page is hidden, pause the video; // if the page is shown, play the video function handleVisibilityChange() { if (document[hidden]) { videoElement.pause(); } else { videoElement.play(); } } // Warn if the browser doesn't support addEventListener or the Page Visibility API if (typeof document.addEventListener === "undefined" || typeof document[hidden] === "undefined") { alert("This video requires a modern browser that supports the Page Visibility API. Please try Chrome, Edge or Internet Explorer"); } else { // Handle page visibility change document.addEventListener(visibilityChange, handleVisibilityChange, false); // When the video pauses and plays, change the title. videoElement.addEventListener("pause", function(){ document.title = 'PAUSED | Virtual Professional Development Day'; }, false); videoElement.addEventListener("play", function(){ document.title = 'Virtual Professional Development Day' }, false); } })(); </script> </body> </html>
  4. I know that I can't stop the bathroom break but if they were to open a second tab or move to another program or just click away from the browser that the counter and video stops.
  5. Hi All We have a group of pages containing a video and countdown clock to provide a code when video is viewed. I am trying to work out how to make it so that when the webpage is not in focus that the countdown and video playback stops and then resumes when back in focus. I hope this makes sense. Below is the page in its entirety but now sure how to achieve the onfocus mechanism. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Virtual Professional Development Day</title> <link href="../../../../2020.css" rel="stylesheet" type="text/css" /> </head> <body> <p class="heading">PRESENTATION: <span class="Text_Heading_Black1">Economic Update</span></p> <?php if (time() > strtotime("06/21/2021 11:59PM"))//MM-DD-YYYY { echo'<div> <p style="font-size:16px; font-weight:bold; color:#F00; font-family:Arial, Helvetica, sans-serif";"> <strong>SORRY! </strong>This presentation is no longer available.<br/>The CPD Claim period for the Virtual Professional Development Day has Finished.<br/> Presentations will be available on the Portal from Monday 22nd June. <br/>No further CPD will be issued.</p></div>'; }else{ echo'<p class="heading">CPD CODE: <span style="font-size:16px; font-weight:bold; color:#F00; font-family:Arial, Helvetica, sans-serif" id="countdown"></span> <script> var upgradeTime = 1705; var seconds = upgradeTime; function timer() { var days = Math.floor(seconds/24/60/60); var hoursLeft = Math.floor((seconds) - (days*86400)); var hours = Math.floor(hoursLeft/3600); var minutesLeft = Math.floor((hoursLeft) - (hours*3600)); var minutes = Math.floor(minutesLeft/60); var remainingSeconds = seconds % 60; function pad(n) { return (n < 10 ? "0" + n : n); } document.getElementById("countdown").innerHTML = "Available in " + pad(hours) + ":" + pad(minutes) + ":" + pad(remainingSeconds); if (seconds == 0) { clearInterval(countdownTimer); document.getElementById("countdown").innerHTML = "CPG5ECN"; } else { seconds--; } } var countdownTimer = setInterval("timer()", 1000); </script></p> <div class="standard_center"><span class="standard_center_red">Please Ensure you record the CPD Claim code before leaving this page</span><br/> <video height="600px" autoplay="autoplay" controls="controls" oncontextmenu="return false;" disablepictureinpicture controlsList="nofullscreen nodownload"> <source src="../docs/ext/pdpresentations/202005/202005-03.EconomicUpdate.mp4" type="video/mp4" /></video></div> ';}?> </body> </html>
  6. As I am VERY new to PDO, can someone help me in converting the below 2 codes so that I can setup the testing site knowing at least this part works. Below is the old SQL that I need to convert but don't have to foggiest on where to start. If I can get some help with this I can slowly work through the rest of my site with a bit more ease. LOGIN CODE: <?php if($_POST['submit']){ $Username = protect($_POST['Username']); $Password = protect(sha1($_POST['Password'])); if(!$Username || !$Password){ echo "<center>Please enter your <b>Username</b> and <b>Password</b>!</center>"; }else{ $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."'"); $num = mysql_num_rows($res); if($num == 0){ echo "<center>The <b>Username</b> or <b>Password</b> you supplied is incorrect!</center>"; }else{ $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."' AND Password = '".$Password."'"); $num = mysql_num_rows($res); if($num == 0){ echo "<center>The <b>Password</b> you supplied is incorrect!</center>"; }else{ $row = mysql_fetch_assoc($res); if($row['Active'] != 1){ echo "<center>Your login has been <b>deactivated</b>, Please contact your Manager for assistance.</center>"; }else{ header('Location: secure.php'); $time = date('U')+7200; //2 Hours mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); $_SESSION['uid'] = $row['id']; }}}}} ?> ACCESS GRANTED (Each Page): <?php if(strcmp($_SESSION['uid'],"") == 0){ printf("<script>location.href='index.php'</script>"); }else{ $time = date('U')+7200; //2 Hours $update = mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); } ?>
  7. Thanks mac_gyver. I will do some quick research on how to use PDO and try and update what I have.
  8. I have to start work on upgrading my work site and wonder whether to go SQLI or PDO? I don't know either so which would be easier to learn? I may need some help to get some things working properly. Any tips or tricks would be appreciated.
  9. Ignore my last, I have managed to work it out. Finally.
  10. I managed to get the DateDiff working, now my Inner Join part doesn;t work. Wish I knew more about coding. Can someone please help? I can't see what is wrong. ("SELECT adviser, status, complainant, complaint_id, date_received, settlement_date, DATEDIFF(COALESCE(settlement_date, CURDATE()), date_received) as interval_days FROM `compliance_complaints` INNER JOIN eusers ON eusers.id = compliance_complaints.adviser WHERE status='Open' order by complaint_id DESC;");
  11. I don't understand how the above works the 'if' query with date. I've tried so much and I am now just getting frustrated. Going around in circles. What I have is as below, I don't know how is should be. and yes, i know i am using obsolete code but it is a temporary fix. <?php include("../edb.php"); $result=mysql_query("SELECT * FROM `compliance_complaints` INNER JOIN eusers ON eusers.id = compliance_complaints.adviser WHERE status='Closed' order by complaint_id DESC "); if($test['settlement_date']=="0000-00-00"){ $date1 = new DateTime($date_received); $date2 = new DateTime("now"); $interval = $date1->diff($date2); } else { $date1 = new DateTime($date_received); $date2 = new DateTime($settlement_date); $interval = $date1->diff($date2); } while($test = mysql_fetch_array($result)) { $complaint_id = $test['complaint_id']; echo"<tr>"; echo"<td class='standard_left'>".$test['complaint_id']."</td>"; echo"<td class='standard_left'>".$test['status']."</td>"; echo"<td class='standard_left'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='standard_left'><a href ='complaint_view.php?complaint_id=$complaint_id'>".$test['complainant']."</td>"; echo"<td class='standard_center'>".$test['date_received']."</td>"; echo"<td class='standard_center'>".$test['settlement_date']."</td>"; echo"<td class='standard_center'>".$test['interval']."</td>"; echo "</tr>"; } mysql_close($conn); ?>
  12. Hi Everyone I have an older coded side that I am looking at for a friend, I need to add in a date diff colum into their existing index page. I can add using the following code onto the indivudually record page can't get it to work on the index. Any help is appreciated. Code on Individual page which works::: <HEAD> <? if($test['settlement_date']=="0000-00-00"){ $date1 = new DateTime($date_received); $date2 = new DateTime("now"); $interval = $date1->diff($date2); } else { $date1 = new DateTime($date_received); $date2 = new DateTime($settlement_date); $interval = $date1->diff($date2); } ?> </HEAD> <Body> <?php echo "".$interval->days."";?> </BODY> I was trying to add something similar but as it is a list I can't work out what I need to do. INDEX::: while($test = mysql_fetch_array($result)) { $complaint_id = $test['complaint_id']; echo"<tr>"; echo"<td class='standard_left'>".$test['complaint_id']."</td>"; echo"<td class='standard_left'>".$test['status']."</td>"; echo"<td class='standard_left'>".$test['LastName'].", ".$test['FirstName']."</td>"; echo"<td class='standard_left'><a href ='complaint_view.php?complaint_id=$complaint_id'>".$test['complainant']."</td>"; echo"<td class='standard_center'>".$test['date_received']."</td>"; echo"<td class='standard_center'>".$test['settlement_date']."</td>"; echo"<td class='standard_center'>".$test['interval->days']."</td>"; echo "</tr>"; I know it is old redundent code but if I can get this one colum working I would be happy.
  13. Is it possible to format the menu items in the drop down box? Below is the code used at the moment. What I would like is to make Yes = Green, No = Red and N/A stay black. I tried using the class and style setting on the inline code but had no luck. Can anyone please shed some light on how I would go about this? <select name="ob_admin_quals" class="standard_left" id="ob_admin_quals"> <option value="Yes"<?php echo($ob_admin_quals == 'Yes') ? ' selected' : '';?>>Yes</option> <option value="No"<?php echo($ob_admin_quals == 'No') ? ' selected' : '';?>>No</option> <option value="N/A"<?php echo($ob_admin_quals == 'N/A') ? ' selected' : '';?>>N/A</option> </select>
  14. It looks like the issue is with the Mail::factory Fatal error: Class 'Mail' not found
  15. Crashes => When I hit submit, the update query part works fine, it seems to stop working around the sending the email part. I just get a blank screen. I don't get the email or the echo "Saved" etc. There seems to be an issue in the actual emailing part which I cannot work out.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.