File "home-20241121222504.php"

Full Path: /home/u275821840/domains/padmaclasses.in/public_html/panel/home-20241121222504.php
File size: 3.53 KB
MIME-type: text/x-php
Charset: utf-8

<?php
ob_start();
session_start();
include_once('../connect.php');

if(!isset($_SESSION['username']))
{
  header('location:login.php');
}
?>


<!DOCTYPE html>
<html>
<head>
  <title>PCC</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>  

</head>
   
<body>
<?php include_once("edit_menu.php"); 

$sql = mysqli_query($db,"select * from home");
$sql_count = mysqli_num_rows($sql);
$row = mysqli_fetch_array($sql);
$about = $row['aboutus'];
?>


<div class='container-fluid'>
  <br>
  <form action="#" method="POST">
  <table class="table table-condensed table-bordered">

  <tr>
        <td><label> Enter id </label></td>
        <td>
        <input type="number" class="form-control" name="id">
        </td>
    </tr>

    <tr>
        <td><label> Enter About Us </label></td>
        <td>
        <!-- <input size="100" type="text" class="form-control" name="aboutus"> -->
        <textarea  cols="100" rows="10" name='aboutus'></textarea>
        </td>
    </tr>

    <tr>
        <td></td>  
       <!-- <td><input type="submit" class="form-control btn-success" name="submit" value="Submit"> -->
      <td><input type="submit" class="form-control btn-success" name="update" value="Update"> </td>
  </tr>
    </table>
  </form>


<div class='container-fluid'>
<form method="POST">
    <table class='table table-condensed table-striped table-bordered'>
<tr>
<td>S. </td>
<td>Old About-Us Message</td>
<td>New About-Us Message. </td>
<td>Edit</td>
</tr>

<tr>
<td> 1 </td>
<td> <?php echo "$about" ?> </td>
<td> -------- </td>
<td> <input class= "btn-primary" type="submit" name="edit" value="Edit"> <input class="btn-danger" type="submit" name="del" value="Del"></td>
</tr>

<tr>
<td> 2 </td>
<td> <?php echo "$about" ?> </td>
<td> ---------- </td>
<td> <input class="btn-primary" type="submit" name="edit" value="Edit"> <input class="btn-danger" type="submit" name="del" value="Del"></td>
</tr>

</table>
</form>
</div>
</body>
</html>

<!-- <?php
if(isset($_POST['submit']))
{
$about=$_POST['aboutus'];

$insert = "INSERT INTO home (aboutus) VALUES ('$about')";
$result= mysqli_query($db,$insert) or die(mysqli_error($db));

if ($result)
{
  echo "Submitted";
}
else
{
echo " Not ok";
}
}
?> -->


<?php
if(isset($_POST['update']))
{
  $id= $_POST['id'];
  $about=$_POST['aboutus'];

$update= "UPDATE home SET aboutus='$about' WHERE id='$id'";
$res= mysqli_query($db, $update) or die(mysqli_error($db));

if ($res)
{
  echo "Updated";
}
else
{
echo "Not Updated";
}
}
?>

<?php
  if(isset($_POST['del']))
    {
      $del = $_POST['del'];

        // //delete from folder 
        //  $sql = mysqli_query($db,"select image from blogs where id='$id'");
        //  $sqlrw = mysqli_fetch_array($sql);
        //  $delfile = $sqlrw['image'].'.jpg';
        //  $add = 'blogs/'.$delfile;
        //  unlink("$add");
        // //

      $sql = mysqli_query($db,"DELETE FROM home where id = '$del'") or die(mysqli_error($db));
      header("location:blog_entry.php");
    }
?>