File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/admin3/demo.php
Back
<?php include 'config.php'; session_start(); if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { header("Location: login.php"); exit; } $filter = $_GET['filter'] ?? 'PRESENT'; $type = $_GET['type'] ?? 'ALL'; $search = $_GET['search'] ?? ''; $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1; $limit = 15; $offset = ($page - 1) * $limit; $params = []; $count_sql = "SELECT COUNT(*) FROM ipo_post WHERE 1 "; $sql = "SELECT * FROM ipo_post WHERE 1 "; if ($filter !== 'ALL' && in_array($filter, ['PRESENT', 'NEW', 'PAST'])) { $count_sql .= "AND status = ? "; $sql .= "AND status = ? "; $params[] = $filter; } if ($type !== 'ALL' && in_array($type, ['M', 'S'])) { $count_sql .= "AND type = ? "; $sql .= "AND type = ? "; $params[] = $type; } if (!empty($search)) { $count_sql .= "AND LOWER(c_name) LIKE ? "; $sql .= "AND LOWER(c_name) LIKE ? "; $params[] = "%" . strtolower($search) . "%"; } $sql .= "ORDER BY id DESC LIMIT $limit OFFSET $offset"; $count_stmt = $pdo->prepare($count_sql); $count_stmt->execute(array_slice($params, 0)); $total_rows = $count_stmt->fetchColumn(); $total_pages = ceil($total_rows / $limit); $stmt = $pdo->prepare($sql); $stmt->execute($params); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>IPO Admin Panel</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <style> @media (max-width: 576px) { .table th, .table td { font-size: 12px; padding: 6px; white-space: nowrap; } h2 { font-size: 18px; } .btn { font-size: 12px; padding: 6px 10px; } .logo-img { height: 24px; margin-right: 4px; } form[role="search"] { width: 100%; } form[role="search"] input { flex: 1; margin-right: 8px; } } .logo-img { height: 30px; width: auto; margin-right: 8px; } </style> <script> function updateType(type) { const url = new URL(window.location.href); url.searchParams.set('type', type); url.searchParams.delete('search'); window.location.href = url.toString(); } function updateFilter(filter) { const url = new URL(window.location.href); url.searchParams.set('filter', filter); url.searchParams.delete('search'); window.location.href = url.toString(); } let deleteTimer = null; function confirmDelete(id) { if (confirm("Are you sure you want to delete this IPO?")) { const deleteButton = document.getElementById("delete-btn-" + id); deleteButton.disabled = true; deleteButton.innerText = "โณ Waiting 5s..."; let countdown = 5; const originalText = "๐๏ธ Delete"; deleteTimer = setInterval(() => { countdown--; deleteButton.innerText = `โณ ${countdown}s left...`; if (countdown <= 0) { clearInterval(deleteTimer); const secondConfirm = confirm("Final confirmation to delete?"); if (secondConfirm) { window.location.href = 'deleteipo.php?id=' + id; } else { deleteButton.disabled = false; deleteButton.innerText = originalText; } } }, 1000); } } </script> </head> <body> <div class="container py-4"> <div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2"> <h2 class="mb-0">IPO Post Management</h2> <a href="logout.php" class="btn btn-danger btn-sm">๐ช Logout</a> </div> <div class="row mb-3 g-2"> <div class="col-12 col-md-auto d-flex flex-wrap gap-2"> <div class="d-flex flex-wrap gap-2 mb-3"> <a href="add.php" class="btn btn-success">โ Add New IPO</a> <a href="sequence.php" class="btn btn-success">๐ Change IPO Sequence</a> <a href="IPOCalandar.php" class="btn btn-success">๐ IPO Calendar</a> <a href="https://sharemarketipo.in/ImageGenerator/LogoMakerForIPOAPP/index.php" class="btn btn-success">๐ผ๏ธ Square Logo Maker</a> <a href="https://cipherteam.in/admin3/scraper_servers.php" class="btn btn-success">โฑ๏ธ Allotment Cron</a> </div> </div> <div class="col-12 col-md"> <form method="GET" class="d-flex" role="search"> <input type="hidden" name="filter" value="<?= htmlspecialchars($filter) ?>"> <input type="hidden" name="type" value="<?= htmlspecialchars($type) ?>"> <input class="form-control me-2" type="search" name="search" value="<?= htmlspecialchars($search) ?>" placeholder="Search Company"> <button class="btn btn-outline-primary" type="submit">๐</button> </form> </div> </div> <div class="row mb-3 g-2"> <div class="col-12 col-md-auto"> <div class="btn-group w-100"> <button class="btn btn-outline-primary <?= $filter == 'ALL' ? 'active' : '' ?>" onclick="updateFilter('ALL')">All</button> <button class="btn btn-outline-primary <?= $filter == 'PRESENT' ? 'active' : '' ?>" onclick="updateFilter('PRESENT')">Present</button> <button class="btn btn-outline-primary <?= $filter == 'NEW' ? 'active' : '' ?>" onclick="updateFilter('NEW')">New</button> <button class="btn btn-outline-primary <?= $filter == 'PAST' ? 'active' : '' ?>" onclick="updateFilter('PAST')">Past</button> </div> </div> <div class="col-12 col-md-auto"> <div class="btn-group w-100" role="group" aria-label="IPO Type"> <input type="radio" class="btn-check" name="type" id="typeAll" value="ALL" autocomplete="off" <?= $type == 'ALL' ? 'checked' : '' ?> onclick="updateType('ALL')"> <label class="btn btn-outline-dark" for="typeAll">All</label> <input type="radio" class="btn-check" name="type" id="typeMain" value="M" autocomplete="off" <?= $type == 'M' ? 'checked' : '' ?> onclick="updateType('M')"> <label class="btn btn-outline-dark" for="typeMain">Mainline</label> <input type="radio" class="btn-check" name="type" id="typeSME" value="S" autocomplete="off" <?= $type == 'S' ? 'checked' : '' ?> onclick="updateType('S')"> <label class="btn btn-outline-dark" for="typeSME">SME</label> </div> </div> </div> <div class="table-responsive"> <table class="table table-striped table-bordered align-middle"> <thead class="table-dark"> <tr> <th>ID</th> <th>Company</th> <th>IPO Open</th> <th>IPO Close</th> <th>Actions</th> </tr> </thead> <tbody> <?php if ($stmt->rowCount() > 0): ?> <?php while ($row = $stmt->fetch()): ?> <tr> <td><?= $row['id'] ?></td> <td> <div class="d-flex align-items-center"> <?php if (!empty($row['img'])): ?> <img src="<?= htmlspecialchars($row['img']) ?>" alt="Logo" class="logo-img"> <?php endif; ?> <span><?= htmlspecialchars($row['c_name']) ?></span> </div> </td> <td><?= htmlspecialchars($row['ipo_open']) ?></td> <td><?= htmlspecialchars($row['ipo_close']) ?></td> <td> <a href="viewipo.php?id=<?= $row['id'] ?>" class="btn btn-sm btn-info me-1">๐๏ธ View</a> <a href="editipo.php?id=<?= $row['id'] ?>" class="btn btn-sm btn-warning me-1">โ๏ธ Edit</a> <button id="delete-btn-<?= $row['id'] ?>" onclick="confirmDelete(<?= $row['id'] ?>)" class="btn btn-sm btn-danger">๐๏ธ Delete</button> </td> </tr> <?php endwhile; ?> <?php else: ?> <tr><td colspan="5" class="text-center text-muted">No IPOs found.</td></tr> <?php endif; ?> </tbody> </table> </div> <?php if ($total_pages > 1): ?> <nav> <ul class="pagination justify-content-center flex-wrap"> <li class="page-item <?= $page == 1 ? 'disabled' : '' ?>"> <a class="page-link" href="?page=1&filter=<?= urlencode($filter) ?>&type=<?= urlencode($type) ?>">ยซ First</a> </li> <li class="page-item <?= $page == 1 ? 'disabled' : '' ?>"> <a class="page-link" href="?page=<?= $page - 1 ?>&filter=<?= urlencode($filter) ?>&type=<?= urlencode($type) ?>">โน Prev</a> </li> <?php $start = max(1, $page - 2); $end = min($total_pages, $page + 2); if ($start > 1) { echo '<li class="page-item disabled"><span class="page-link">...</span></li>'; } for ($i = $start; $i <= $end; $i++): ?> <li class="page-item <?= $i == $page ? 'active' : '' ?>"> <a class="page-link" href="?page=<?= $i ?>&filter=<?= urlencode($filter) ?>&type=<?= urlencode($type) ?>"><?= $i ?></a> </li> <?php endfor; if ($end < $total_pages) { echo '<li class="page-item disabled"><span class="page-link">...</span></li>'; } ?> <li class="page-item <?= $page == $total_pages ? 'disabled' : '' ?>"> <a class="page-link" href="?page=<?= $page + 1 ?>&filter=<?= urlencode($filter) ?>&type=<?= urlencode($type) ?>">Next โบ</a> </li> <li class="page-item <?= $page == $total_pages ? 'disabled' : '' ?>"> <a class="page-link" href="?page=<?= $total_pages ?>&filter=<?= urlencode($filter) ?>&type=<?= urlencode($type) ?>">Last ยป</a> </li> </ul> </nav> <?php endif; ?> </div> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9b0556631a3aa459',t:'MTc2NjEzMDkyNA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings