Mini Shell

Direktori : /home2/aravindar/public_html/admin/
Upload File :
Current File : /home2/aravindar/public_html/admin/add_pgcourse.php

<?php
/* Database connection */
include("config.php");
$conn = dbconnect();
error_reporting(0);
session_start();

// login or not
if ($_SESSION['name'] == '' || $_SESSION['admin_id'] == '') {
    header('location:logout.php');
    die();
}

$name = $_SESSION['name'];
$admin_id = $_SESSION['admin_id'];
$query  = "SELECT * FROM tb1_admin WHERE name='" . $name . "' AND admin_id='" . $admin_id . "'";
$res_query = mysqli_query($conn, $query);
$fetch = mysqli_fetch_object($res_query);
$username = $fetch->user_name;
$phone = $fetch->phone;
$adminposition = $fetch->position;
if ($adminposition == 1) {
    $type = 'Main Admin';
} elseif ($adminposition == 2) {
    $type = 'Accounts';
} elseif ($adminposition == 3) {
    $type = 'Marketing';
} else {
    $type = 'Others';
}

?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Admin - Sri Aravindar Arts & Science College </title>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<!-- Favicon icon -->
<link rel="icon" href="assets/images/favicon.png" type="image/x-icon">
<!-- Google font-->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,800" rel="stylesheet">
<!-- Required Fremwork -->
<link rel="stylesheet" type="text/css" href="plugin/bootstrap/dist/css/bootstrap.min.css">
<!-- feather Awesome -->
<link rel="stylesheet" type="text/css" href="assets/icon/feather/css/feather.css">
<!-- Font Awesome -->
<link rel="stylesheet" type="text/css" href="assets/icon/font-awesome/css/font-awesome.min.css">
<!-- Style.css -->
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="assets/css/jquery.mCustomScrollbar.css">
<!-- jquery file upload Frame work -->
<link href="assets/pages/jquery.filer/css/jquery.filer.css" type="text/css" rel="stylesheet" />
<link href="assets/pages/jquery.filer/css/themes/jquery.filer-dragdropbox-theme.css" type="text/css" rel="stylesheet" />
<!-- animation nifty modal window effects css -->
<link rel="stylesheet" type="text/css" href="assets/css/component.css">
<link rel="stylesheet" type="text/css" href="assets/css/validation/tooltip-style.css">
<style type="text/css">
    .des {
        text-align: justify;
        font-size: 13px;
        line-height: 1.4;
        height: 190px;
    }

    .loader-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
    }

    .spinner-container {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 9999;
    }

    /* HTML: <div class="loader"></div> */
    /* HTML: <div class="loader"></div> */
    /* HTML: <div class="loader"></div> */
    .loader {
        width: 100px;
        height: 100px;
        padding: 10px;
        box-sizing: border-box;
        display: grid;
        background: #fff;
        filter: blur(4px) contrast(10) hue-rotate(240deg);
        mix-blend-mode: darken;
    }

    .loader:before {
        content: "";
        grid-area: 1/1;
        margin: 30px 0;
        border-radius: 100px;
        background: #00ffff;
    }

    .loader:after {
        content: "";
        grid-area: 1/1;
        height: 35px;
        width: 35px;
        margin: auto;
        border-radius: 50%;
        background: #00ffff;
        animation: l5 2s infinite linear;
    }

    @keyframes l5 {
        0% {
            transform: translate(30px)
        }

        25% {
            transform: translate(0)
        }

        50% {
            transform: translate(-30px)
        }

        75% {
            transform: translate(0)
        }

        100% {
            transform: translate(30px)
        }
    }

    .hideloader {
        display: none;
    }
</style>
</head>
<!-- Menu sidebar static layout -->

<body>
    <div id="loaderid" class="spinner-container hideloader">
        <div class="loader"></div>
    </div>
    <!-- Pre-loader start -->
    <div class="theme-loader">
        <div class="ball-scale">
            <div class='contain'>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
                <div class="ring">
                    <div class="frame"></div>
                </div>
            </div>
        </div>
    </div>
    <!-- Pre-loader end -->
    <div id="pcoded" class="pcoded">
        <div class="pcoded-overlay-box"></div>
        <div class="pcoded-container navbar-wrapper">

            <?php include('static-header.php') ?>

            <div class="pcoded-main-container">
                <div class="pcoded-wrapper">

                    <?php include('static-sidebar.php') ?>

                    <div class="pcoded-content">
                        <div class="pcoded-inner-content">
                            <div class="main-body">
                                <div class="page-wrapper">
                                    <!-- Page-header start -->
                                    <div class="page-header">
                                        <div class="row align-items-end">
                                            <div class="col-lg-8">
                                                <div class="page-header-title">
                                                    <div class="d-inline">
                                                        <h4>Add PG Course</h4>
                                                        <span>You can Add The PG courses here!</span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-4">
                                                <div class="page-header-breadcrumb">
                                                    <ul class="breadcrumb-title">
                                                        <li class="breadcrumb-item" style="float: left;">
                                                            <a href="dashboard"> <i class="feather icon-home"></i> </a>
                                                        </li>
                                                        <li class="breadcrumb-item" style="float: left;"><a href="#!">Home Page</a>
                                                        </li>
                                                        <li class="breadcrumb-item" style="float: left;"><a href="#!">UG Courses</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- Page-header end -->
                                    <!-- Page body start -->
                                    <div class="page-body">
                                        <div class="card">
                                            <form class="edit-form" id="editForm" enctype="multipart/form-data">
                                                <div class="col-md-12">
                                                    <div class="card-block">
                                                        <input type="hidden" name="type" value="add">
                                                        <div class="row">
                                                            <div class="col-md-4 form-group">
                                                                <label class=" col-form-label">Course Name </label>
                                                                <input type="text" class="form-control" id="course_name" name="course_name" required>
                                                            </div>
                                                            <div class="col-md-4 form-group">
                                                                <label class=" col-form-label">Course Short Name </label>
                                                                <input type="text" class="form-control" id="short_name" name="short_name" required>
                                                            </div>

                                                            <div class="col-md-4 form-group">
                                                                <label class=" col-form-label">Course Duration </label>
                                                                <input type="text" class="form-control" id="duration" name="duration" required>
                                                            </div>


                                                            <div class="col-md-6 form-group">
                                                                <label class=" col-form-label">Course Description</label>
                                                                <textarea type="text" class="form-control" rows="5" id="para1" name="para1" required></textarea>
                                                            </div>
                                                            <div class="col-md-6 form-group">
                                                                <label class=" col-form-label">Mission</label>
                                                                <textarea type="text" class="form-control" rows="5" id="para2" name="para2" required></textarea>
                                                            </div>
                                                            <div class="col-md-6 form-group">
                                                                <label class=" col-form-label">Vision</label>
                                                                <textarea type="text" class="form-control" rows="5" id="career_prospect_para" name="career_prospect_para" required></textarea>
                                                            </div>
                                                            <div class="col-md-6 form-group">
                                                                <label class=" col-form-label">JOB OPPORTUNITIES</label>
                                                                <textarea type="text" class="form-control" rows="5" id="career_prospect_content" name="career_prospect_content" required></textarea>
                                                            </div>
                                                            <div class="col-md-12 form-group">
                                                                <label class=" col-form-label">Higher Studies</label>
                                                                <textarea type="text" class="form-control" rows="5" id="study_post_para" name="study_post_para" required></textarea>
                                                            </div>


                                                            <div class="form-group col-md-3 ">
                                                                <label class="col-form-label">Status</label>
                                                                <select class="form-control news_status" id="status" name="status">
                                                                    <option value="1">Active</option>
                                                                    <option value="0">Inactive</option>
                                                                </select>
                                                            </div>
                                                            <div class="col-md-3  form-group">
                                                                <label class="col-form-label">Change Course Image</label>
                                                                <input type="file" class="form-control" name="files" id="courseimage">
                                                            </div>
                                                            <div class="col-md-3  form-group">
                                                                <label class="col-form-label">Lab Image</label>
                                                                <input type="file" class="form-control" name="labimage" id="labimage">
                                                            </div>
                                                            <div class="col-md-3  form-group">
                                                                <label class="col-form-label">Change Course Syllabus</label>
                                                                <input type="file" class="form-control" name="syllabus" id="syllabus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-12 text-center mb-5">
                                                    <button type="submit" class="btn btn-success text-bold" id="sub-btn" style="width: -webkit-fill-available;">Submit</button>
                                                </div>
                                            </form>
                                            <div class="md-overlay"></div>
                                        </div>
                                    </div>
                                    <!-- Page body end -->
                                </div>
                                <div id="styleSelector">

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script type="text/javascript" src="plugin/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="plugin/jquery-ui/jquery-ui.min.js"></script>
    <script type="text/javascript" src="plugin/popper.js/dist/umd/popper.min.js"></script>
    <script type="text/javascript" src="plugin/bootstrap/dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="plugin/jquery-slimscroll/jquery.slimscroll.js"></script>
    <script type="text/javascript" src="plugin/modernizr/modernizr.js"></script>
    <script type="text/javascript" src="plugin/modernizr/feature-detects/css-scrollbars.js"></script>
    <script type="text/javascript" src="assets/js/modalEffects.js"></script>
    <script type="text/javascript" src="assets/js/classie.js"></script>
    <script src="assets/pages/jquery.filer/js/jquery.filer.min.js"></script>
    <script src="assets/pages/filer/custom-filer.js" type="text/javascript"></script>
    <script src="assets/pages/filer/jquery.fileuploads.init.js" type="text/javascript"></script>
    <script src="assets/js/pcoded.min.js"></script>
    <script src="assets/js/vartical-layout.min.js"></script>
    <script src="assets/js/sweetalert.min.js"></script>
    <script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script type="text/javascript" src="assets/js/script.js"></script>
    <script src="assets/validation/jquery-validation/jquery.validate.min.js"></script>
    <script src="assets/css/validation/form-validation.js"></script>

    <script type="text/javascript">
        $("#editForm").validate({
            errorPlacement: function(error, element) {
                var ele = $(element),
                    err = $(error),
                    msg = err.text();
                if (msg != null && msg !== "") {
                    ele.tooltipster('content', msg);
                    ele.tooltipster('open');
                }
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).removeClass(errorClass).addClass(validClass).tooltipster('close');
            },

            submitHandler: function(form) {
                var form = $('#editForm')[0];
                var formData = new FormData(form);
                event.preventDefault();
                const file = $('#courseimage')[0].files[0];
                const labimage = $('#labimage')[0].files[0];
                const syllabus = $('#syllabus')[0].files[0];
                var imagvalid = true;
                if (file) {
                    if (file.size > 550 * 1024) {
                        imagvalid = false;
                        swal({
                            title: 'File too large!',
                            text: "Please upload an Course image under 500 KB.",
                            icon: 'warning',
                            buttons: {
                                confirm: {
                                    text: 'Okay',
                                    value: true,
                                    visible: true,
                                    className: 'btn btn-primary',
                                    closeModal: true
                                }
                            },
                            closeOnEsc: false,
                            closeOnClickOutside: false
                        });
                    }
                }
                if (labimage) {
                    if (labimage.size > 550 * 1024) {
                        imagvalid = false;
                        swal({
                            title: 'File too large!',
                            text: "Please upload an Lab image under 500 KB.",
                            icon: 'warning',
                            buttons: {
                                confirm: {
                                    text: 'Okay',
                                    value: true,
                                    visible: true,
                                    className: 'btn btn-primary',
                                    closeModal: true
                                }
                            },
                            closeOnEsc: false,
                            closeOnClickOutside: false
                        });
                    }
                }
                if (syllabus) {
                    if (syllabus.size > 550 * 1024) {
                        imagvalid = false;
                        swal({
                            title: 'File too large!',
                            text: "Please upload an syllabus image under 500 KB.",
                            icon: 'warning',
                            buttons: {
                                confirm: {
                                    text: 'Okay',
                                    value: true,
                                    visible: true,
                                    className: 'btn btn-primary',
                                    closeModal: true
                                }
                            },
                            closeOnEsc: false,
                            closeOnClickOutside: false
                        });
                    }
                }
                if (imagvalid) {
                    $('#loaderid').removeClass('hideloader');
                    $("#sub-btn").attr("disabled", true);

                    $.ajax({
                        type: 'POST',
                        url: 'ajax/pgcourse_action.php',
                        processData: false,
                        contentType: false,
                        dataType: "json",
                        data: formData,
                        success: function(data) {
                            $('#loaderid').addClass('hideloader');
                            if (data == 'done') {
                                swal({
                                    title: 'Added Successfully!',
                                    text: "Course has been successfully Added",
                                    icon: 'success',
                                    confirmButtonColor: '#3f51b5',
                                    closeOnEsc: false,
                                    closeOnClickOutside: false,
                                    buttons: {
                                        confirm: {
                                            text: "Okay",
                                            value: true,
                                            visible: true,
                                            className: "btn btn-primary",
                                            closeModal: true
                                        }
                                    }
                                }).then((value) => {
                                    if (value == true) {
                                        location.reload();
                                    }
                                });
                            }
                        },
                        error: function(data) {
                            $('#loaderid').addClass('hideloader');
                            swal({
                                title: 'Internal Sever Error!',
                                text: "Try again",
                                icon: 'warning',
                                closeOnEsc: false,
                                closeOnClickOutside: false,
                            })
                        },
                    });
                }
            }
        });
    </script>


</body>

</html>

Zerion Mini Shell 1.0