PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
require 'connection.php';
if(isset($_POST["login"])){
//echo var_dump ($_POST);
$email =$_POST["email"];
$password =$_POST["password"];
$encrpt_password = md5($password);
//chech if user exist
$sql_check = "SELECT * FROM user WHERE email='$email' AND password = '$encrpt_password'";
$query_check = mysqli_query($connection, $sql_check);
if($result=mysqli_fetch_assoc($query_check)){
//log in to the dashboard
echo "Logged in successfully... redirecting...";
$_SESSION["user"] = $result;
?>
<script>
swal({
title: "Welcome!",
text: "Login successfull!!",
icon: "success",
button: "Ok",
type: "success",
timer: "6000",
}).then(function() {
window.location = "index.php";
});
</script>
<?php
} else{
// user not found
die("<script>
alert('Opps! you have enterd an incorrect login details, pls provide a correct detail')
document .location.href= 'login.php';
</script>");
}
}
if(isset($_POST["add-cat"])){
//echo var_dump($_POST);
$category = $_POST["name"];
//insert to database
$sql ="INSERT INTO category (name) VALUES (' $category ')";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Category Added Successfuly";
}else{
$error ="Error Adding Category";
}
}
// delete catergory
if(isset($_GET["delete_cat"])){
$id =$_GET["delete_cat"];
$sql ="DELETE FROM category WHERE id ='$id'";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Category Deleted Successfuly";
}else{
$error ="Error Deleting Category";
}
}
// edit category
if(isset($_POST["Edit_cat"])){
$cat =$_POST["cat"];
$id =$_POST["id"];
$sql ="UPDATE category set name= '$cat' WHERE id='$id'";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Category UPDATE Successfuly";
}else{
$error ="Error UPDATING Category";
}
}
//add booking type
if(isset($_POST["add_type"])){
//echo var_dump($_POST);
$name = $_POST["type"];
$price = $_POST["price"];
//insert to database
$sql ="INSERT INTO `type` (`name`, `price`) VALUES ('$name', '$price');";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Booking type Added Successfuly";
}else{
$error ="Error Adding Booking type";
}
}
// delete Type of booking
if(isset($_GET["delete_type"])){
$id =$_GET["delete_type"];
$sql ="DELETE FROM type WHERE id ='$id'";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Boking Type Deleted Successfuly";
}else{
$error ="Error Deleting Booking Type";
}
}
// edit type
if(isset($_POST["Edit_cat"])){
$name =$_POST["type"];
$price =$_POST["price"];
$id =$_POST["id"];
$sql ="UPDATE `type` SET `name` = '$name', `price` = '$price' WHERE `type`.`id` = $id;";
$query =mysqli_query($connection, $sql);
If($query){
$success ="Booking type UPDATE Successfuly";
}else{
$error ="Error UPDATING Booking Type";
}
}
// add walleat
if(isset($_POST["add_crypto"])){
//echo var_dump($_POST);
$crypto =$_POST["crypto"];
$wallet =$_POST["wallet"];
$sql = "INSERT INTO wallet (`name`, `address`) VALUES ('$crypto', '$wallet')";
$query =mysqli_query($connection, $sql);
if($query){
echo "Done";
$success="Wallet added successfuly";
}else{
echo "Not Done";
$error="Error Adding Wallet";
}
}
//Delete wallet
if(isset($_GET["delete_wallet"])){
$id =$_GET["delete_wallet"];
$sql= "DELETE FROM wallet WHERE id=$id";
$query = mysqli_query($connection, $sql);
if($query){
$success="Wallet Deleted successfuly";
}else{
$error="Error Deleting Wallet";
}
}
//delete portfolio
if (isset($_GET["delete_celeb"]) && !empty($_GET["delete_celeb"])){
$id= $_GET["delete_celeb"];
$SQL= "SELECT * FROM celeb WHERE id = $id ";
$query = mysqli_query($connection, $SQL);
$resul=mysqli_fetch_assoc($query);
$image = $resul["image"];
if(unlink("$image")){
$sql= "DELETE FROM celeb WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo " <script>
alert('Celebrity deleted Sucessfuly' );
</script>";
}else{
echo"
<script>
alert('Unable to Delete Celebrity' );
</script>";
}
}
}
//Activate folio
if (isset($_GET["approve"]) && !empty($_GET["approve"])){
$id= $_GET["approve"];
$sql= "UPDATE . portfolio SET status ='1' WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo "
<script>
alert('Portfolio Approved ' );
</script>";
}else{
echo"
<script>
alert('system error' );
</script>";
}
}
//DEActivate folio
if (isset($_GET["deactivate"]) && !empty($_GET["deactivate"])){
$id= $_GET["deactivate"];
$sql= "UPDATE . portfolio SET status ='0' WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo "
<script>
alert('Portfolio Deactivated ' );
</script>";
}else{
echo"
<script>
alert('Unable to Deactivated' );
</script>";
}
}
if (isset($_GET["delete_category"]) && !empty($_GET["delete_category"])){
$id= $_GET["delete_category"];
$sql= "DELETE FROM category WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo"
<script>
alert('Department Deleted ' );
</script>";
}else{
$error= "Unable to delete Category" ;
}
}
//Edit portfolio category
if(isset($_POST["edit_category"])){
$name = $_POST["name"];
//get ID to
$edit_id =$_GET["edit_id"];
//sqli
$SQL = "UPDATE . category SET name ='$name' WHERE id= '$edit_id'";
$query= mysqli_query($connection, $SQL);
if($query){
echo"
<script>
alert('portfolio category Updated successfuly' );
</script>";
}else{
echo"
<script>
alert('Unable to Update category ' );
</script>";
}
}
// add service
if(isset($_POST["service"])){
$title =$_POST["title"];
$content =$_POST["content"];
$sql ="INSERT INTO `service` ( `name`, `content`) VALUES ( '$title', '$content')" ;
$query= mysqli_query($connection, $sql);
if($query){
echo"
<script>
alert('Serive Addedd' );
</script>";
}else{
echo"
<script>
alert('Error Adding Service' );
</script>";
}
}
//edit service
if(isset($_POST["edit_service"])){
$name = $_POST["title"];
$content = $_POST["content"];
//get ID to
$edit_id = $_POST["id"];
//sqli
$SQL = "UPDATE `service` SET `name` = '$name', `content` = '$content' WHERE `service`.`id` = ' $edit_id'";
$query= mysqli_query($connection, $SQL);
if($query){
echo"
<script>
alert('Service Updated' );
document .location.href= 'service.php';
</script>";
}else{
echo"
<script>
alert('Unable to Updated Service' );
</script>";
}
}
// delete seervie
if (isset($_GET["delete_Serive"]) && !empty($_GET["delete_Serive"])){
$id= $_GET["delete_Serive"];
$sql= "DELETE FROM service WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo " <script>
alert('Serive deleted' );
</script>";
}else{
echo " <script>
alert('Unable to Delete Serive ' );
</script>";
}
}
//Approve service
if(isset($_GET["approve_service"])){
$id = $_GET["approve_service"];
// sql section
$sql = "UPDATE . service SET status='1' WHERE id= '$id'";
$query= mysqli_query($connection, $sql);
if ($query){
echo " <script>
alert('Serive Activated! now live' );
</script>";
}else{
echo " <script>
alert('Serive Not Activated!' );
</script>";
}
}
//deactivate service
if(isset($_GET["deactivate_service"])){
$id = $_GET["deactivate_service"];
// sql section
$sql = "UPDATE `service` SET `status` = '0' WHERE `service`.`id` = '$id';";
$query= mysqli_query($connection, $sql);
if ($query){
echo " <script>
alert('Servive Deactivated! no longer live' );
</script>";
}else{
echo " <script>
alert('Serive Not Deactivated! still live ' );
</script>";
}
}
// add testimonial
if(isset($_POST["logo"])){
// echo var_dump($_POST);
//upload to forder
$target_dir = "uploads/web/";
$basename= basename($_FILES["image"]["name"]);
$upload_file = $target_dir.$basename;
$imageFileType = strtolower(pathinfo($upload_file,PATHINFO_EXTENSION));
$uploadOk = "1";
//Check if file already exists
//check file size
if ($_FILES["image"]["size"] > 454675) {
echo "
<script>
alert('Sorry, the image you selected is too large, kindly select another image or reduce to size of the image.');
</script>";
$uploadOk = "0";
}
//check file type
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "
<script>
alert('Sorry, only JPG, JPEG, PNG & GIF files are allowed.');
</script>";
$uploadOk = "0";
}
//check final status
if ( $uploadOk == "0") {
//if everything is ok, try to upload file
$uploadOk = "1";
} else {
//move to folder
$move = move_uploaded_file($_FILES["image"]["tmp_name"], $upload_file);
// check if moved
if(isset($move)){
$url=$upload_file;
$id =$_POST["user"];
$sql= "UPDATE `web` SET `logo` = '$url' WHERE `web`.`user_id` = $id; ";
$query= mysqli_query($connection, $sql);
if($query){
echo "<script>
alert('Site Logo uploaded successfuly,');
</script>";
} else {
echo "<script>
alert('sorry an error occuded');
</script>";
}
}
}
}
//favicon
if(isset($_POST["favicon"])){
// echo var_dump($_POST);
//upload to forder
$target_dir = "uploads/web/";
$basename= basename($_FILES["image"]["name"]);
$upload_file = $target_dir.$basename;
$imageFileType = strtolower(pathinfo($upload_file,PATHINFO_EXTENSION));
$uploadOk = "1";
//Check if file already exists
//check file size
if ($_FILES["image"]["size"] > 454675) {
echo "
<script>
alert('Sorry, the image you selected is too large, kindly select another image or reduce to size of the image.');
</script>";
$uploadOk = "0";
}
//check file type
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "
<script>
alert('Sorry, only JPG, JPEG, PNG & GIF files are allowed.');
</script>";
$uploadOk = "0";
}
//check final status
if ( $uploadOk == "0") {
//if everything is ok, try to upload file
$uploadOk = "1";
} else {
//move to folder
$move = move_uploaded_file($_FILES["image"]["tmp_name"], $upload_file);
// check if moved
if(isset($move)){
$url=$upload_file;
$id =$_POST["user"];
$sql= "UPDATE `web` SET `favicon` = '$url' WHERE `web`.`user_id` = $id; ";
$query= mysqli_query($connection, $sql);
if($query){
echo "<script>
alert('Site Favicon uploaded successfuly,');
</script>";
} else {
echo "<script>
alert('sorry an error occuded');
</script>";
}
}
}
}
//update hero backgroud
if(isset($_POST["hero"])){
// echo var_dump($_POST);
//upload to forder
$target_dir = "uploads/web/";
$basename= basename($_FILES["hero"]["name"]);
$upload_file = $target_dir.$basename;
$imageFileType = strtolower(pathinfo($upload_file,PATHINFO_EXTENSION));
$uploadOk = "1";
//Check if file already exists
//check file size
if ($_FILES["image"]["size"] > 1054675) {
echo "
<script>
alert('Sorry, the image you selected is too large, kindly select another image or reduce to size of the image.');
</script>";
$uploadOk = "0";
}
//check file type
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "
<script>
alert('Sorry, only JPG, JPEG, PNG & GIF files are allowed.');
</script>";
$uploadOk = "0";
}
//check final status
if ( $uploadOk == "0") {
//if everything is ok, try to upload file
$uploadOk = "1";
} else {
//move to folder
$move = move_uploaded_file($_FILES["hero"]["tmp_name"], $upload_file);
// check if moved
if(isset($move)){
$url=$upload_file;
$id =$_POST["user"];
$sql= "UPDATE `web` SET `hero` = '$url' WHERE `web`.`user_id` = $id; ";
$query= mysqli_query($connection, $sql);
if($query){
echo "<script>
alert('Site Hero background uploaded successfuly,');
</script>";
} else {
echo "<script>
alert('sorry an error occuded');
</script>";
}
}
}
}
//website information
if(isset($_POST["site"])){
$id =$_POST["user"];
$name =$_POST["name"];
$desc =$_POST["desc"];
$email =$_POST["email"];
$facebook =$_POST["facebook"];
$twitter =$_POST["twitter"];
$linkedin =$_POST["Link"];
$insta =$_POST["insta"];
$what =$_POST["what"];
$sql= "UPDATE `web` SET `name` = '$name', `description` = ' $desc', `facebook` = '$facebook ', `instagram` = '$insta', `linked` = '$linkedin', `twitter` = '$twitter', `email` = ' $email', `whatsapp` = '$what';
";
$query= mysqli_query($connection, $sql);
if($query){
echo "<script>
alert('Site information updated successfuly,');
</script>";
} else {
echo "<script>
alert('sorry an error occuded');
</script>";
}
}
if(isset($_POST["pass"])){
// echo var_dump ($_POST);
$pass =$_POST["password"];
$encrpt_pass=md5($pass);
$encrpt_newpassword =md5($_POST["newpassword"]);
$encrpt_renewPassword =md5($_POST["renewpassword"]);
$id =$_POST["id"];
//chech if current password is correct
$sql_check = "SELECT * FROM user WHERE id='$id' ";
$query_check = mysqli_query($connection, $sql_check);
$check=mysqli_fetch_assoc($query_check);
$prepass=$check["password"];
//chech if previous password is correct
if($prepass == $encrpt_pass ){
}else{
die("<script>
alert('Opps! you have enterd an incorrect password, pls provide a correct password')
document .location.href= 'users-profile.php';
</script>");
}
// check password confimation
if ($encrpt_newpassword==$encrpt_renewPassword) {
// Passwords match
$sql= "UPDATE `user` SET `password` = '$encrpt_newpassword' WHERE id =$id; ";
$query= mysqli_query($connection, $sql);
if($query){
echo "<script>
alert('Password updated successfuly,');
</script>";
} else {
echo "<script>
alert('sorry an error occuded');
</script>";
}
} else {
// Passwords do not match
die("<script>
alert('New Password mismatch')
document .location.href= 'users-profile.php';
</script>");
}
}
// activate site
if (isset($_GET["action"]) && !empty($_GET["action"])){
$action= $_GET["action"];
$sql= "UPDATE web set status= 1";
$query= mysqli_query($connection, $sql);
if ($query){
echo "
<script>
alert('Website Activated Successfully. your Frontend is now live' );
</script>";
}else{
echo"
<script>
alert('Unable to Activate' );
</script>";
}
}
// revoke site
if (isset($_GET["revoke"]) && !empty($_GET["revoke"])){
$action= $_GET["revoke"];
$sql= "UPDATE web set status= 0";
$query= mysqli_query($connection, $sql);
if ($query){
echo "
<script>
alert('Website Revoked Successfully. your Frontend is now on maintainance mode' );
</script>";
}else{
echo"
<script>
alert('Unable to revoke' );
</script>";
}
}
?>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E