D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
saravanabhavan
/
domains
/
hotelshrisaravanabhavan.com
/
public_html
/
admin
/
Filename :
gallery_edit.php
back
Copy
<?php include ("session.php");?> <?php include("connection.php"); ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]--> <!-- BEGIN HEAD --> <head> <meta charset="utf-8" /> <title>Admin</title> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta content="" name="description" /> <meta content="" name="author" /> <link rel="stylesheet" type="text/css" href="assets/chosen-bootstrap/chosen/chosen.css" /> <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" /> <link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" /> <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" /> <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" /> <link href="css/style.css" rel="stylesheet" /> <link href="css/style_responsive.css" rel="stylesheet" /> <link href="css/style_default.css" rel="stylesheet" id="style_color" /> <link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" /> </head> <!-- END HEAD --> <!-- BEGIN BODY --> <body class="fixed-top"> <!-- BEGIN HEADER --> <?php include("header.php"); ?> <!-- END HEADER --> <!-- BEGIN CONTAINER --> <div id="container" class="row-fluid"> <!-- BEGIN SIDEBAR --> <div id="sidebar" class="nav-collapse collapse"> <div class="sidebar-toggler hidden-phone"></div> <!-- BEGIN RESPONSIVE QUICK SEARCH FORM --> <div class="navbar-inverse"> <form class="navbar-search visible-phone"> <input type="text" class="search-query" placeholder="Search" /> </form> </div> <!-- END RESPONSIVE QUICK SEARCH FORM --> <!-- BEGIN SIDEBAR MENU --> <?php include("sidemenu.php"); ?> <!-- END SIDEBAR MENU --> </div> <!-- END SIDEBAR --> <!-- BEGIN PAGE --> <div id="main-content"> <!-- BEGIN PAGE CONTAINER--> <div class="container-fluid"> <!-- BEGIN PAGE HEADER--> <div class="row-fluid"> <div class="span12"> <!-- BEGIN THEME CUSTOMIZER--> <div id="theme-change" class="hidden-phone"> <i class="icon-cogs"></i> <span class="settings"> <span class="text">Theme:</span> <span class="colors"> <span class="color-default" data-style="default"></span> <span class="color-gray" data-style="gray"></span> <span class="color-purple" data-style="purple"></span> <span class="color-navy-blue" data-style="navy-blue"></span> </span> </span> </div> <!-- END THEME CUSTOMIZER--> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> <small></small> </h3> <ul class="breadcrumb"> <li> <a href="#"><i class="icon-home"></i></a><span class="divider"> </span> </li> <li>Gallery<span class="divider"> </span> </li> <li><a href="#">Edit Gallery </a><span class="divider-last"> </span></li> </ul> <!-- END PAGE TITLE & BREADCRUMB--> </div> </div> <!-- END PAGE HEADER--> <!-- BEGIN PAGE CONTENT--> <div class="row-fluid"> <div class="span12"> <div class="widget"> <div class="widget-title"> <h4><i class="icon-globe"></i>Blank Page</h4> <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> <a href="javascript:;" class="icon-remove"></a> </span> </div> <?php $sql="select * from gallery where GalleryID =".$_REQUEST['id']; $result=mysql_query($sql,$conn); $row=@mysql_fetch_array($result); ?> <div class="widget-body form"> <div> <h3>Edit Product </h3> </div> <!-- BEGIN FORM--> <form action="<?php $PHP_SELF ?>" method="post" onSubmit="return validate(this);" enctype="multipart/form-data" class="form-horizontal" > <div class="control-group"> <label class="control-label" style="color:#000;">Title </label> <div class="controls"> <select name="name" data-rel="chosen" class="inputtext-footer" style="border:1px solid #000; color:#000; height:30px; width:400px;"><option value="">Select Title</option> <?php $sqlCountry = "SELECT * FROM gallery_title where GalleryTitleID order by GalleryTitle"; $resultCountry = mysql_query($sqlCountry, $conn); if (@mysql_num_rows($resultCountry)!=0){ while($rowCountry = mysql_fetch_array($resultCountry)) { ?> <option value="<?php echo $rowCountry['GalleryTitleID']?>" <?php if($row['GalleryTitleID'] == $rowCountry['GalleryTitleID']) echo "selected"; ?> ><?php echo $rowCountry['GalleryTitle']?></option> <?php } } ?> </select> </div> </div> <div class="control-group"> <label class="control-label" style="color:#000;">Data</label> <div class="controls"> <input type="text" name="file" id="file" value="<?php echo $row['GalleryImg'] ?>" class="input-xlarge" readonly style="border:1px solid #000; color:#000; height:30px; width:400px;"/> <input type="file" name="file" id="file" class="input-xlarge" onBlur="val(this.id)" style="border:1px solid #000; color:#000; height:30px; width:400px;"/><div id="errorfile"></div> </div> </div> <div class="control-group" style="display:none;"> <label class="control-label">Photo Ttile </label> <div class="controls"> <input type="text" name="gname" value="<?php echo $row['GallerySubtitle']; ?>" onBlur="val(this.id)" /><div id="errorfile"></div> </div> </div> <div class="form-actions"> <input value="true" name="continue" type="hidden" /> <input type="hidden" name="galleryid" value="<?php echo $row["GalleryID"]?>"/> <input type="submit" class="btn btn-success" name="s1" id="submit" value="Submit" /> </div> </form> <!-- END FORM--> <?php error_reporting(0); $change=""; $abc=""; define ("MAX_SIZE","400"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if($_SERVER["REQUEST_METHOD"] == "POST") { $image =$_FILES["file"]["name"]; $uploadedfile = $_FILES['file']['tmp_name']; if ($image) { $filename = stripslashes($_FILES['file']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { $change='<div class="msgdiv">Unknown Image extension </div> '; $errors=1; } else { $size=filesize($_FILES['file']['tmp_name']); if($extension=="jpg" || $extension=="jpeg" ) { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); } else if($extension=="png") { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } echo $scr; list($width,$height)=getimagesize($uploadedfile); $newwidth=550; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); $newwidth1=125; $newheight1=($height/$width)*$newwidth1; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = "images/gallery/". $_FILES['file']['name']; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); }} } if(isset($_POST['s1']) && !$errors) { if(($_FILES["file"]["name"])) { unlink('images/gallery/'.$_REQUEST['file'].''); $insert = "update gallery set CreatedOn='".date('Y-m-d H:i:s')."', GalleryTitleID='".mysql_escape_string($_REQUEST['name'])."', GallerySubtitle='".mysql_escape_string($_REQUEST['gname'])."' GalleryImg='".mysql_escape_string($_FILES["file"]["name"])."' where GalleryID='".mysql_escape_string($_REQUEST['galleryid'])."'"; $resultt = mysql_query($insert); echo "<meta http-equiv=\"refresh\" content=\"0;URL=gallery_list.php\">"; } else { { $insert = "update gallery set CreatedOn='".date('Y-m-d H:i:s')."', GalleryTitleID='".mysql_escape_string($_REQUEST['name'])."', GallerySubtitle='".mysql_escape_string($_REQUEST['gname'])."' GalleryImg='".mysql_escape_string($_REQUEST['file'])."' where GalleryID='".mysql_escape_string($_REQUEST['galleryid'])."'"; $resultt = mysql_query($insert); echo "<meta http-equiv=\"refresh\" content=\"0;URL=gallery_list.php\">"; } } } ?> </div> </div> </div> </div> <!-- END PAGE CONTENT--> </div> <!-- END PAGE CONTAINER--> </div> <!-- END PAGE --> </div> <!-- END CONTAINER --> <!-- BEGIN FOOTER --> <div id="footer"> 2013 © Admin Lab Dashboard. <div class="span pull-right"> <span class="go-top"><i class="icon-arrow-up"></i></span> </div> </div> <!-- END FOOTER --> <!-- BEGIN JAVASCRIPTS --> <!-- Load javascripts at bottom, this will reduce page load time --> <script src="js/jquery-1.8.3.min.js"></script> <script src="assets/bootstrap/js/bootstrap.min.js"></script> <script src="js/jquery.blockui.js"></script> <!-- ie8 fixes --> <!--[if lt IE 9]> <script src="js/excanvas.js"></script> <script src="js/respond.js"></script> <![endif]--> <script type="text/javascript" src="assets/chosen-bootstrap/chosen/chosen.jquery.min.js"></script> <script type="text/javascript" src="assets/uniform/jquery.uniform.min.js"></script> <script src="js/scripts.js"></script> <script> jQuery(document).ready(function() { // initiate layout and plugins App.init(); }); </script> <!-- END JAVASCRIPTS --> </body> <!-- END BODY --> </html>