D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
grandhou
/
public_html
/
admin
/
Filename :
addban.php
back
Copy
<?php session_start(); ini_set('upload_max_filesize', '50M'); ini_set('post_max_size', '50M'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); if(strlen($_SESSION['alogin'])==0) { header('location:index.php'); } error_reporting( ~E_NOTICE ); // avoid notice include('include/pdo.php'); if(isset($_POST['btn_save_updates'])) { //$heading=$_POST['heading']; $imgFile = $_FILES['user_image']['name']; $tmp_dir = $_FILES['user_image']['tmp_name']; $imgSize = $_FILES['user_image']['size']; $imgFile3 = $_FILES['user_image3']['name']; $tmp_dir3 = $_FILES['user_image3']['tmp_name']; $imgSize3 = $_FILES['user_image3']['size']; echo $imagSize3; if($imgFile) { $upload_dir = 'upload/'; // upload directory $imgExt = strtolower(pathinfo($imgFile,PATHINFO_EXTENSION)); // get image extension $valid_extensions = array('jpeg', 'jpg', 'png', 'gif'); // valid extensions $banner = rand(1000,1000000).".".$imgExt; if(in_array($imgExt, $valid_extensions)) { if($imgSize < 5000000) { move_uploaded_file($tmp_dir,$upload_dir.$banner); } else { $errMSG = "Sorry, your file is too large it should be less then 5MB"; } } else { $errMSG = "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; } } if($imgFile3) { $upload_dir3 = 'upload/'; // upload directory $imgExt3 = strtolower(pathinfo($imgFile3,PATHINFO_EXTENSION)); // get image extension $valid_extensions3 = array('mp4'); // valid extensions $image3 = rand(1000,1000000).".".$imgExt3; move_uploaded_file($tmp_dir3,$upload_dir3.$image3); if(in_array($imgExt3, $valid_extensions3)) { //unlink($upload_dir3.$edit_row['image3']); move_uploaded_file($tmp_dir3,$upload_dir3.$image3); } else { $errMSG3 = "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; } } // if no error occured, continue .... if(!isset($errMSG) && !isset($errMSG3)) { $stmt = $DB_con->prepare("INSERT INTO homee(banner,video) VALUES (:upic,:video)"); $stmt->bindParam("upic", $banner); $stmt->bindParam("video", $image3); if($stmt->execute()){?> <script> alert('Banners Uploaded Succesfully'); window.location.href='addban.php'; </script> <?php } else{ $errMSG = "Sorry Data Could Not Updated !"; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Wedding Photo Sydeny Price Details</title> <link rel="shortcut icon" href="upload/favicon.ico"> <link type="text/css" href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link type="text/css" href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"> <link type="text/css" href="css/theme.css" rel="stylesheet"> <link type="text/css" href="images/icons/css/font-awesome.css" rel="stylesheet"> <link type="text/css" href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600' rel='stylesheet'> <script language="javascript" type="text/javascript"> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } </script> </head> <body oncontextmenu="return false;"> <script> document.onkeydown = function(e) { if(event.keyCode == 123) { return false; } if(e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){ return false; } } </script> <?php include('include/header.php');?> <div class="wrapper"> <div class="container"> <div class="row"> <?php include('include/sidebar.php');?> <div class="span9"> <div class="content"> <div class="module"> <div class="module-head"> <h3>Add Banner Images</h3> </div> <div class="module-body"> <?php if(isset($_POST['submit'])) {?> <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> <?php echo htmlentities($_SESSION['msg']);?><?php echo htmlentities($_SESSION['msg']="");?> </div> <?php } ?> <br /> <form class="form-horizontal row-fluid" method="post" enctype="multipart/form-data" > <input type="hidden" name="edit_id" value="<?php echo $id;?>"> <div class="control-group"> <label class="control-label" for="basicinput">Image ( 1440x810 )</label> <div class="controls"> <input type="file" name="user_image" accept="image/*" required=""/> </div> </div> <div class="control-group"> <label class="control-label" for="basicinput">Video ( Less than 50MB )</label> <div class="controls"> <input type="file" name="user_image3" accept=".mp4"/> </div> </div> <div class="control-group"> <div class="controls"> <button type="submit" name="btn_save_updates" class="btn">Update</button> </div> </div> </form> </div> </div> <div class="module"> <div class="module-head"> <h3>Manage Banner Images</h3> </div> <div class="module-body table"> <?php if(isset($_GET['del'])) {?> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Oh snap!</strong> <?php echo htmlentities($_SESSION['delmsg']);?><?php echo htmlentities($_SESSION['delmsg']="");?> </div> <?php } ?> <br /> <table cellpadding="0" cellspacing="0" border="0" class="datatable-1 table table-bordered table-striped display" width="100%"> <thead> <tr> <th>#</th> <th>Image</th> <th>Action</th> </tr> </thead> <tbody> <?php include('include/pdo.php'); $STH = $DB_con->query('select * from homee'); $STH->setFetchMode(PDO::FETCH_OBJ); $cnt=1; while($row = $STH->fetch()) { ?> <tr> <td><?php echo $cnt;?></td> <td><img src="upload/<?php echo $row->banner;?>" width="50px" height="50px" alt="No Image"></td> <td> <form method="post" action="editban.php"> <input type="hidden" name="edit_id" value="<?php echo $row->id;?>"> <button type="submit"><i class="icon-edit"></i></button> <a href="deleteban.php?Id=<?php echo $row->id;?>" onClick="return confirm('Are you sure you want to delete?')"><i class="icon-remove-sign"></i></a> </form> </td> </tr> <?php $cnt=$cnt+1; } ?> </table> </div> </div> </div><!--/.content--> </div><!--/.span9--> </div> </div><!--/.container--> </div><!--/.wrapper--> </div> <?php include('include/footer.php');?> <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script> <script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="scripts/flot/jquery.flot.js" type="text/javascript"></script> <script src="scripts/datatables/jquery.dataTables.js"></script> <script> $(document).ready(function() { $('.datatable-1').dataTable(); $('.dataTables_paginate').addClass("btn-group datatable-pagination"); $('.dataTables_paginate > a').wrapInner('<span />'); $('.dataTables_paginate > a:first-child').append('<i class="icon-chevron-left shaded"></i>'); $('.dataTables_paginate > a:last-child').append('<i class="icon-chevron-right shaded"></i>'); } ); </script> </body>