Skip to main content

Posts

Showing posts from September, 2021

How to create quiz timer (Left time) in PHP?

Create quiz timer in PHP.   <!DOCTYPE html> <html lang="en"> <body> <center> <div class="time" id="navbar">Time left :<span id="timer"></span></div> <button class="button" id="mybut" onclick="myFunction()">START QUIZ</button> </center> <div id="myDIV" style="padding: 10px 30px;"> <form action="result.php" method="post" id="form">  </form> </div> <script> function myFunction() { var x = document.getElementById("myDIV");     var b = document.getElementById("mybut");     var x = document.getElementById("myDIV"); if (x.style.display === "none") {  b.style.visibility = 'hidden'; x.style.display = "block"; startTimer(); } } window.onload = function() {   document.getElementById('myDIV').style.display

How to create event time(Timmer) in PHP and Javascript?

Create event time(Timmer) in PHP and Javascript. <?php  /* date_default_timezone_set('Asia/Calcutta'); $timestamp = time(); */ //set hours according to the India time $date = '2021-09-28'; $hour = '13'; $minutes = '14'; $seconds = '0'; ?> <div id="timer"></div> <script> //task: get timer details from the previous section and assign them to variables.  //tip, these are associative arrays accessed as $myArray['data']  const countDownDate = <?php   echo strtotime("$date $hour:$minutes:$seconds" ) ?> * 1000; let timeNow = <?php print(time()) ?> * 1000; // Every second, the countdown will be updated. let i = setInterval(function() {  timeNow = timeNow + 1000; // Calculate the time between now and the end of the countdown.   let dist = countDownDate - timeNow; // Calculate the number of days, hours, minutes, and seconds in days, hours, minutes, and seconds. let numOfDays = Math.floor(dist

How to create quiz timer or time countdown in PHP and Javascript?

Create quiz timer or time countdown in PHP and Javascript.  <!DOCTYPE html> <html lang="en"> <body> <center> <div class="time" id="navbar">Time left :<span id="timer"></span></div> <button class="button" id="mybut" onclick="myFunction()">START QUIZ</button> </center> <div id="myDIV" style="padding: 10px 30px;"> <form action="result.php" method="post" id="form">  </form> </div> <script> function myFunction() { var x = document.getElementById("myDIV");     var b = document.getElementById("mybut");     var x = document.getElementById("myDIV"); if (x.style.display === "none") {  b.style.visibility = 'hidden'; x.style.display = "block"; startTimer(); } } window.onload = function() {   document.getElementByI

How to play youtube video on website with youtube link in PHP?

YouTube video on website with youtube link in PHP. <?php $topic_youtube_link = 'https://www.youtube.com/embed/vLFi-ODflLI'; $ytarray=explode("/", $topic_youtube_link); $ytendstring=end($ytarray); $ytendarray=explode("?v=", $ytendstring); $ytendstring=end($ytendarray); $ytendarray=explode("&", $ytendstring); $ytcode=$ytendarray[0]; ?> <ifr ame class="play-youtube" src="https://www.youtube.com/embed/<?php echo $ytcode; ?>"  title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <?php

How to add custom meta value in edit order page in Woo-commerce in Wordpress?

Add custom meta value in edit order page in Woo-commerce in Wordpress?  //===============add meta data on edit order page ========================= /**  * @param $item_id  * @param $item  * @param $product   Product  */ function wpcodekit_order_meta_customized_display( $item_id, $item, $product ) { global $woocommerce, $post;     /*     *  The default key to "$all_meta_data" can be: _qty,_tax_class,_line_tax,_line_tax_data,_variation_id,_product_id,_line_subtotal, _line_total,_line_subtotal_tax     */     $all_meta_data = get_metadata( 'order_item', $item_id, "", "" );   //print_r($product); echo $product->get_id(); echo $order_id = $post->ID; /*  $order = new WC_Order($post->ID); //to escape # from order id  echo $order_id = trim(str_replace('#', '', $order->get_order_number())); */     ?>     <div class="order_data_column" style="width: 50%; padding: 0 5px;">         <h4>&

How to upload file in selected folder in PHP in Wordpress?

Upload file in selected folder in PHP in Wordpress.     <?php    //echo $folder =  get_stylesheet_directory_uri();   // echo $_SERVER["DOCUMENT_ROOT"];  extract($_POST);  global $wpdb;  if(isset($_POST['submit'])){   $filename = $_FILES["file"]["name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $encrypt_file= md5(str_replace(" ", "_", $filename).date("Y-m-d-h-i-s")); $realpath = $encrypt_file.'.'.$ext;    $tempname = $_FILES["file"]["tmp_name"];    echo $folder =  $_SERVER["DOCUMENT_ROOT"]."/raising/wp-content/themes/twentytwenty-child/img/".$realpath;    //echo $folder =  get_stylesheet_directory_uri()."/img/".$filename;    move_uploaded_file($tempname,$folder);        } if(!empty($folder)){ ?> <img src="<?php echo get_stylesheet_directory_uri()."/img/".$realpath; ?>" width="400" height="400&qu