File: /home/surajaut/public_html/admin/edit_images.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';
include 'simpleimage.php';
if($_SESSION['username'] == '') { header('location:index.php'); }
$details = mysql_fetch_array(mysql_query("select * from images where image_id = '".$_GET['id']."'"));
if(isset($_POST['update']))
{
$insert = mysql_query('update images set image_name = "'.$_POST['image_name'].'" , page_name = "'.$_POST['page_name'].'" ,new_arrival = "'.$_POST['new_arrival'].'" where image_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>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Suraj Automobiles</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="keywords" content="Your keywords">
<meta name="author" content="Your name">
<link rel="stylesheet" type="text/css" media="screen" href="../styles.css">
<!--<link href='http://fonts.googleapis.com/css?family=Ruthie' rel='stylesheet' type='text/css'>-->
<script src="../js/jquery-1.7.2.min.js"></script>
<script src="../js/menu.js"></script>
</head>
<body>
<!--==============================header=================================-->
<div class="content_my">
<div class="grid_12">
<div align="center">
<h1 class="extra-wrap"><a href="#"><img src="../images/suraj-auto.png"></a></h1>
</div>
<div class="clear"></div>
<nav>
<ul class="sf-menu">
<li style="width:150px;" ><a href="welcome.php">Home</a></li>
<li style="width:200px;" class="current"><a href="#">Manage Images</a>
<ul>
<li><a href="add_images.php">Add Images</a></li>
<li><a href="view_images.php">View Images</a></li>
<li><a href="page_wise.php">View Page Wise</a></li>
</ul>
</li>
<li style="width:200px;"><a href="page_contents.php">Edit Page Contents</a></li>
<li style="width:180px;"><a href="change_password.php">Change Password</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<div class="clear"></div>
</nav>
<!--==============================footer=================================-->
<footer class="wrapper top-8">
<div class="content_my">
<div class="grid_12 border-2"></div>
<div class="clear"></div>
<div class="grid_6" style="height:400px; font-size:14px;">
<h3>Add Images: </h3>
<div style="color:#0C0;"><b><?php echo $msg; ?></b></div>
<form method="post" enctype="multipart/form-data">
<div>
<br/> <div><b>Image : </b><img src="products/thumb/<?php echo $details['img_thumb']; ?>" /></div><br/>
<div style="padding-bottom:20px;"><b>Choose Page:</b>
<select name="page_name">
<option value="<?php echo $details['page_name']; ?>"><?php echo $details['page_name']; ?></option>
<option value="deluxe">Deluxe A.C Bus</option>
<option value="schoolbus">School Bus</option>
<option value="special">Special Vehical</option>
<option value="tourist">Tourist Bus</option>
<option value="city">City Bus</option>
<option value="coaches">Sleeper Coaches</option>
<option value="tipplers">Tipplers</option>
<option value="launch">New Launch 2012</option>
<option value="newarrival">New Arrival</option>
</select> Show in New Arrival : <input type="checkbox" name="new_arrival" value="1"> </div>
<div style="padding-bottom:20px;"><b>Image Name:</b> <input type="text" name="image_name" value="<?php echo $details['image_name']; ?>" /></div>
<div style="padding-bottom:20px;"><input type="submit" name="update" value="Update Image" style="background:#000; color:#FFF; padding:5px;" />
<input type="submit" name="cancel" value="Cancel" style="background:#000; color:#FFF; padding:5px;" />
</div>
<p>Note: Here you can only edit image details , to change image kindly delete and add a new one.</p>
<br/><br/>
<br/><br/> <br/><br/>
</div>
</form>
</div>
<div class="grid_12 border-2"></div>
<div class="clear"></div>
<div class="grid_6"><p class="top-1">Suraj Automobiles © 2013 : <a class="color-2" href="#">Privacy Policy</a><br />
<!-- Do not remove -->Design by <a class="color-2" href="http://www.visualcreations.in">Visual Creations</a><!-- end --></p>
</div>
</div>
</footer>
</div>
</div>
</body>
</html>