HEX
Server: LiteSpeed
System: Linux s3512.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: surajaut (1797)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/surajaut/public_html/admin/edit_image.php
<?php
session_start();

// set time-out period (in seconds)
$inactive = 600;

// check to see if $_SESSION["timeout"] is set
if (isset($_SESSION["timeout"])) {
    // calculate the session's "time to live"
    $sessionTTL = time() - $_SESSION["timeout"];
    if ($sessionTTL > $inactive) {
        session_destroy();
        header("Location: logout.php");
    }
}

$_SESSION["timeout"] = time();

include '../connect.php';

if($_SESSION['username'] == '') { header('location:index.php'); }
$details = mysql_fetch_array(mysql_query("select * from images where img_id = '".$_GET['id']."'"));
if(isset($_POST['update'])) 
   {
	$insert = mysql_query('update images set caption = "'.$_POST['caption'].'"  where img_id = "'.$_GET['id'].'"');
	
	//header('location:edit_notice.php?id='.$_GET['id'].'');
	header('location:view_images.php');
	//$msg = "Notice Updated!";
   }
   if(isset($_POST['cancel'])) 
   {
	header('location:view_images.php');
   }
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin Panel</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="page.css" rel="stylesheet" type="text/css" />
</head>

<body >

<div id="body_wrapper">
	<div id="wrapper">
    	
        <div id="header">
            <div id="site_title"><h1><a href="#">Jamshedpur ITI</a></h1></div>
        </div><!-- end of header -->

    
     <?php include 'menu.php'; ?>
    

<div class="main">

  
    <center>
 
    <br/><br/><br/><br/>
    <div style="color:#0C0;"><b><?php echo $msg; ?></b></div>
    
    <h2 >Edit Image</h2>
   
    <form method="post">
    <div>
    
    <b>Image : </b><img src="../images/gallery/thumb/<?php echo $details['img_thumb']; ?>" /><br/><br/>
    <label><b>Caption :</b></label> <input type="text" name="caption" value="<?php echo $details['caption']; ?>" /><br/><br/>
    
    <input type="submit" name="update" value="Update" style="background-image:inherit;" />
    <input type="submit" name="cancel" value="Back" style="background-image:inherit;" />
    
    </div>
    
    </form>
    <br/>
   <p>Note: Here you can only edit caption , to change image kindly delete and add a new one.</p>
    </center>
  <!-- end .container --></div>
  
  
   </div>
   </div>
  <br/> <br/> 
   <div id="footer_wrapper">
    <div id="footer">
        Copyright © 2013 <a href="../index.php">Govt. ITI</a> | Designed by <a href="http://www.visualcreations.in" target="_blank">Visual Creations</a>
        <div class="cleaner"></div>
    </div>
</div>
</body>
</html>