ÿØÿà JFIFÿØÿà JFIF ÿØÿà JFIFÿØÿà JFIF   ÿþ$    File Manager

File Manager

Path: /home/u371470492/domains/babiesnitch.com/public_html/

Melihat File: leadership3.php

<?php 
session_start();

// Secure session setup
ini_set('session.cookie_httponly', 1);
if (isset($_SERVER['HTTPS'])) {
    ini_set('session.cookie_secure', 1);
}
session_regenerate_id(true);

include('config.php');
?>

<!DOCTYPE html>
<html lang="en">
<head>
   
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


</head>

<body>
    <?php include('nav.php'); ?>
    <br>
<br>
<br>
<br>
<br>
<br>
<section class="center" style="margin-top: 4rem;">
    <!-- Optional: title or search -->
</section>

<main class="container">

<?php 
// =============================
// Pagination Setup
// =============================
$results_per_page = 10;

// Get total count securely
$count_query = $conn->prepare("SELECT COUNT(*) FROM registration");
$count_query->execute();
$count_query->bind_result($number_of_results);
$count_query->fetch();
$count_query->close();

$number_of_pages = ceil($number_of_results / $results_per_page);

// Get current page safely
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
if ($page < 1) $page = 1;
$page_first_result = ($page - 1) * $results_per_page;

// Fetch data safely
$stmt = $conn->prepare("SELECT Id, Childsname, Image, stage_three_vote FROM registration ORDER BY stage_three_vote DESC LIMIT ?, ?");
$stmt->bind_param("ii", $page_first_result, $results_per_page);
$stmt->execute();
$result = $stmt->get_result();
$contestants = $result->fetch_all(MYSQLI_ASSOC);
$stmt->close();

// Define stage safely
$current_stage = isset($current_stage) ? (int)$current_stage : 3; // default 3 for this page
?>

<section>
    <div class="row"><br>
        <?php foreach ($contestants as $cons): ?>
            <div class="col l3 m6 s12 center" style="font-family: Trebuchet MS;">
                <div class="card z-depth-1 center hoverable" style="padding-bottom: 40px; border-radius: 15%;">
                    <br>
                    <img src="<?= htmlspecialchars($cons['Image'], ENT_QUOTES, 'UTF-8') ?>" 
                         class="avatar" 
                         style="object-fit:contain; border-radius: 20%; width: 60%; height:250px" 
                         alt="Contestant Image">

                    <h6 class="center" style="margin: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #000000a4; font-weight: bold;">
                        <?= htmlspecialchars($cons['Childsname'], ENT_QUOTES, 'UTF-8') ?>
                    </h6>

                    <div style="font-weight: bold; color: #FCB900; font-size: 1.4rem;">
                        <?= (int)$cons['stage_three_vote'] ?> Votes
                    </div>

                    <?php 
                    $contestantId = (int)$cons['Id'];
                    // Determine voting link by stage
                    switch ($current_stage) {
                        case 0:  $action = "notyet.php?id=$contestantId"; break;
                        case 1:  $action = "voter1.php?id=$contestantId"; break;
                        case 2:  $action = "voter2.php?id=$contestantId"; break;
                        case 3:  $action = "voter3.php?id=$contestantId"; break;
                        default: $action = "notyet.php"; break;
                    }
                    ?>
                    
                    <form action="<?= htmlspecialchars($action, ENT_QUOTES, 'UTF-8') ?>" method="POST">
                        <input type="hidden" name="id" value="<?= $contestantId ?>">
                        <input type="submit" name="vote" class="btn btno z-depth-0" value="View">
                    </form>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
</section>

</main>

<style>
.btno {
  background-color: #560280;
  color: white;
  border-radius: 10px;
}
.btno:hover {
  color: #560280;
  background-color: white;
  text-decoration: none;
  font-weight: bold;
  border: solid 1px #FCB900;
  border-radius: 10px;
}
</style>

<br>
<?php include('footer.php'); ?>

</body>
</html>
ÿØÿà JFIF    ÿþ$ ÿØÿà JFIF    ÿþ$ ÿÂ