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/www/oldwebsite.sbsc.in/faculty/dashboard/index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

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

/* ======================
   TEACHER SESSION CHECK
====================== */
if (
    !isset($_SESSION['teacher_logged_in']) ||
    $_SESSION['teacher_logged_in'] !== true ||
    !isset($_SESSION['teacher_id'])
) {
    header("Location: ../auth/login.php");
    exit;
}

$teacher_id = $_SESSION['teacher_id'];

/* ======================
   FETCH TEACHER DATA
====================== */
$stmt = $conn->prepare("
    SELECT name, designation, department, phone
    FROM teachers
    WHERE id = ?
");
$stmt->bind_param("i", $teacher_id);
$stmt->execute();
$stmt->bind_result($name, $designation, $department, $phone);
$stmt->fetch();
$stmt->close();

if (!$name) {
    echo "Teacher record not found";
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>Faculty 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:#065f46;
            min-height:100vh;
            color:#fff;
            padding:20px;
        }
        .sidebar h3{
            margin:0 0 25px;
            font-size:18px;
            font-weight:600;
        }
        .sidebar a{
            display:block;
            color:#d1fae5;
            text-decoration:none;
            padding:10px 0;
            font-size:14px;
        }
        .sidebar a:hover{
            color:#fff;
        }

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

        h2{
            margin:0 0 25px;
            font-weight:600;
        }

        /* FORM */
        .box{
            max-width:700px;
            background:#fff;
            border:1px solid #e5e7eb;
            padding:25px;
        }
        label{
            display:block;
            font-size:13px;
            font-weight:600;
            margin-bottom:6px;
        }
        input[type="text"],
        input[type="file"]{
            width:100%;
            padding:10px;
            margin-bottom:15px;
            border:1px solid #ccc;
            font-size:13px;
        }

        h4{
            margin-top:25px;
            font-size:15px;
            font-weight:600;
        }

        .btn{
            padding:8px 14px;
            font-size:13px;
            border:1px solid transparent;
            cursor:pointer;
        }
        .btn-secondary{
            background:#e5e7eb;
        }
        .btn-success{
            background:#16a34a;
            color:#fff;
        }
    </style>
</head>
<body>

<!-- SIDEBAR -->
<div class="sidebar">
    <h3>Faculty Panel</h3>
    <a href="index.php">Dashboard</a>
    <a href="../cv/<?=$department?>/<?=$name?>" target="_blank">View CV</a>
    <a href="../auth/logout.php">Logout</a>
</div>

<!-- MAIN -->
<div class="main">
    <h2>My Profile</h2>

    <form method="post" action="save.php" enctype="multipart/form-data">

        <div class="box">
            <label>Name</label>
            <input name="name" value="<?=htmlspecialchars($name)?>">

            <label>Designation</label>
            <input name="designation" value="<?=htmlspecialchars($designation)?>">

            <label>Department</label>
            <input name="department" value="<?=htmlspecialchars($department)?>">

            <label>Phone</label>
            <input name="phone" value="<?=htmlspecialchars($phone)?>">

            <label>Photo</label>
            <input type="file" name="photo">
        </div>

        <h4>Education</h4>
        <div id="edu"></div>
        <button type="button" onclick="addEdu()" class="btn btn-secondary">+ Add Education</button>

        <h4>Fellowship</h4>
        <div id="fell"></div>
        <button type="button" onclick="addFell()" class="btn btn-secondary">+ Add Fellowship</button>

        <br><br>
        <button class="btn btn-success">Save All</button>

    </form>
</div>

</body>
</html>