D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
public_html
/
Filename :
add_hod.php
back
Copy
<?php include 'includes/config.php'; session_start(); if (isset($_POST['username']) && isset($_POST['password'])) { $manager = $_POST['username']; $password = $_POST['password']; $cmem = "SELECT id FROM auth WHERE username='$manager' AND password='$password' LIMIT 1"; $run_cmem = mysqli_query($con, $cmem); $count_mem = mysqli_num_rows($run_cmem); if ($count_mem == 1) { while ($row = mysqli_fetch_array($run_cmem)) { $id = $row['id']; } $_SESSION['id'] = $id; $_SESSION['manager'] = $manager; $_SESSION['password'] = $password; header('location: mod-auth'); exit(); } else { echo "<script>alert('Incorrect Password !!!')</script>"; echo "<script>window.open('sacredheartdadmin','_self')</script>"; exit(); } } ?> <?php $page_title; $page_title = ucfirst(basename(__FILE__, '.php')); if ($page_title === 'index') { $page_title = 'Home'; } $page_title = "Add HOD page"; include 'section/header.php'; include 'section/pages-header.php'; include 'includes/functions.php'; $Functions = new Functions(); ?> <!DOCTYPE html> <html dir="ltr" lang="en"> <!-- Start main-content --> <div class="main-content"> <!-- Section: Team --> <section id="team"> <div class="container"> <div class="row mtli-row-clearfix mb-5000"> <?php if (isset($_GET['sn'])) { $sn = $_GET['sn']; $delete = "delete from hod where hid='$sn'"; $run = mysqli_query($con, $delete); if ($delete) { echo "<div class='alert alert-danger'> Carousel deleted successfully! </div>"; echo "<script>window.open('add_hod','_self')</script></script>"; } } ?> <div class="col-lg-9"> <p><a href="mod-auth">Go back to Admin Dashboard</a></p> <?php if (isset($_POST['addstaff'])) { $id = str_replace("'", "''", $_POST['name']); $hod = str_replace("'", "''", $_POST['hod']); global $con; $query = "INSERT INTO hod (staffid,hod_of) VALUES ('$id','$hod')"; $query_run = mysqli_query($con, $query); if ($query_run) { echo "<div class='alert alert-success'> Added Successfully! </div>"; } else { echo "<div class='alert alert-danger'> An error occured, please try again! </div>"; } } ?> <h3 style="color: #17569E;">Add HOD!</h3> <?php // $query = "SELECT * FROM content WHERE id='1' "; // $query_run = mysqli_query($con, $query); // while ($row_post = mysqli_fetch_array($query_run)) { // $title = $row_post['title']; // $link = $row_post['link']; // $contenter = $row_post['content']; // } ?> <form id="form1" name="form1" method="post" action="" enctype="multipart/form-data"> <table width="100%" cellpadding="1" cellspacing="2"> <div class="mb-3"> <label>Name (Select from Existing Academic Staff)</label><br> <select name="name" class="form-control" id=""> <option value="">select option</option> <?php $query = "SELECT * FROM staff WHERE category='academic'"; $query_run = mysqli_query($con, $query); while ($row_post = mysqli_fetch_array($query_run)) { $id = $row_post['id']; $name = $row_post['name']; ?> <option value="<?= $id ?>"><?= $name ?></option> <?php } ?> </select> </div> <div class="mb-3"> <label>HOD/assis HOD of:</label> <input type="text" name="hod" placeholder="ART /LANGUAGE DEPARTMENT HOD or ART /LANGUAGE DEPARTMENT (ASST.HOD)" class="form-control" required> </div> <!-- <div class="mb-3"> <label>Content</label> <textarea id="editor" type="text" name="content" class="form-control"></textarea> <script> ClassicEditor .create( document.querySelector( '#editor' ) ) .then( editor => { console.log( editor ); } ) .catch( error => { console.error( error ); } ); </script> </div> --> <div class="mb-3"> <input style="margin-left: 100px;" name="addstaff" type="submit" style="font-size:12px;" class="default-btn" id="addnews" value="Add HOD" /> </div> </table> </form> <hr/> <p style="color:#990000"><b>Existing HOD</b></p> <?php $get_feedback = "select * from hod,staff where staff.id=hod.staffid"; $run_feedback = mysqli_query($con, $get_feedback); while ($row_feedback = mysqli_fetch_array($run_feedback)) { $sn = $row_feedback['hid']; $image = $row_feedback['image']; $name = $row_feedback['name']; echo " <div class='row' style='margin-bottom: 10px;border-bottom: 1px solid #E6E6E6;padding: 10px;padding-left: 0px;'> <div class='col-lg-3'> <img src='$image' height='70' width='70'/> </div> <div class='col-lg-5'> $name </div> <div class='col-lg-3'> <a href='add_hod?sn=$sn' style='color: red;'>Remove</a> </div> </div> "; } ?> </div> </div> </div> </section> </div> <!-- end main-content --> <?php include_once 'section/footer.php'; ?>