D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
Filename :
next.php
back
Copy
<?php include 'config.php'; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Countdown</title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <style> .countdown { font-size: 35px; color: #e74c3c; margin-top: 20px; text-align: center; font-weight: 900; } .event-details { display: flex; justify-content: center; margin-top: 2px; } .event-name { font-size: 25px; color: #0B2154; text-align: center; font-weight: 900; } .event-date, .event-time { margin-right: 20px; background-color: rgba(234, 253, 162, 0.3); border: #c5c5c5 solid 1px; padding: 5px; } </style> </head> <body> <?php date_default_timezone_set('Asia/Karachi'); // Fetch event data from the database $sql = "SELECT * FROM events ORDER BY id DESC LIMIT 1"; $result = $conn->query($sql); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $event_name = $row['event_name']; $event_nameurdu = $row['event_nameurdu']; $event_date = $row['event_date']; $event_time = $row['event_time']; $location = $row['location']; $countdown = $row['countdown']; // Calculate the end time of the event $end_time = strtotime("$event_date $event_time"); $current_time = time(); $remaining_time = $end_time - $current_time; // Display event details echo "<div class='event-name'><center>$event_name</center></div>"; echo "<center><p>$event_nameurdu</p></center>"; echo "<div class='event-details'>"; echo "<p class='event-date'>Date: $event_date</p>"; echo "<p class='event-time'>Time: " . date("g:i A", strtotime($event_time)) . "</p>"; echo "</div>"; if ($remaining_time > 0) { echo "<p class='countdown' id='countdown'></p>"; // JavaScript countdown timer echo "<script> var countdown = $remaining_time; var countdownDisplay = document.getElementById('countdown'); function updateCountdown() { var days = Math.floor(countdown / (24 * 60 * 60)); var hours = Math.floor((countdown % (24 * 60 * 60)) / (60 * 60)); var minutes = Math.floor((countdown % (60 * 60)) / 60); var seconds = countdown % 60; countdownDisplay.innerHTML = days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's'; countdown--; if (countdown < 0) { countdownDisplay.innerHTML = 'Event has ended.'; } } updateCountdown(); // Display initial countdown setInterval(updateCountdown, 1000); // Update countdown every second </script>"; } else { echo "<p>Event has ended.</p>"; } } else { echo "No events found."; } // Close the database connection $conn->close(); ?> </body> </html>