  <?php  
   $id= $user_row['course'];
   $msg = "";
   $query= mysqli_query($conn,"SELECT * FROM subject_soes 
   INNER JOIN module_soes 
          ON module_soes.course_code = subject_soes.course_code WHERE subject_soes.course_code='$id'")or die(mysqli_error());
    $row = mysqli_fetch_array($query);
  ?>
  <div class="container">
          <div class="page-inner">
            <div  class="d-flex align-items-left align-items-md-center flex-column flex-md-row pt-2 pb-4"  >
              <div class="card-header">
                <h3 class="fw-bold mb-3">Cybercode</h3> 
              </div> 
            </div>
            <div class="row">
              <div class="card">
                <div class="card-header">
                   <?php
                        // Set the timezone to Dar es Salaam, Tanzania
                        date_default_timezone_set('Africa/Dar_es_Salaam');
                    
                        function createUserGreeting($username) {
                            // Get current hour (24-hour format)
                            $hour = date('H');
                            $icon = "";
                    
                            // Check the time of day
                            if ($hour >= 5 && $hour < 10) {
                                $greeting = "Good Morning";
                                $icon = "☀️"; // Sun icon
                            } else if ($hour >= 12 && $hour < 16) {
                                $greeting = "Good Afternoon";
                                $icon = "🌤️"; // Sun behind cloud icon
                            } else {
                                $greeting = "Good Evening";
                                $icon = "🌙"; // Moon icon
                            }
                    
                            // Return the greeting message
                            return "<p class='card-title text-center' style='font-size:18px;'>
                                        $icon $greeting, <strong>$username</strong>  
                                        <br>Welcome to <strong>Cybercode</strong> — Your Cybersecurity Journey starts here!
                                    </p>";
                        }
                    
                        // Example: Creating a user
                        $username = $user_row['student_name'];
                        // echo createUserGreeting($username);
                    ?>
                  <p class="card-title text-center"> <b><?php echo createUserGreeting($username);  ?></b></p> 
                 <br>
                  <?php  
                  if(!empty($id)){ ?> 
                  <div class="col-md-12">  
                    <div class="alert bg-info-gradient " style="word-spacing: 5px; color: white;">
                      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button><i class="fas fa-bullhorn"></i>  | Proceed to <?php echo $row['subject_name']; ?> <a href="admin.php?page=dashboard&Id_2=<?php echo $user_row['course']; ?>" class="btn btn-info btn-rounded btn-sm" > view the progress...</a  > 
                      </div>
                  </div>
                </div>
               <?php  } ?>
              <div class="card-body">
               <div class="row">
                   <?php  
                    $course1=$user_row['student_id'];
                    $school_query = mysqli_query($conn,"SELECT * FROM  subject_soes   
                      INNER JOIN student_soes 
                      ON subject_soes.user_type = student_soes.user_type WHERE student_soes.student_id='$course1';");
                    while($row1 = mysqli_fetch_array($school_query)){  
                 ?>
                 <div class="col-md-4">
                 <div class="card card-post card-round">
                  <img class="card-img-top" src="<?php echo $row1['course_image']; ?>"  alt="Card image cap"/>
                  <div class="card-body">
                    <div class="d-flex">
                      <h4 class="card-title text-center"> 
                      <a href="#"><?php echo $row1['subject_name']; ?></a>
                    </h4>
                    </div>
                    <div class="separator-solid"></div>  
                    <p class="text-justify"> <?php echo $row1['description']; ?>  </p>
                      
                    <a href="admin.php?page=dashboard&Id_2=<?php echo $row1['course_code']; ?>" class="btn btn-primary btn-rounded btn-sm"  disabled="disabled">Start the course</a  >
                      <!--<button class="btn btn-primary btn-rounded btn-sm" disabled="disabled">-->
                      <!-- Take a course-->
                      <!--</button> --> 
                  </div>
                </div>
                </div>
               <?php } ?> 
              </div> 
            </div>
            </div>
            </div> 
          </div>
        </div>

        