Mini Shell
<?php
/* Database connection */
include("config.php");
$conn = dbconnect();
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 = 'HR Team';
} elseif ($adminposition == 3) {
$type = 'Marketing';
} else {
$type = 'Others';
}
$url_query = "SELECT * FROM tb1_url WHERE url_title='news'";
$res_url = mysqli_query($conn, $url_query);
$fetch_url = mysqli_fetch_object($res_url);
$url_path = $fetch_url->url_path;
?>
<!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">
<style type="text/css">
.des {
text-align: justify;
font-size: 13px;
line-height: 1.4;
height: 190px;
}
</style>
</head>
<!-- Menu sidebar static layout -->
<body>
<!-- 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>Admin User List</h4>
<span>You can add and edit the admin user list 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="#!">Admin User List</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Page-header end -->
<!-- Page body start -->
<div class="page-body">
<div class="col-md-12 text-right mb-3">
<button type="button" class="btn btn-info pl-3 pr-3 mt-3 waves-effect md-trigger" data-modal="modal-11">Add New User</button>
</div>
<div class="col-xl-12 col-md-12">
<div class="row">
<?php
$content_query = "SELECT * FROM tb1_admin ORDER BY admin_id DESC";
$content_res = mysqli_query($conn, $content_query);
$counter = 0;
/* Loop start */
while ($content_row = mysqli_fetch_object($content_res)) {
$counter++;
$admin_id = $content_row->admin_id;
$status = $content_row->status;
$phone = $content_row->phone;
$name = strtolower($content_row->name);
$gender = $content_row->gender;
$position = $content_row->position;
$created_at = $content_row->updated_log;
$updated_log = date('d-m-Y h:i:s A', strtotime($created_at));
$created = $content_row->created_log;
$created_log = date('d-m-Y h:i:s A', strtotime($created));
$user_name = $content_row->user_name;
if ($position == 1) {
$position = 'Main Admin';
} elseif ($position == 2) {
$position = 'HR Team';
} elseif ($position == 3) {
$position = 'Marketing';
} else {
$position = 'Others';
}
?>
<div class="col-xl-4 col-md-12">
<div class="card user-card2">
<div class="card-block text-center">
<h5 class="m-b-15">
<?php
if ($status == 1) {
?>
<i class="fa fa-circle" aria-hidden="true" style="color:#008000" title="Course Active"></i>
<?php
} else {
?>
<i class="fa fa-circle" aria-hidden="true" style="color:#FF0000" title="Course Deactive"></i>
<?php
}
?>
<?php echo ucfirst($name); ?>
</h5>
<hr>
<h6 class=""><?php echo $user_name; ?></h6>
<h6 class=""><?php echo $phone; ?></h6>
<h6 class=""><?php echo $gender; ?></h6>
<a class="text-c-yellow b-b-warning">Position : <?php echo $position; ?></a>
<div class="row justify-content-center m-t-10 b-t-default m-l-0 m-r-0">
<div class="col m-t-15 b-r-default">
<h6 class="text-muted">Created Log</h6>
<h6><?php echo $created_log; ?></h6>
</div>
<div class="col m-t-15">
<h6 class="text-muted">Last Update</h6>
<h6><?php echo $updated_log; ?></h6>
</div>
</div>
</div>
<button class="btn btn-danger btn-block p-t-15 p-b-15 waves-effect md-trigger" data-modal="modal-10" data-id="<?php echo $admin_id; ?>">Edit User</button>
</div>
</div>
<?php
}
?>
</div>
</div>
<hr>
<div class="md-modal md-effect-10" id="modal-10">
<div class="col-md-12 text-right">
<button class="md-close btn" style="background: #fe5d70; position: absolute;left: 99%;color: #fff;cursor: pointer;">X</button>
</div>
<div class="md-content modal-content">
</div>
</div>
<div class="md-modal md-effect-10" id="modal-11">
<div class="col-md-12 text-right">
<button class="md-close btn" style="background: #fe5d70;position: absolute;left: 99%;color: #fff;cursor: pointer;">X</button>
</div>
<div class="md-content">
<h3>Add New User</h3>
<form class="add-form" id="addForm" enctype="multipart/form-data">
<div class="col-md-12">
<div class="card-block">
<input type="hidden" name="type" value="add">
<div class="form-group row">
<label class="col-md-3 col-form-label">Name </label>
<div class="col-md-9">
<input type="text" class="form-control" id="user_name" name="user_name" required>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label">Mobile </label>
<div class="col-md-9">
<input type="text" class="form-control" id="user_phone1" name="user_phone" required>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label" for="priority">Gender</label>
<div class="col-md-9">
<select type="text" class="form-control" id="user_gender1" name="user_gender" required>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label" for="priority">Status</label>
<div class="col-md-9">
<select type="text" class="form-control" id="status" name="status" required>
<option value="1">Active</option>
<option value="2">Inactive</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-3" for="user_phone">Position</label>
<div class="col-md-9">
<select type="text" class="form-control" id="user_position1" name="user_position" required>
<option value="1">Main Admin</option>
<option value="2">HR Team</option>
<option value="3">Marketing</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label">User Name </label>
<div class="col-md-9">
<input type="text" class="form-control" id="username" name="username">
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label">Password </label>
<div class="col-md-9">
<input type="text" class="form-control" id="user_password1" name="user_password" required>
</div>
</div>
</div>
</div>
<div class="col-md-12 text-center">
<button type="submit" class="btn btn-success text-bold" id="sub1-btn" style="width: -webkit-fill-available;">Submit</button>
</div>
</form>
</div>
</div>
<div class="md-overlay"></div>
</div>
<!-- Page body end -->
</div>
<div id="styleSelector">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Required Jquery -->
<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>
<!-- jquery slimscroll js -->
<script type="text/javascript" src="plugin/jquery-slimscroll/jquery.slimscroll.js"></script>
<!-- modernizr js -->
<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/modal.js"></script>
-->
<!-- modalEffects js nifty modal window effects -->
<script type="text/javascript" src="assets/js/modalEffects.js"></script>
<script type="text/javascript" src="assets/js/classie.js"></script>
<!-- jquery file upload js -->
<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>
<!-- Custom js -->
<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 type="text/javascript">
$('.md-trigger').click(function() {
var id = $(this).attr('data-id');
$.ajax({
url: "useredit_model.php?id=" + id,
cache: false,
success: function(result) {
$(".modal-content").html(result);
}
});
});
</script>
<script type="text/javascript">
$("#addForm").submit(function(e) {
e.preventDefault();
var form = $('#addForm')[0];
var formData = new FormData(form);
event.preventDefault();
$("#sub1-btn").attr("disabled", true);
$.ajax({
type: 'POST',
url: 'ajax/user_add',
processData: false,
contentType: false,
dataType: "json",
data: formData,
success: function(data) {
if (data == 'done') {
swal({
title: 'Added Successfully!',
text: "User 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) {
swal({
title: 'Internal Sever Error!',
text: "Try again",
icon: 'warning',
closeOnEsc: false,
closeOnClickOutside: false,
})
},
});
});
</script>
</body>
</html>
Zerion Mini Shell 1.0