HEX
Server: LiteSpeed
System: Linux in-mum-web921.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: u590867752 (590867752)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: /home/u590867752/domains/artnculture.org/public_html/admin/add-blogs.php
<?php
session_start();
$servername = "localhost";
$username	= "u590867752_nsacorg";
$userpassword = "My@Culture@1947";
$db = "u590867752_artNculture";


$conn = mysqli_connect($servername,$username,$userpassword,$db) or die("not connection stabelist".mysqli_connect_error());

/*if(!$_SESSION['adminName'] && !$_SESSION['adminPassword'] && !$_SESSION['campus'])
{
	header('location:https://www.artnculture.org/admin/index.html');
}

if($_SESSION['campus'] != "Admin" )
{
	header('location:index.php');
}*/

error_reporting(0);

  
 
if (isset($_POST['blog_name'])) {
    $blog_name = $_POST['blog_name'];
    $page_url = str_replace("---", "-", preg_replace("/[^-a-zA-Z0-9s]/", "-", strtolower(trim($blog_name))));
    $metetitle = $_POST['metetitle'];
    $metades = $_POST['metades'];
    $heading = $_POST['heading'];
    $short_des = $_POST['short_des'];
    $long_des = $_POST['long_des'];
    $othur_name = $_POST['othur_name'];
    $date = $_POST['date'];

    // Handle the header image upload
    if ($_FILES['header_image']['error'] === 0) {
        $headerImage = $_FILES['header_image']['tmp_name'];
        $headerImageFileName = $_FILES['header_image']['name'];
        $headerImageTargetFolder = "uploads/"; // Change this folder as needed
        $headerImageTargetPath = $headerImageTargetFolder . $headerImageFileName;

        if (move_uploaded_file($headerImage, $headerImageTargetPath)) {
            // Header image uploaded successfully
        } else {
            // Handle the header image upload error
            echo "Header image upload failed.";
        }
    }

    // Handle regular image upload
    if ($_FILES['image']['error'] === 0) {
        $image = $_FILES['image']['tmp_name'];
        $imageFileName = $_FILES['image']['name'];
        $imageTargetFolder = "uploads/"; // Change this folder as needed
        $imageTargetPath = $imageTargetFolder . $imageFileName;

        if (move_uploaded_file($image, $imageTargetPath)) {
            // Regular image uploaded successfully
        } else {
            // Handle the regular image upload error
            echo "Regular image upload failed.";
        }
    }

    // Insert data into the database (including image filenames)
    $insert = "INSERT INTO blog (page_url, blog_name, metetitle, metades, heading, header_image, image, short_des, long_des, othur_name, date, status)
               VALUES ('$page_url', '$blog_name', '$metetitle', '$metades', '$heading', '$headerImageFileName', '$imageFileName', '$short_des', '$long_des', '$othur_name', '$date', '1')";

               //print_r($insert);
               //die();

    if (mysqli_query($conn, $insert)) {
        $sess_msg = $pagename . " Added Successfully.";
        echo("<script>window.location='view-blogs.php';</script>");
    } else {
        // Handle the database insertion error
        echo "Error: " . mysqli_error($conn);
    }
}
 

if (isset($_GET['id'])) {

   $up_id = $_GET['id'];
   $update_select=mysqli_query($conn,"select * from blog where id='".$up_id."'");
   //print_r($update_select);
   //die();
   while($row=mysqli_fetch_assoc($update_select)){
         $id=$row['id'];
         $page_url=$row['page_url'];
         $blog_name=$row['blog_name'];
         $metetitle=$row['metetitle'];
         $metades=$row['metades'];
         $heading=$row['heading'];
         $image=$row['image'];
         $header_image=$row['header_image'];
         $short_des=$row['short_des'];
         $long_des=$row['long_des'];
         $othur_name=$row['othur_name'];
         $date=$row['date'];
   }
   
}

 
 
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="../images/logo-hai-clbrtn.png" type="image/x-icon" >
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../codes/css/home.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../codes/css/inside.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../codes/css/menu.css" media="all" />

<script src="https://www.himanshuartinstitute.com/codes/glry/js/jquery.min.js"></script>
<!-- Menu -->
<script src="https://www.himanshuartinstitute.com/admin/css/mnu/menu.js" ></script>
<script src="https://www.himanshuartinstitute.com/admin/css/mnu/jquery.js" ></script>
<link href="https://www.himanshuartinstitute.com/admin/css/mnu/css-menu.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
    <style type="text/css">
    	.borderr{border: 1px solid #64646433;
    padding: 10px;
    margin-left: -13px;
    margin-top: 20px;}
    </style>
  </head>
<header>
<div class="hdr-admin">
<div class="adm-lft">
<div class="hai"><a href="index.html"><span>Himanshu</span><span>Art</span><span>Institute</span></a></div>
</div>
<div class="adm-rgt">
<div id="menuiconb"><i class="fa fa-th" aria-hidden="true"></i></div>
</div>

</div>
</header>
<div class="clearfix"></div>

<h2 class="adm-title">Add Blogs</h2>


      <div class="row">
<div class="borderr">
        <a href="view-blogs.php" class="btn btn-primary">View All Blogs</a>
<p><?=$sess_msg?></p>
      </div>
    </div>
    </div>
  	<div class="container mt-5">

   <?php

   $add=$_GET['add'];
   if (isset($_GET['add'])) {?>
      
    
  
  		<form method="POST" enctype="multipart/form-data" class="row g-3 needs-validation" >

  			<div class="row border">
  				<div class="col-md-9">
<div class="row">
<div class="col-md-6">
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Heading</label>
<input type="text" class="form-control" name="blog_name" id="validationCustom01" placeholder="Enter Blog Heading" required>
</div>
</div>
<div class="col-md-6">
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Page Url</label>
<input type="text" name="page_url" class="form-control" style="cursor: not-allowed; opacity: 1;" id="exampleFormControlInput1" placeholder="">
</div>
</div>
</div>
<div class="col-md-12">
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Meta Title</label>
<input type="text" class="form-control" name="metetitle" id="exampleFormControlInput1" placeholder="Enter Meta Title">
</div>
</div>

<div class="col-md-12">
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Meta Description</label>
<input type="text" class="form-control" name="metades" id="exampleFormControlInput1" placeholder="Enter Meta Description ">
</div>
</div>

<div class="row">
<div class="col-md-12">
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Blogs Heading</label>
<input type="text" class="form-control" name="heading" id="exampleFormControlInput1" placeholder="Enter Blog Heading" required>
</div>
</div>

</div>

<div class="mb-3">
  <label for="exampleFormControlTextarea1"  class="form-label">Short Description</label>
  <textarea class="form-control" name="short_des" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>

<div class="mb-3">
  <label for="exampleFormControlTextarea1"  class="form-label">Long Description</label>
  <textarea class="form-control" name="long_des" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>



  				</div>
  				<div class="col-md-3">
  					<div class="row">
  						
  							<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Outher Name</label>
<input type="text" class="form-control"  name="othur_name" id="exampleFormControlInput1" placeholder="Enter Name" required>
</div>
  						 
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Images</label>
<input type="file" class="form-control" name="image" id="exampleFormControlInput1" placeholder="">

</div>
 
 
	<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Header Images</label>
<input type="file" class="form-control" name="header_image" id="exampleFormControlInput1" placeholder="" >

</div>
  							<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Date</label>
<input type="date" class="form-control"  name="date" id="exampleFormControlInput1" placeholder="Enter Name">

</div>

 
  					</div>

  				</div>
 <button class="btn btn-primary" type="submit">Submit form</button>
</div>

</form>
<?php }?>

<?php
$id=$_GET['id'];
  if (isset($_GET['id'])) {?>
      <form method="POST" action="https://www.himanshuartinstitute.com/admin/code.php" enctype="multipart/form-data" class="row g-3 needs-validation" >

        <div class="row border">
          <div class="col-md-9">
<div class="row">
<div class="col-md-6">
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Heading</label>
<input type="text" class="form-control" value="<?=$blog_name?>" name="blog_name" id="validationCustom01" placeholder="Enter Blog Heading" required>
</div>
</div>
<input type="hidden" class="form-control" value="<?=$id?>" name="id" id="validationCustom01" >
<div class="col-md-6">
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Page Url</label>
<input type="text" name="page_url" value="<?=$page_url?>" class="form-control" style="cursor: not-allowed; opacity: 1;" id="exampleFormControlInput1" placeholder="">
</div>
</div>
</div>
<div class="col-md-12">
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Meta Title</label>
<input type="text" class="form-control" value="<?=$metetitle?>" name="metetitle" id="exampleFormControlInput1" placeholder="Enter Meta Title">
</div>
</div>

<div class="col-md-12">
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Meta Description</label>
<input type="text" class="form-control" value="<?=$metades?>" name="metades" id="exampleFormControlInput1" placeholder="Enter Meta Description ">
</div>
</div>

<div class="row">
<div class="col-md-12">
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Blogs Heading</label>
<input type="text" class="form-control" value="<?=$heading?>" name="heading" id="exampleFormControlInput1" placeholder="Enter Blog Heading" required>
</div>
</div>

</div>

<div class="mb-3">
  <label for="exampleFormControlTextarea1"  class="form-label">Short Description</label>
  <textarea class="form-control" name="short_des" id="exampleFormControlTextarea1" rows="3"><?=$short_des?></textarea>
</div>

<div class="mb-3">
  <label for="exampleFormControlTextarea1"  class="form-label">Long Description</label>
  <textarea class="form-control" name="long_des" id="exampleFormControlTextarea1" rows="3"><?=$long_des?></textarea>
</div>



          </div>
          <div class="col-md-3">
            <div class="row">
              
                <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Outher Name</label>
<input type="text" class="form-control" value="<?=$othur_name?>" name="othur_name" id="exampleFormControlInput1" placeholder="Enter Name" required>
</div>
               
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Images</label>
<input type="file" class="form-control" value="<?=$image?>" name="image" id="exampleFormControlInput1" placeholder="">

<img src="uploads/<?=$image?>" style="width: 100px; height: 100px;">
</div>
 
 
  <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Header Images</label>
<input type="file" class="form-control" value="<?=$header_image?>" name="header_image" id="exampleFormControlInput1"  >
<img src="uploads/<?=$header_image?>" style="width: 100px; height: 100px;">
</div>
                <div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Date</label>
<input type="date" class="form-control"  name="date" id="exampleFormControlInput1" placeholder="Enter Name">
<p><?php 
    $dateString = $date;
 $formattedDate = date("d F Y",strtotime($dateString));

echo $formattedDate;
?></p>
</div>

 
            </div>

          </div>
 <button class="btn btn-primary" name="update" value="add" type="submit">Add Now</button>
</div>

</form>
 <?php }?>
</div>
<br><br><br><br><br><br><br>
<div class="clearfix"></div>
<div class="menuitems" id="menuitems"></div>
<footer>
<div  class="adm-ftr">
<div class="ftr-pnl" align="center">
COPYRIGHT © HIMANSHU ART INSTITUTE,  ALL RIGHTS RESERVED
</div>
</div>
</footer>




    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous">
    	// Example starter JavaScript for disabling form submissions if there are invalid fields
(() => {
  'use strict'

  // Fetch all the forms we want to apply custom Bootstrap validation styles to
  const forms = document.querySelectorAll('.needs-validation')

  // Loop over them and prevent submission
  Array.from(forms).forEach(form => {
    form.addEventListener('submit', event => {
      if (!form.checkValidity()) {
        event.preventDefault()
        event.stopPropagation()
      }

      form.classList.add('was-validated')
    }, false)
  })
})()
    </script>
<script src="ckeditor/ckeditor.js"></script>
<script>
	CKEDITOR.replace("short_des");
	CKEDITOR.replace("long_des");
</script>

<script>
function hideR()
{
	document.getElementById("record").style.display="none";
}

var record = document.getElementById("record");
window.addEventListener('mouseup',function(event){
	
	if(event.target != record && event.target.parentNode != record)
	{
		record.style.display="none";
	}
});

</script>

  </body>
</html>