From b55a0832fc01d5d10cead2f09a933bee2504aa25 Mon Sep 17 00:00:00 2001 From: harshita-2003 Date: Mon, 24 Jul 2023 00:24:02 +0530 Subject: [PATCH] dashboard.php made --- Admins/dashboard.php | 26 ++++++++++++++++++++++++++ Admins/inc/essentials.php | 35 ++++++++++++++++++++++++++++++++++- Admins/index.php | 15 ++++++++++++--- Admins/logout.php | 8 ++++++++ 4 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 Admins/dashboard.php create mode 100644 Admins/logout.php diff --git a/Admins/dashboard.php b/Admins/dashboard.php new file mode 100644 index 0000000..f0c4ff8 --- /dev/null +++ b/Admins/dashboard.php @@ -0,0 +1,26 @@ + + + + + + + + Admin Panel-dashboard + + + + +
+

ADMIN PANEL

+ LOG OUT +
+ + + + + + + \ No newline at end of file diff --git a/Admins/inc/essentials.php b/Admins/inc/essentials.php index 7c9c4e0..1543ff0 100644 --- a/Admins/inc/essentials.php +++ b/Admins/inc/essentials.php @@ -1,8 +1,41 @@ + + + window.location.href='index.php'; + ; + "; + } + session_regenerate_id(true); + } + + function redirect($url){ + echo" + + "; + } + function alert($type,$msg){ + + $bs_class = ($type=="success") ? "alert-success" : "alert-danger"; + $bs_class = ($type=="warning") ? "alert-warning" : "alert-danger"; + echo << + diff --git a/Admins/index.php b/Admins/index.php index 325d83b..72586a4 100644 --- a/Admins/index.php +++ b/Admins/index.php @@ -1,6 +1,11 @@ @@ -64,10 +69,14 @@ $res = select($query,$values,$datatype); // print_r($res); if($res->num_rows==1){ - echo"got user"; + // echo"got user"; + $row = mysqli_fetch_assoc($res); + $_SESSION['adminLogin'] = true; + $_SESSION['adminId'] = $row['sr_no']; + redirect('dashboard.php'); } else{ - alert('error','Login failed - Invalid Credentials'); + alert('warning','Login failed - Invalid Credentials'); } } ?> diff --git a/Admins/logout.php b/Admins/logout.php new file mode 100644 index 0000000..796fb63 --- /dev/null +++ b/Admins/logout.php @@ -0,0 +1,8 @@ + \ No newline at end of file