PK

ADDRLIN : /home/questend/www/subdomain/coforge.jiffyfilms.com/
FLL :
Current File : /home/questend/www/subdomain/coforge.jiffyfilms.com/webcast.php

<?php
   ob_start();
   //error_reporting(E_ALL ^ E_NOTICE);
   @session_start();
   ini_set('allow_url_include',1);    
   date_default_timezone_set("Asia/Kolkata");
   set_time_limit(600);
   ini_set('max_execution_time',600);
   require_once 'admin/includes/settings/PDODB.php';
   include 'admin/includes/modules/functions.php';
   
   $function = new FUNCTIONS();
   
   if(empty($_SESSION['userId'])){
    header("Location: index.php");
    exit();
   }
   
   $user = $function->getUsers($_SESSION['userId'],NULL,NULL,1);
?>
<!DOCTYPE html>
<html lang="en" >
   <head>
      <meta charset="UTF-8">
      <title>Coforge</title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <!-- <meta http-equiv="refresh" content="50"> -->
      <link rel='stylesheet' href='css/bootstrap.min.css'>
      <link rel='stylesheet' href='css/style.css'>
      <link href="images/favicon.png" rel="shortcut icon" type="image/png">
      <style type="text/css">
         body { background-color: #082340;}
         .d-none { display:none; }
         .error {color: red;}
         .navbar{ 
            background: rgb(8 34 64); 
            box-shadow: rgba(33, 35, 38, 0.1) 0px 10px 10px -10px;
         }
         ul.join-social {
         margin: 0;
         padding: 0;
         } 
         ul {
         list-style: none;
         width: auto;
         display: inline-block;
         vertical-align: middle;}
         .join-social li {
         display: inline-block;
         margin-left: 7px;
         vertical-align: middle;
         }
         .frame{
         padding: 3px 15px;
         background: #f15b40;    
         border-radius: 2px;
         text-align: left;
         color: #fff;
         letter-spacing: 1.5px;
         font-size: 16px;
         font-weight: bold;
         line-height: 24px;
         }
         .comment-form{
         background: #e7e7e7;
         padding:1%;
         margin-bottom: 1%;
         }
         .poll-question{
         background: #e7e7e7;
         padding:1%;
         }
         .quiz-question{
         background: #e7e7e7;
         padding:1%;
         }
         .feedbackform{
         background: #e7e7e7;
         padding:2%;
         }
         .form-control {
         border-color: #e7e7e7;
         }
         
         .form-check-input {
         }
         input:checked {
         background: #a69837;
         }
         label{
         }
         .nav-tabs{
         background: #f15b40;
         color: #ffffff;
         }
         .nav-link{
         color: #ffffff;
         }
         #feedback-form-wrapper #floating-icon > button {
         position: fixed;
         right: 0;
         top: 50%;
         transform: rotate(-90deg) translate(50%, -50%);
         transform-origin: right;
         }
         #feedback-form-wrapper .rating-input-wrapper input[type="radio"] {
         display: none;
         }
         #feedback-form-wrapper .rating-input-wrapper input[type="radio"] ~ span {
         cursor: pointer;
         }
         #feedback-form-wrapper .rating-input-wrapper input[type="radio"]:checked ~ span {
         background-color: #4261dc;
         color: #fff;
         }
         #feedback-form-wrapper .rating-labels > label{
         font-size: 14px;
         color: #777;
         }    
         /* Star Rating Styles */
         .star-rating {
           direction: rtl;
           display: inline-flex;
           font-size: 2rem;
           cursor: pointer;
         }
         .star-rating input {
           display: none;
         }
         .star-rating label {
           color: #ccc;
           transition: color 0.2s;
         }
         .star-rating input:checked ~ label,
         .star-rating label:hover,
         .star-rating label:hover ~ label {
           color: gold;
         }     
      </style>
      
      <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-RDPQG3KTK6"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-RDPQG3KTK6');
    </script>
   </head>
   <body>      
      <nav class="navbar">
         <div class="container-fluid">
            <a class="navbar-brand" href="#" target="_blank">
               <img src="images/logo.png" alt="" width="150" class="img-fluid">
            </a>
            <div class="content"> 
               <ul class="join-social">
                  <li><a class="logout-btn" href="logout.php">Logout:</a></li>
               </ul>       
            </div>
         </div>
      </nav>
      <div class="container-fluid py-5">
         <div class="row justify-content-center">
            <div class="col-md-8">               
               <div class="ratio ratio-16x9 mb-5">
                  <iframe src="https://player.castr.com/vod/vaDlM5F81dHwuaTu" title="Multistreaming with Restream.io" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
               </div>
            </div>
            <div class="col-md-4">
               
               <ul class="nav nav-tabs" id="myTab" role="tablist">
                  <li class="nav-item active" role="presentation">
                     <button class="nav-link" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="false">Ask Question</button>
                  </li>                  
               </ul>
               <div class="tab-content" id="myTabContent">
                  <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                     <!-- <div class="frame">ASK QUESTIONS</div>-->
                     <form class="comment-form" id="askQstndForm" method="POST" action="">
                        <div class="mb-3">
                           <div class="form-floating">
                              <textarea class="form-control" placeholder="Leave a comment here" id="question" name="question" style="height: 130px"></textarea>
                              <label for="question">Type your comments</label>
                           </div>
                        </div>
                        
                        <div id="message"></div>
                        <center>
                           <!-- <button type="submit" id="askQuestionBtn" name="askQuestionBtn" onclick="askQForm();" class="btn btn-lg">Submit</button> -->
                           <input class="btn btn-lg" type="button" onclick="askQForm();" name="save_contact" value="Submit" />
                        </center>
                     </form>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <!-- partial -->
      <script type='text/javascript' src='//code.jquery.com/jquery-1.8.3.js'></script> 
      <script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
      <link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
      <script type='text/javascript' src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.js"></script> 
      <script type='text/javascript' src="//jqueryvalidation.org/files/dist/additional-methods.min.js"></script> 
      <script src='js/bootstrap.bundle.min.js'></script>
      
      <!-- ajax start -->
      <script type="text/javascript">
        $(document).ready(function() {
           function askQForm() {
              var question = $('textarea[name=question]').val().trim();

              if (question !== '') {
                 var formData = {question: question};
                 $('#message').html('<span style="color: red">Processing form. . . please wait. . .</span>');

                 $.ajax({
                    url: "post.php",
                    type: 'POST',
                    data: formData,
                    success: function(response) {
                       try {
                          var res = JSON.parse(response);
                          if (res.success == true) {
                             document.getElementById("askQstndForm").reset();
                             $('#message').html('<span id="successmsg" style="color: green">Submitted successfully</span>');
                             $("#successmsg").delay(5000).fadeOut(); // Will hide after 5 seconds
                          } else {
                             $('#message').html('<span id="failmsg" style="color: red">Form not submitted. Some error in running the database query.</span>');
                             $("#failmsg").delay(5000).fadeOut(); // Will hide after 5 seconds
                          }
                       } catch (e) {
                          $('#message').html('<span id="failmsg" style="color: red">Error processing response</span>');
                          $("#failmsg").delay(5000).fadeOut(); // Will hide after 5 seconds
                       }
                    },
                    error: function() {
                       $('#message').html('<span id="failmsg" style="color: red">Error submitting the form. Please try again later.</span>');
                       $("#failmsg").delay(5000).fadeOut(); // Will hide after 5 seconds
                    }
                 });
              } else {
                 $('#message').html('<span id="requiredmsg" style="color: red">Please type your feedback</span>');
                 $("#requiredmsg").delay(5000).fadeOut();
              }
           }
           window.askQForm = askQForm; // Ensure the function is available globally
        });
      </script>

      <!-- Feedback -->
      <script>
         $(document).ready(function() {
             // Fetch active session when the tab is shown
             $('#contact-tab').on('shown.bs.tab', function() {
                 fetchActiveSession();
             });

             // Also fetch when page loads if this tab is active
             if($('#contact-tab').hasClass('active')) {
                 fetchActiveSession();
             }
         });

         function fetchActiveSession() {
             $.ajax({
                 url: 'get_active_session.php',
                 type: 'GET',
                 dataType: 'json',
                 success: function(response) {
                     if(response.success) {
                         $('#current-session-name').text(response.event_name);
                         $('#event-name-input').val(response.event_name);
                         $('#session-info').show();
                         $('#no-session-info').hide();
                         $('#feedbackForm').show();
                     } else {
                         $('#session-info').hide();
                         $('#no-session-info').show();
                         $('#feedbackForm').hide();
                     }
                 },
                 error: function() {
                     $('#session-info').hide();
                     $('#no-session-info').text('Error fetching session information').show();
                     $('#feedbackForm').hide();
                 }
             });
         }

         function feedBForm() {
             var comment = $('textarea[name=comment]').val();
             var rating = $('input[name=rating]:checked').val();
             var event_name = $('#event-name-input').val();

             if(comment != '' && rating!= '') {
                 var formData = {
                     comment: comment, 
                     rating: rating,
                     event_name: event_name
                 };
                 
                 $('#feedbackmessage').html('<span style="color: red">Processing form. . . please wait. . .</span>');
                 
                 $.ajax({
                     url: "post.php", 
                     type: 'POST', 
                     data: formData, 
                     success: function(response) {
                         var res = JSON.parse(response);
                         if(res.success == true){
                             document.getElementById("feedbackForm").reset();
                             $('#feedbackmessage').html('<span id="successmsg" style="color: green">Your Feedback successfully submitted</span>');
                             $("#successmsg").delay(5000).fadeOut();
                         } else {
                             $('#feedbackmessage').html('<span id="failmsg" style="color: red">Form not submitted. Some error in running the database query.</span>');
                             $("#failmsg").delay(5000).fadeOut();
                         }
                     }
                 });
             }
             else {
                 $('#feedbackmessage').html('<span id="reuiredmsg" style="color: red">Please type your question</span>');
                 $("#reuiredmsg").delay(5000).fadeOut();
             }  
         }

         // Call loadPollQuestion every 10 seconds
         setInterval(fetchActiveSession, 2000);
      </script>

      <!-- Polling -->
      <script type="text/javascript">
          function pollQForm(event) {
             event.preventDefault();

             var q_id = $('input[name=q_id]').val();
             var polloption = $('input[name=polloption]:checked').val();

             if(q_id != '' && polloption!= '') {
                var formData = {q_id: q_id, polloption: polloption};
                $('#pollQmessage').html('<span style="color: red">Processing form. . . please wait. . .</span>');
                $.ajax({
                    url: "post.php", 
                    type: 'POST', 
                    data: formData, 
                    success: function(response) {
                       var res = JSON.parse(response);
                       if(res.success == true) {
                           $('#pollQmessage').html('<span id="successmsg" style="color: green">Your Feedback successfully submitted</span>');
                           $("#successmsg").delay(5000).fadeOut();

                           // Reload the poll question
                           loadPollQuestion();
                       } else {
                          $('#pollQmessage').html('<span id="failmsg" style="color: red">Form not submitted. Some error in running the database query.</span>');
                          $("#failmsg").delay(5000).fadeOut();
                       }
                    }
                });
             } else {
                $('#pollQmessage').html('<span id="reuiredmsg" style="color: red">Please select an option</span>');
                $("#reuiredmsg").delay(5000).fadeOut();
             }         
          }

         function loadPollQuestion() {
             $.ajax({
                 url: 'get_poll_question.php',
                 type: 'GET',
                 success: function(response) {
                     var res = JSON.parse(response);
                     if (res.success) {
                         $('#profile').html(res.html);
                     } else {
                         $('#profile').html('<form class="poll-question" style="min-height: 200px;"><h4 class="question"></h4></form>');
                     }
                 }
             });
         }
         // Call loadPollQuestion every 10 seconds
         setInterval(loadPollQuestion, 5000);
      </script>

      <!-- quiz -->
      <script>
      document.addEventListener('DOMContentLoaded', function() {
          // State management
          const quizState = {
              currentIndex: 0,
              totalQuestions: 0,
              currentQuestion: null,
              userAnswers: {},
              answeredIds: new Set(),
              isSubmitting: false,
              refreshTimer: null,
              lastUpdate: null
          };

          // DOM elements
          const elements = {
              container: document.getElementById('quiz-container'),
              submitBtn: document.getElementById('submit-quiz'),
              currentQ: document.getElementById('current-question'),
              totalQ: document.getElementById('total-questions'),
              results: document.getElementById('quiz-results'),
              restartContainer: document.getElementById('quiz-restart'),
              restartBtn: document.getElementById('restart-quiz'),
              navigation: document.querySelector('.quiz-navigation')
          };

          // Initialize quiz
          function initQuiz() {
              resetQuizState();
              showLoading();
              fetchQuestion(quizState.currentIndex);
              startRefreshCycle();
              
              // Ensure buttons are in correct initial state
              elements.submitBtn.classList.remove('d-none');
              elements.restartContainer.classList.add('d-none');
              elements.navigation.classList.remove('d-none');
          }

          function resetQuizState() {
              quizState.currentIndex = 0;
              quizState.currentQuestion = null;
              quizState.userAnswers = {};
              quizState.answeredIds = new Set();
              clearRefreshTimer();
          }

          // Refresh logic
          function startRefreshCycle() {
              clearRefreshTimer();
              
              const refreshInterval = quizState.currentQuestion ? 120000 : 20000;
              console.log(`Setting refresh for ${refreshInterval/1000} seconds`);
              
              quizState.refreshTimer = setTimeout(() => {
                  if (!quizState.isSubmitting) {
                      console.log('Auto-refreshing...');
                      showLoading();
                      fetchQuestion(quizState.currentIndex);
                  }
                  startRefreshCycle();
              }, refreshInterval);
          }

          function clearRefreshTimer() {
              if (quizState.refreshTimer) {
                  clearTimeout(quizState.refreshTimer);
                  quizState.refreshTimer = null;
              }
          }

          // UI functions
          function showLoading() {
              elements.container.innerHTML = `
                  <div class="text-center py-5 text-white">
                      <div class="spinner-border text-primary" role="status">
                          <span class="visually-hidden">Loading...</span>
                      </div>
                      <p>Loading quiz question...</p>
                  </div>
              `;
              elements.submitBtn.disabled = true;
          }

          function showError(message) {
              elements.container.innerHTML = `
                  <div class="alert alert-danger">
                      ${message}<br>
                      Will try again shortly...
                  </div>
              `;
          }

          // Data functions
          async function fetchQuestion(index) {
              try {
                  const response = await fetch(`get_quiz_question.php?question_id=${index}&t=${Date.now()}`);
                  
                  if (!response.ok) {
                      throw new Error(`Server returned ${response.status}`);
                  }
                  
                  const data = await response.json();
                  
                  if (!data.success) {
                      throw new Error(data.message || 'Invalid question data');
                  }
                  
                  // Skip if already answered
                  if (quizState.answeredIds.has(data.question.qid.toString())) {
                      moveToNextQuestion();
                      return;
                  }
                  
                  // Update state
                  quizState.currentQuestion = data.question;
                  quizState.totalQuestions = data.total;
                  quizState.lastUpdate = new Date();
                  
                  renderQuestion();
                  startRefreshCycle();
                  
              } catch (error) {
                  console.error('Fetch error:', error);
                  quizState.currentQuestion = null;
                  showError(error.message);
                  startRefreshCycle();
              }
          }

          function renderQuestion() {
              const q = quizState.currentQuestion;
              
              // Clear previous results when loading new question
              elements.results.innerHTML = '';
              
              elements.container.innerHTML = `
                  <form class="quiz-question">
                      <input type="hidden" name="question_id" value="${q.qid}">
                      <h4 class="mb-3">${q.question}</h4>
                      <div class="mb-3">
                          ${['ans1', 'ans2', 'ans3', 'ans4'].map((ans, i) => `
                          <div class="form-check">
                              <input class="form-check-input" type="radio" name="quizoption" 
                                     id="quizoption-${q.qid}-${i}" 
                                     value="${q[ans]}">
                              <label class="form-check-label" for="quizoption-${q.qid}-${i}">
                                  ${String.fromCharCode(65 + i)}. ${q[ans]}
                              </label>
                          </div>
                          `).join('')}
                      </div>
                  </form>
              `;
              
              // Restore selected answer if exists
              if (quizState.userAnswers[q.qid]) {
                  document.querySelector(`input[value="${quizState.userAnswers[q.qid]}"]`).checked = true;
              }
              
              updateCounter();
              elements.submitBtn.disabled = false;
              elements.submitBtn.classList.remove('d-none');
          }

          function updateCounter() {
              elements.currentQ.textContent = quizState.currentIndex + 1;
              elements.totalQ.textContent = quizState.totalQuestions;
          }

          // Question navigation
          function moveToNextQuestion() {
              // Clear results before moving to next question
              elements.results.innerHTML = '';
              
              quizState.currentIndex++;
              
              if (quizState.currentIndex >= quizState.totalQuestions) {
                  showEndScreen();
              } else {
                  fetchQuestion(quizState.currentIndex);
              }
          }

          // Answer submission
          async function submitAnswer() {
              const form = document.querySelector('.quiz-question');
              if (!form) return;
              
              const questionId = form.querySelector('input[name="question_id"]').value;
              const selectedOption = form.querySelector('input[name="quizoption"]:checked');
              
              if (!selectedOption) {
                  elements.results.innerHTML = `<div class="alert alert-warning">Please select an answer</div>`;
                  return;
              }
              
              quizState.isSubmitting = true;
              const userAnswer = selectedOption.value;
              
              // Update state
              quizState.userAnswers[questionId] = userAnswer;
              quizState.answeredIds.add(questionId);
              
              // UI feedback
              elements.submitBtn.disabled = true;
              elements.submitBtn.innerHTML = `<span class="spinner-border spinner-border-sm"></span> Submitting...`;
              
              try {
                  const response = await fetch('submit_quiz.php', {
                      method: 'POST',
                      headers: {'Content-Type': 'application/json'},
                      body: JSON.stringify({
                          question_id: questionId,
                          user_answer: userAnswer
                      })
                  });
                  
                  const data = await response.json();
                  
                  if (!data.success) {
                      throw new Error(data.message || 'Submission failed');
                  }
                  
                  showResult(data.is_correct, userAnswer, data.correct_answer);
                  
              } catch (error) {
                  console.error('Submission error:', error);
                  elements.results.innerHTML = `<div class="alert alert-danger">Error: ${error.message}</div>`;
                  quizState.answeredIds.delete(questionId); // Rollback
              } finally {
                  quizState.isSubmitting = false;
                  elements.submitBtn.innerHTML = `<i class="bi bi-check-circle"></i> Submit Answer`;
                  startRefreshCycle();
              }
          }

          function showResult(isCorrect, userAnswer, correctAnswer) {
              const q = quizState.currentQuestion;
              const options = [q.ans1, q.ans2, q.ans3, q.ans4];
              const isLastQuestion = quizState.currentIndex >= quizState.totalQuestions - 1;
              
              const userIndex = options.indexOf(userAnswer);
              const correctIndex = options.indexOf(correctAnswer);
              
              elements.results.innerHTML = `
                  <div class="alert ${isCorrect ? 'alert-success' : 'alert-danger'}">
                      <h4>${isCorrect ? 'Correct!' : 'Incorrect'}</h4>
                      <p>Your answer: ${String.fromCharCode(65 + userIndex)}. ${userAnswer}</p>
                      ${!isCorrect ? `<p>Correct answer: ${String.fromCharCode(65 + correctIndex)}. ${correctAnswer}</p>` : ''}
                      <div class="mt-3">
                          <button id="${isLastQuestion ? 'finish' : 'next'}-btn" class="btn btn-${isLastQuestion ? 'info' : 'primary'}">
                              ${isLastQuestion ? 'Finish Quiz' : 'Next Question <i class="bi bi-chevron-right"></i>'}
                          </button>
                      </div>
                  </div>
              `;
              
              // Hide submit button after answering
              elements.submitBtn.classList.add('d-none');
              
              document.getElementById(`${isLastQuestion ? 'finish' : 'next'}-btn`)
                  .addEventListener('click', function() {
                      if (isLastQuestion) {
                          showEndScreen();
                      } else {
                          // Clear results when next question is clicked
                          elements.results.innerHTML = '';
                          moveToNextQuestion();
                      }
                  });
          }

          function showEndScreen() {
              clearRefreshTimer();
              elements.container.innerHTML = `
                  <div class="alert alert-success text-center">
                      <h2><i class="bi bi-check-circle-fill"></i> Quiz Complete!</h2>
                      <p class="lead">You have answered all the questions.</p>
                  </div>
              `;
              elements.results.innerHTML = '';
              elements.navigation.classList.add('d-none');
              elements.restartContainer.classList.remove('d-none');
          }

          // Event listeners
          elements.submitBtn.addEventListener('click', submitAnswer);
          elements.restartBtn.addEventListener('click', initQuiz);

          // Start the quiz
          initQuiz();
      });
      </script>

      <!-- User point ajax -->
      <script>
         $(document).ready(function() {
             // Get the user ID (you need to set this value)
             const userId = <?php echo $_SESSION['userId'] ?? 0; ?>; // Adjust based on your auth system
             
             if (userId > 0) {
                 // Fetch points initially
                 fetchUserPoints(userId);
                 
                 // Optionally: Refresh points periodically (every 10 seconds)
                 setInterval(() => fetchUserPoints(userId), 10000);
             } else {
                 $('#userPoints').text('0');
             }
         });

         function fetchUserPoints(userId) {
             $.ajax({
                 url: 'get_points.php',
                 type: 'GET',
                 data: { userId: userId },
                 dataType: 'json',
                 success: function(response) {
                     if (response.success) {
                         $('#userPoints').text(response.points);
                     } else {
                         console.error('Error fetching points:', response.message);
                         $('#userPoints').text('Error');
                     }
                 },
                 error: function(xhr, status, error) {
                     console.error('AJAX error:', error);
                     $('#userPoints').text('Error');
                 }
             });
         }
      </script>
   </body>
</html>


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home