HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/nyiet8349bzl/public_html/oldwebsite.sbsc.in/faculty/admin/dashboard.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

include "../config/database.php";

if (!isset($_SESSION['admin_logged_in'])) {
    header("Location: login.php");
    exit;
}

$result = $conn->query("SELECT * FROM teachers");
?>
<!DOCTYPE html>
<html>
<head>
    <title>Admin Dashboard</title>

    <!-- OPEN SANS -->
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet">

    <style>
        *{
            box-sizing:border-box;
            font-family:'Open Sans', sans-serif;
        }
        body{
            margin:0;
            background:#f6f7fb;
            display:flex;
        }

        /* SIDEBAR */
        .sidebar{
            width:220px;
            background:#1f2937;
            min-height:100vh;
            color:#fff;
            padding:20px;
        }
        .sidebar h3{
            margin:0 0 25px;
            font-size:18px;
            font-weight:600;
        }
        .sidebar a{
            display:block;
            color:#d1d5db;
            text-decoration:none;
            padding:10px 0;
            font-size:14px;
        }
        .sidebar a:hover{
            color:#fff;
        }

        /* MAIN */
        .main{
            flex:1;
            padding:30px;
        }

        .top-bar{
            display:flex;
            justify-content:space-between;
            align-items:center;
            margin-bottom:25px;
        }
        .top-bar h2{
            margin:0;
            font-weight:600;
        }
        .btn{
            padding:8px 14px;
            text-decoration:none;
            font-size:13px;
            border-radius:4px;
            border:1px solid transparent;
        }
        .btn-primary{
            background:#2563eb;
            color:#fff;
        }
        .btn-outline{
            border:1px solid #2563eb;
            color:#2563eb;
            background:#fff;
        }

        /* TABLE */
        table{
            width:100%;
            border-collapse:collapse;
            background:#fff;
        }
        th{
            text-align:left;
            background:#eef2ff;
            padding:12px;
            font-size:13px;
            font-weight:600;
            border-bottom:1px solid #ddd;
        }
        td{
            padding:12px;
            font-size:13px;
            border-bottom:1px solid #eee;
        }
        tr:hover{
            background:#f9fafb;
        }

        .cv-input{
            width:100%;
            font-size:11px;
            padding:6px;
            border:1px solid #ccc;
            background:#f9fafb;
        }

        .action a{
            font-size:12px;
            margin-right:8px;
            text-decoration:none;
            color:#2563eb;
        }
        .action a.delete{
            color:#dc2626;
        }
    </style>
</head>
<body>

<!-- SIDEBAR -->
<div class="sidebar">
    <h3>Admin Panel</h3>
    <a href="dashboard.php">Dashboard</a>
    <a href="save-teacher.php">Add Teacher</a>
    <a href="logout.php">Logout</a>
</div>

<!-- MAIN -->
<div class="main">

    <div class="top-bar">
        <h2>Teachers List</h2>
        <a href="save-teacher.php" class="btn btn-primary">+ Add Teacher</a>
    </div>

    <table>
        <tr>
            <th>Name</th>
            <th>Email</th>
            <th>Department</th>
            <th>CV URL</th>
            <th>Action</th>
        </tr>

        <?php while($row = $result->fetch_assoc()){ ?>
        <tr>
            <td><?=htmlspecialchars($row['name'])?></td>
            <td><?=htmlspecialchars($row['email'])?></td>
            <td><?=htmlspecialchars($row['department'])?></td>

            <td>
                <input class="cv-input"
                       value="https://oldwebsite.sbsc.in/faculty/<?=$row['dept_slug']?>/<?=$row['slug']?>"
                       readonly onclick="this.select()">
            </td>

            <td class="action">
                <a href="save-teacher.php?edit=<?=$row['id']?>">Edit</a>
                <a href="save-teacher.php?delete=<?=$row['id']?>"
                   class="delete"
                   onclick="return confirm('Delete this teacher?')">
                   Delete
                </a>
            </td>
        </tr>
        <?php } ?>
    </table>

</div>

</body>
</html>