/
home
/
annai
/
domains
/
annaiathanguditiles.com
/
public_html
/
YyteqvCso$vXMmYyy
/
File Upload :
llllll
Current File: /home/annai/domains/annaiathanguditiles.com/public_html/YyteqvCso$vXMmYyy/gallery.php
<?php include('session.php')?> <?php include('header.php')?> <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> <style> img.banner { width: 145px; height: 86px; } .btn-1 { background-color: #375499 !important; border: 1px solid #000417 !important; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("input[type='radio']").change(function(){ if($(this).val()=="Single") { $("#otherAnswer1").hide(); $("#otherAnswer").show(); } else if($(this).val()=="Multiple") { $("#otherAnswer").hide(); $("#otherAnswer1").show(); } }); }); </script> <script> Filevalidation = () => { const fi = document.getElementById('otherAnswer'); // Check if any file is selected. if (fi.files.length > 0) { for (const i = 0; i <= fi.files.length - 1; i++) { const fsize = fi.files.item(i).size; const file = Math.round((fsize / 1024)); // The size of the file. if (file >= 300) { alert( "File too Big, please select a file less than 300kb"); } else if (file < 10) { alert( "File too small, please select a file greater than 10kb"); } else { document.getElementById('size').innerHTML = '<b>' + file + '</b> KB'; } } } } </script> <script> function show_confirm() { return confirm("Are You Sure"); } </script> <?php if(isset($_POST['submit'])) { if ($_POST['type'] == 'Multiple'){ foreach ($_FILES['simage']['tmp_name'] as $key => $val ) { move_uploaded_file($_FILES['simage']['tmp_name'][$key],"img/".$_FILES['simage']['name'][$key]); $image="img/".$_FILES['simage']['name'][$key]; $sql=mysqli_query($conn, "INSERT INTO gallery (image) VALUES ('$image')"); } } else { move_uploaded_file($_FILES['image']['tmp_name'],"img/".$_FILES['image']['name']); $image="img/".$_FILES['image']['name']; $sql=mysqli_query($conn, "INSERT INTO gallery (image) VALUES ('$image')"); } if($sql) { echo "<Script>alert('Details Inserted Successfully')</script>"; } else { echo "<Script>alert('Insertion Failed')</script>"; } } ?> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <!-- Sidebar --> <?php include('sidebar.php')?> <!-- End of Sidebar --> <!-- Content Wrapper --> <div id="content-wrapper" class="d-flex flex-column"> <!-- Main Content --> <div id="content"> <!-- Topbar --> <?php include('topbar.php')?> <!-- End of Topbar --> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">Add Gallery</h1> </div> <div class="card shadow mb-4"> <div class="col-lg-7"> <div class="p-5"> <div class="text-center"> </div> <form class="user" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="exampleInputFile">Upload Image</label></br> <input type="radio" name="type" value="Single" required>Single <input type="radio" name="type" value="Multiple">Multiple <input class="form-control" type="file" name="simage[]" id="otherAnswer1" multiple> <input style="display:none;" class="form-control" type="file" name="image" id="otherAnswer"> </div> <input type="submit" class="btn btn-primary btn-user btn-block btn-1" name="submit" value="ADD" style="background-color:#3ba66b ; border:1px solid #3ba66b;"> </form> </div> </div> </div> <!-- DataTales Example --> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">DataTable</h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>S.No</th> <th>Image</th> <th>Delete</th> </tr> </thead> <tfoot> <tr> <th>S.No</th> <th>Image</th> <th>Delete</th> </tr> </tfoot> <tbody> <?php $x = 1; $sql=mysqli_query($conn,"SELECT * FROM gallery"); while($row=mysqli_fetch_array($sql)) { ?> <tr> <td><?php echo $x; ?></td> <td><img class="banner" src="<?php echo $row['image']; ?>" /></td> <td> <a title="Delete" href="gallery_delete.php?id=<?php echo $row['id']; ?>" class="" onclick='return show_confirm();'><img class="" src="img/del.png"></a></td> </tr> <?php $x++; } echo '<script type="text/javascript"> drawChart(); </script>'; ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <?php include('footer.php')?>
Copyright ©2k19 -
Hexid
|
Tex7ure