Skip to content

Commit

Permalink
admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
harshita-2003 committed Jul 29, 2023
1 parent 5c7a7fc commit 0c5206a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Admins/ajax/settings_crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
require('../inc/essentials.php');
adminlogin();

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

$q = "SELECT * FROM `settings` WHERE `sr_no`=?";
$values = [1];
$res = select($q,$values,"i");
$res = select($q , $values , "i");

$data = mysqli_fetch_assoc($res);
$json_data = json_encode($data);
Expand Down
4 changes: 2 additions & 2 deletions Admins/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ body{
box-shadow: 2px 3px 4px rgb(216, 216, 216);
}

.custom-alert{
/* .custom-alert{
position: fixed;
top:25px;
right:25px;
}
} */

#dashboard-bar{
position: fixed;
Expand Down
2 changes: 1 addition & 1 deletion Admins/inc/essentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function alert($type,$msg){
$bs_class = ($type=="warning") ? "alert-warning" : "alert-danger";

echo <<<alert
<div class="alert $bs_class alert-dismissible fade show custom-alert" role="alert" style="position:fixed;">
<div class="alert $bs_class alert-dismissible fade show custom-alert" role="alert" style="position:fixed;top:25px;right:25px;">
<strong class="me-3">$msg</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Admins/inc/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<a class="nav-link text-white" href="#">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Rooms</a>
<a class="nav-link text-white" href="rooms.php">Rooms</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Users</a>
Expand Down
18 changes: 18 additions & 0 deletions Admins/rooms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel-Rooms</title>
<?php require('inc/links.php')?>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<?php require('inc/header.php')?>
</body>
</html>
18 changes: 12 additions & 6 deletions Admins/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

<style>
#dashboard-bar{
position: fixed;
Expand Down Expand Up @@ -86,9 +89,9 @@
</div>

<h6 class="card-subtitle mb-1 fw-bold">Site title</h6>
<p class="card-text">content.</p>
<p class="card-text" id="site-title">content.</p>
<h6 class="card-subtitle mb-1 fw-bold">About Us</h6>
<p class="card-text">content.</p>
<p class="card-text" id="site-about">content.</p>
</div>
</div>
</div>
Expand All @@ -103,16 +106,19 @@

function get_general(){

let site_title;
let site_about;
let site_title = document.getElementById('site-title');
let site_about = document.getElementById('site-about');

let xhr = new XMLHttpRequest();
xhr.open("POST","ajax/settings_crud.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

xhr.onload =function(){
general_data = this.responseText;
console.log(general_data);
general_data = JSON.parse(xhr.responseText);
// console.log(general_data);

site_title.innerText = general_data.site_title;
site_about.innerText = general_data.site_about;
}

xhr.send('get-general');
Expand Down

0 comments on commit 0c5206a

Please sign in to comment.