D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
lampp
/
htdocs
/
admin
/
Filename :
gallery.php
back
Copy
<?php include('session.php'); if(!isset($_SESSION['login_user'])){ header("location: index.php"); // Redirecting To Home Page } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Add, Edit, Delete Data</title> <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="screen"> <link rel="stylesheet" type="text/css" href="css/DT_bootstrap.css"> <link href="modal/css1/bootstrap1.css" rel="stylesheet" type="text/css" media="screen"> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> <body> <div class="row-fluid"> <div class="span12"> <div class="container"> <header style="display:flex;align-items:center"> <h3>Welcome to <?php echo $login_session; ?></h3> <div class="flex-spacer"></div> <b class="btn btn-danger" id="logout"><a href="logout.php">Log Out</a></b> <a class="btn btn-primary" href="index.php">Home</a> </header> <nav> <!-- Button to trigger modal --> <a class="btn btn-primary" href="#myModalGal" data-toggle="modal">Click Here To Add New Image</a> </nav> <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example"> <div class="alert alert-info"> <strong><i class="icon-user icon-large"></i> Products For Show</strong> </div> <thead> <tr> <th style="text-align:center;"> Id</th> <th style="text-align:center;"> Image Name</th> <th style="text-align:center;">Image</th> <th style="text-align:center;">Action</th> </tr> </thead> <tbody> <?php require_once('db.php'); $result = $conn->prepare("SELECT * FROM gallery"); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ $id=$row['id']; ?> <tr> <td style="text-align:center; margin-top:10px; word-break:break-all; width:450px; line-height:100px;"> <?php if($row['image'] != ""): ?> <img src="gallery/<?php echo $row['image']; ?>" width="100px" height="100px" style="border:1px solid #333333;"> <?php endif; ?> </td> <td style="text-align:center; word-break:break-all; width:200px;"> <?php echo $row ['alt']; ?></td> <td style="text-align:center; width:350px;"> <a href="#updte_img<?php echo $id;?>" data-toggle="modal" class="btn btn-warning" >Update Image</a> </td> </tr> <!-- Modal Update Image --> <div id="updte_img<?php echo $id;?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <h3 id="myModalLabel">Update</h3> </div> <div class="modal-body"> <div class="alert alert-danger"> <?php if($row['image'] != ""): ?> <img src="gallery/<?php echo $row['image']; ?>" width="100px" height="100px" style="border:1px solid #333333; margin-left: 30px;"> <!-- <?php //else: ?> --> <!-- <img src="images/default.png" width="100px" height="100px" style="border:1px solid #333333; margin-left: 30px;"> --> <?php endif; ?> <form action="editGal.php<?php echo '?id='.$id; ?>" method="post" enctype="multipart/form-data"> <div style="color:blue; margin-left:150px; font-size:30px;"> <input type="file" name="image" style="margin-top:-115px;" required> <label>Alter Tag</label> <input type="text" name="alt" placeholder="alt name" value="<?php echo $row['alt']; ?>" required /> </div> <hr> <div class="modal-footer"> <button class="btn btn-inverse" data-dismiss="modal" aria-hidden="true">No</button> <button type="submit" name="submit" class="btn btn-danger">Yes</button> </form> </div> </div> </div> <?php } ?> </tbody> </table> </div> </div> </div> <br> <br> <br> <!-- Modal --> <div id="myModalGal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <h3 id="myModalLabel">Add</h3> </div> <div class="modal-body"> <form method="post" action="addGal.php" enctype="multipart/form-data"> <table class="table1"> <tr> <td><label style="color:#3a87ad; font-size:18px;">Name of Product</label></td> <td width="30"></td> <td><input type="text" name="alt" placeholder=" Name" required /></td> </tr> </tr> <tr> <td><label style="color:#3a87ad; font-size:18px;">Add Image Product</label></td> <td width="30"></td> <td><input type="file" name="image" required></td> </tr> </table> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> <button type="submit" name="Submit" class="btn btn-primary">Upload</button> </div> </form> </div> </div> <script src="modal/js1/jquery1.js" type="text/javascript"></script> <script src="modal/js1/bootstrap1.js" type="text/javascript"></script> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/bootstrap.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.dataTables.js"></script> <script type="text/javascript" charset="utf-8" language="javascript" src="js/DT_bootstrap.js"></script> </body> </html>