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 = 'Accounts';
} elseif ($adminposition == 3) {
$type = 'Marketing';
} else {
$type = 'Others';
}
$flash_query = "SELECT * FROM tb1_flashnews WHERE flash_id=1 ";
$flash_url = mysqli_query($conn, $flash_query);
$fetch_flash = mysqli_fetch_object($flash_url);
$flash_id = $fetch_flash->flash_id;
$flash_news = $fetch_flash->flash_news;
$status = $fetch_flash->status;
$crm_id = $fetch_flash->crm_id;
$delete_flag = $fetch_flash->delete_flag;
$updated_at = $fetch_flash->updated_log;
$updated_log = date('d-m-Y h:i:s A', strtotime($updated_at));
if ($status == 1) {
$color_div = 'panel-success';
$color_bg = 'bg-success';
} else {
$color_div = 'panel-danger';
$color_bg = 'bg-danger';
}
$crm_query = "SELECT * FROM tb1_admin WHERE admin_id ='$crm_id' ";
$crm_res = mysqli_query($conn, $crm_query);
$crm_row = mysqli_fetch_object($crm_res);
$crm_name = strtolower($crm_row->name);
?>
<!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">
<!-- themify-icons line icon -->
<link rel="stylesheet" type="text/css" href="assets/icon/themify-icons/themify-icons.css">
<!-- ico font -->
<link rel="stylesheet" type="text/css" href="assets/icon/icofont/css/icofont.css">
<!-- feather Awesome -->
<link rel="stylesheet" type="text/css" href="assets/icon/feather/css/feather.css">
<!-- Style.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">
<style>
.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">
<!-- Main-body start -->
<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>Flash News</h4>
<span>You can edit the website flash news 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="#!">Flash News</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Page-header end -->
<!-- Page body start -->
<div class="page-body">
<div class="row">
<div class="col-sm-12">
<!-- Panel card start -->
<div class="card">
<div class="card-block panels-wells">
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
<div class="panel <?php echo $color_div; ?>">
<div class="panel-heading <?php echo $color_bg; ?>">
<div class="row">
<div class="col-md-6">
Current Flash News
</div>
<div class="col-md-6 text-right">
<strong>Last Update : </strong><?php echo $updated_log; ?>
</div>
</div>
</div>
<div class="panel-body">
<p><?php echo $flash_news; ?></p>
<div class="row">
<div class="col-md-6">
<?php
if ($status == 1) {
?>
<button class="btn btn-danger pl-3 pr-3 mt-3" type="button" id="inactive">Click to Inactive</button>
<?php
} else {
?>
<button class="btn btn-success pl-3 pr-3 mt-3" type="button" id="active">Click to Active</button>
<?php
}
?>
</div>
<div class="col-md-6 text-right mt-4">
<h6><strong>Updated By : </strong> <?php echo ucfirst($crm_name) ?> </h6>
</div>
</div>
</div>
</div>
</div>
<!-- end of row -->
</div>
</div>
</div>
<!-- Panel card end -->
</div>
</div>
<!-- Inline Editor start -->
<div class="card">
<div class="card-header">
<h5>Edit Flash News</h5>
<span>Click on text to change it</span>
</div>
<div class="card-block">
<div id="header">
<div id="headerLeft">
<h4 id="flash_header" contenteditable="true" style="font-size: 16px;border: 1pt solid #fe5d70;padding: 10px;">
</h4>
<button class="btn btn-primary pl-3 pr-3 mt-3" type="button" id="flash-btn">Submit</button>
</div>
</div>
</div>
</div>
<!-- Inline Editor end -->
</div>
<!-- Page body end -->
</div>
</div>
<!-- Main-body end -->
</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>
<!-- ck editor -->
<script src="assets/pages/ckeditor/ckeditor.js"></script>
<!-- Custom js -->
<script type="text/javascript" src="assets/pages/ckeditor/ckeditor-custom.js"></script>
<script src="assets/js/pcoded.min.js"></script>
<script src="assets/js/vartical-layout.min.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="assets/js/sweetalert.min.js"></script>
<script type="text/javascript" src="assets/js/script.js"></script>
<script type="text/javascript">
$("#active").on('click', function() {
var type = "active";
var status = "1";
swal({
title: 'Are you sure?',
text: "You want to active this flash news?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3f51b5',
cancelButtonColor: '#ff4081',
confirmButtonText: 'Great ',
closeOnEsc: false,
closeOnClickOutside: false,
buttons: {
cancel: {
text: "No",
value: null,
visible: true,
className: "btn btn-danger",
closeModal: true,
},
confirm: {
text: "Yes",
value: true,
visible: true,
className: "btn btn-primary",
closeModal: true
}
}
}).then((value) => {
if (value == true) {
$.ajax({
url: "ajax/flashnews_action.php",
type: "POST",
data: {
"status": status,
"type": type
},
dataType: "json",
success: function(data) {
if (data == 'done') {
swal({
title: "Successfully Activated!",
text: "The flash news has been successfully activated.",
type: "success",
icon: 'success',
confirmButtonColor: '#3f51b5',
confirmButtonText: 'OK ',
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();
}
})
} else {
swal("Internal Server Error!", "Please try again", "error");
}
},
error: function(xhr, ajaxOptions, thrownError) {
swal("Internal Server Error!", "Please try again", "error");
}
});
} else {
// swal(`The returned value is: ${value}`);
}
});
});
</script>
<script type="text/javascript">
$("#inactive").on('click', function() {
var type = "inactive";
var status = "0";
console.log('m');
swal({
title: 'Are you sure?',
text: "You want to inactive this flash news?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3f51b5',
cancelButtonColor: '#ff4081',
confirmButtonText: 'Great ',
closeOnEsc: false,
closeOnClickOutside: false,
buttons: {
cancel: {
text: "No",
value: null,
visible: true,
className: "btn btn-danger",
closeModal: true,
},
confirm: {
text: "Yes",
value: true,
visible: true,
className: "btn btn-primary",
closeModal: true
}
}
}).then((value) => {
if (value == true) {
$.ajax({
url: "ajax/flashnews_action.php",
type: "POST",
data: {
"status": status,
"type": type
},
dataType: "json",
success: function(data) {
if (data == 'done') {
swal({
title: "Successfully Deleted!",
text: "The flash news has been successfully deactivated.",
type: "success",
icon: 'success',
confirmButtonColor: '#3f51b5',
confirmButtonText: 'OK ',
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();
}
})
} else {
swal("Internal Server Error!", "Please try again", "error");
}
},
error: function(xhr, ajaxOptions, thrownError) {
swal("Internal Server Error!", "Please try again", "error");
}
});
} else {
// swal(`The returned value is: ${value}`);
}
});
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#flash-btn").on('click', function() {
var type = "update";
var flash_news = $('#flash_header').html();
$('#loaderid').removeClass('hideloader');
$("#flash-btn").attr("disabled", true);
$.ajax({
type: "POST",
url: "ajax/flashnews_action",
data: {
"type": type,
"flash_news": flash_news
},
dataType: 'json',
success: function(data) {
$('#loaderid').addClass('hideloader');
if (data == 'done') {
swal({
title: 'Updated Successfully!',
text: "Flash news has been successfully updated",
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();
}
});
} else {
swal({
title: 'Internal Sever Error!',
text: "Try again",
icon: 'warning',
closeOnEsc: false,
closeOnClickOutside: false,
})
}
}
});
});
});
</script>
</body>
</html>
Zerion Mini Shell 1.0