Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
panel
:
blog_entry-20241121214934.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php ob_start(); session_start(); include_once('../connect.php'); if(!isset($_SESSION['username'])) { header('location:login.php'); } ?> <?php $subject = $blog = $links = ''; $id = 0; $date = date('Y-m-d'); if(isset($_GET['edit'])) { $id = $_GET['edit']; $sql = mysqli_query($db,"SELECT * FROM blogs where id = '$id'") or die(mysqli_error($db)); $row = mysqli_fetch_array($sql); $subject = $row['subject']; $date = $row['date']; $blog = $row['blog']; $links = $row['links']; } ?> <!DOCTYPE html> <html> <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> <body> <?php include_once("edit_menu.php"); ?> <h5 class="alert alert-info">NOTICE</h5> <table class="table table-condensed table-bordered"> <form action='' method="post" enctype="multipart/form-data"> <tr> <td width="10%"><b>Date</b></td> <td><input type='date' name='date' class="form-control" value="<?php echo $date ?>"></td> </tr> <tr> <td><b>Subject</b></td> <td><input type='text' autofocus name='subject' class="form-control" value="<?php echo $subject ?>"></td> </tr> <tr> <td><b>Notice</b></td> <td> <textarea name='blog' class="form-control" rows='5' cols="4"><?php echo $blog ?></textarea> </td> </tr> <tr style='display:none'> <td><b>Image</b></td> <td><input type="file" name='image'></td> </tr> <tr> <td><input type='hidden' name='id' value="<?php echo $id ?>"></td> <td><input type='submit' name='submit' value="Submit" class="btn-primary" /></td> </tr> </form> </table> <div class='container-fluid'> <table width="100%" class='table-condensed table-striped table-bordered'> <tr style="font-weight:bold"> <td>S.</td> <td width="10%">Date</td> <td width="40%">Subject</td> <td>Notice</td> <!--<td>Img</td> --> <td width='5%' align="center">Edit</td> </tr> <?php $sql = mysqli_query($db,"SELECT * FROM blogs order by id desc limit 100"); $sql_count = mysqli_num_rows($sql); for($r=1;$r<=$sql_count;$r++) { $row = mysqli_fetch_array($sql); $blog = $row['blog']; $date = $row['date']; $dt = date('d-m-y',strtotime($date)); $subject = $row['subject']; $id = $row['id']; $links = $row['links']; echo " <tr> <td>$r</td> <td>$dt</td> <td>$subject</td> <td>$blog</td> <td align='center'><a style='display:block' class='btn-primary' href='blog_entry.php?edit=$id'>Edit</a><br> <a style='display:block' class='btn-danger' href='blog_entry.php?del=$id'>Del</a> </td> </tr> "; } ?> </table> </div> <div id='footer'> <p align="center" style="background-color:#000;color:#fff">Developed by Findjee Infotech : 7869555421 /</p> </div> </body> </html> <?php if(isset($_POST['submit'])) { $blog = $_POST['blog']; $subject = $_POST['subject']; $date = $_POST['date']; $id = $_POST['id']; $links = trim($_POST['links']); //find if this record already in table// if($id != 0) { $sql_update = mysqli_query($db,"UPDATE blogs set date='$date', subject = '$subject', blog = '$blog', links = '$links' where id = '$id'"); header("location:blog_entry.php"); } else { $sql = mysqli_query($db,"INSERT INTO blogs (date,subject,blog,links) values ('$date','$subject','$blog','$links')"); header("location:blog_entry.php"); } } ?> <?php if(isset($_GET['del'])) { $del = $_GET['del']; $sql = mysqli_query($db,"DELETE FROM blogs where id = '$del'") or die(mysqli_error($db)); header("location:blog_entry.php"); } ?>