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

File Manager

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

Melihat File: leadership1.php

<?php
session_start();
include('config.php');

// Hide errors from public users (log them instead)
ini_set('display_errors', 0);
error_reporting(0);

// Define variables safely
$current_stage = isset($current_stage) ? (int)$current_stage : 0;
$cas = isset($cas) ? htmlspecialchars($cas, ENT_QUOTES, 'UTF-8') : '';

// Pagination setup
$results_per_page = 10;

// Get total number of contestants safely
$total_query = "SELECT COUNT(*) AS total FROM registration";
$total_result = mysqli_query($conn, $total_query);
$total_row = mysqli_fetch_assoc($total_result);
$number_of_results = (int)$total_row['total'];
$number_of_pages = ceil($number_of_results / $results_per_page);

// Sanitize page input
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
if ($page < 1) $page = 1;

// Compute offset
$page_first_result = ($page - 1) * $results_per_page;

// Fetch contestants securely
$stmt = $conn->prepare("SELECT * FROM registration ORDER BY vote DESC LIMIT ?, ?");
$stmt->bind_param("ii", $page_first_result, $results_per_page);
$stmt->execute();
$result = $stmt->get_result();
$con = $result->fetch_all(MYSQLI_ASSOC);
?>

<!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">
    


    <style>
        .btno {
            background-color: #560280;
            color: white;
            border-radius: 10px;
            transition: 0.3s ease;
        }
        .btno:hover {
            color: #560280;
            background-color: white;
            text-decoration: none;
            font-weight: bold;
            border: solid 1px #FCB900;
        }
        .avatar {
            object-fit: contain;
            border-radius: 20%;
            width: 60%;
            height: 250px;
        }
    </style>
</head>
<body>
        <?php include('nav.php'); ?>
    <br>
<br>
<br>
<br>
<br>
<br>

<section class="center" style="margin-top: 4rem;">
    <!--<h4>Our Top 10 Contestants for this stage </h4>-->
    <!--<a href="search.php" style="color:#FCB900; font-weight: bold; text-align: center;">Search Contestants</a>-->
</section>

<main class="container">

<section>
    <div class="row"><br>
    <?php foreach($con 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="<?php echo htmlspecialchars($cons['Image'], ENT_QUOTES, 'UTF-8'); ?>" 
                     alt="Contestant Image" class="avatar">

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

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

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

<!-- Pagination -->
<div class="center" style="margin-top: 2rem;">
    <?php for ($i = 1; $i <= $number_of_pages; $i++): ?>
        <a href="leadership1.php?page=<?php echo $i; ?>" 
           class="btn <?php echo ($i == $page) ? 'btno' : 'grey lighten-2'; ?>">
           <?php echo $i; ?>
        </a>
    <?php endfor; ?>
</div>

</main>

<br>

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

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