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

File Manager

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

Melihat File: contestants.php

<?php 
session_start();
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">
    <title>Contestants</title>
    <link src="../materialize/css/materialize.js"></link>
    
</head>

<body>

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

<section class="center" style="">
    <a href="search.php" style="color:#FCB900; font-weight: bold; text-align: center;">Search Contestants</a>
</section>

<main class="container">

<?php 
// ---- Pagination Setup ---- //
$results_per_page = 15;

// Get total number of records
$count_sql = "SELECT COUNT(*) AS total FROM registration";
$count_result = mysqli_query($conn, $count_sql);
$count_row = mysqli_fetch_assoc($count_result);
$number_of_results = $count_row['total'] ?? 0;

// Calculate number of pages
$number_of_pages = ceil($number_of_results / $results_per_page);

// Current page
$page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;

// Calculate starting record
$page_first_result = ($page - 1) * $results_per_page;

// Fetch paginated results
$query = "SELECT * FROM registration ORDER BY Id ASC LIMIT ?, ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("ii", $page_first_result, $results_per_page);
$stmt->execute();
$result = $stmt->get_result();
$con = $result->fetch_all(MYSQLI_ASSOC);

// Optional (avoid undefined)
$current_stage = $current_stage ?? 0;
$cas = $cas ?? 0;
?>

<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: 15px;">
                <br>
                <img src="<?php echo htmlspecialchars($cons['Image']); ?>" class="avatar" style="object-fit:cover; border-radius: 20px; width: 200px; height:230px" alt="">
                
                <h6 class="center" style="margin-left:3px; margin-right:3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #000000a4; font-weight: bold;">
                    <?php echo htmlspecialchars($cons['Childsname']); ?>
                </h6>

                <?php if ($current_stage == 0): ?>
                    <form action="notyet.php?id=<?php echo $cons['Id']; ?>" method="POST">
                        <input type="hidden" name="id" value="<?php echo $cas; ?>">
                        <input type="submit" name="vote" class="btn btno z-depth-0" value="Vote">
                    </form>

                <?php elseif ($current_stage == 1): ?>
                    <form action="voter1.php?id=<?php echo $cons['Id']; ?>" method="POST">
                        <input type="hidden" name="id" value="<?php echo $cas; ?>">
                        <input type="submit" name="vote" class="btn btno z-depth-0" value="Vote">
                    </form>

                <?php elseif ($current_stage == 2): ?>
                    <form action="voter2.php?id=<?php echo $cons['Id']; ?>" method="POST">
                        <input type="hidden" name="id" value="<?php echo $cas; ?>">
                        <input type="submit" name="vote" class="btn btno z-depth-0" value="Vote">
                    </form>

                <?php elseif ($current_stage == 3): ?>
                    <form action="voter3.php?id=<?php echo $cons['Id']; ?>" method="POST">
                        <input type="hidden" name="id" value="<?php echo $cas; ?>">
                        <input type="submit" name="vote" class="btn btno z-depth-0" value="Vote">
                    </form>

                <?php else: ?>
                    <a href="notyet.php">
                        <input type="submit" class="btn btno z-depth-0" value="Vote">
                    </a>
                <?php endif; ?>

            </div>
        </div>
    <?php endforeach; ?>
    </div>
</section>

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

<!-- Pagination Controls -->
<div class="center">
    <?php if ($page > 1): ?>
        <a href="contestants.php?page=<?php echo $page - 1; ?>" class="btn z-depth-4" style="background-color: #FCB900">Previous Page</a>
    <?php endif; ?>

    <?php if ($page < $number_of_pages): ?>
        <a href="contestants.php?page=<?php echo $page + 1; ?>" class="btn" style="background-color: #FCB900">Next Page</a>
    <?php else: ?>
        <label style="font-size: 1.4rem">Last Page</label>
    <?php endif; ?>
</div>

</main>

<br>

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

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