D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
public_html
/
Filename :
addsliders.php
back
Copy
<?php session_start(); error_reporting(0); if (isset($_POST['username']) && isset($_POST['password'])) { $manager = $_POST['username']; $password = $_POST['password']; include 'includes/config.php'; $cmem = "SELECT id FROM auth WHERE username='$manager' AND password='$password' LIMIT 1"; $run_cmem = mysqli_query($con, $cmem); $count_mem = mysqli_num_rows($run_cmem); if ($count_mem == 1) { while ($row = mysqli_fetch_array($run_cmem)) { $id = $row['id']; } $_SESSION['id'] = $id; $_SESSION['manager'] = $manager; $_SESSION['password'] = $password; header('location: mod-auth'); exit(); } else { echo "<script>alert('Incorrect Password !!!')</script>"; echo "<script>window.open('sacredheartdadmin','_self')</script>"; exit(); } } ?> <?php $page_title; $page_title = ucfirst(basename(__FILE__, '.php')); if ($page_title === 'index') { $page_title = 'Home'; } $page_title = "Add Sliders page"; include 'section/header.php'; include 'section/pages-header.php'; include 'includes/functions.php'; $Functions = new Functions(); ?> <!DOCTYPE html> <html dir="ltr" lang="en"> <!-- Start main-content --> <div class="main-content"> <!-- Section: Team --> <section id="team"> <div class="container"> <div class="row mtli-row-clearfix mb-5000"> <div class="col-lg-12"> <?php if (isset($_GET['sn'])) { $sn = $_GET['sn']; $delete = "delete from slider where id='$sn'"; include 'includes/config.php'; $run = mysqli_query($con, $delete); if ($delete) { echo "<div class='alert alert-danger'> Carousel deleted successfully! </div>"; echo "<script>window.open('addsliders','_self')</script></script>"; } } ?> <p><a href="mod-auth">Go back to Admin Dashboard</a></p> <?php if (isset($_POST['addslider'])) { $caption1 = str_replace("'", "''", $_POST['caption1']); $caption2 = str_replace("'", "''", $_POST['caption2']); $filename = $_FILES['uploader']['name']; $filepath = 'images/bg/' . $filename; move_uploaded_file($_FILES['uploader']['tmp_name'], $filepath); global $con; include 'includes/config.php'; $feedback = "INSERT INTO slider (image, caption1, caption2) VALUES ('$filepath','$caption1','$caption2')"; $run = mysqli_query($con, $feedback); if ($feedback) { echo "<div class='alert alert-success'> Carousel Added Successfully! </div>"; } else { echo "<div class='alert alert-danger'> An error occured, please try again! </div>"; } } ?> <h3 style="color: #17569E;">Add Sliders!</h3> <form id="form1" name="form1" method="post" action="" enctype="multipart/form-data"> <table width="100%" cellpadding="1" cellspacing="2"> <tr valign="top"> <td style="font-weight:bold; text-align:center">Caption 1</td> <td align="left"><input name="caption1" type="text" size="70" /><br><br></td> </tr> <tr valign="top"> <td style="font-weight:bold; text-align:center">Caption 2</td> <td align="left"><input name="caption2" type="text" size="70" required /><br><br></td> </tr> <tr valign="top"> <td style="font-weight:bold; text-align:center">Image</td> <td align="left"><br><input type="file" name="uploader" size="60" required></td> </tr> <tr valign="top"> <td colspan="2"><br> <input style="margin-left: 100px;" name="addslider" type="submit" style="font-size:12px;" class="default-btn" id="addnews" value=" Add Carousel " /> </td> </tr> </table> </form> <hr/> <p style="color:#990000"><b>Existing Carousels</b></p> <?php $get_feedback = "select * from slider order by id desc"; include 'includes/config.php'; $run_feedback = mysqli_query($con, $get_feedback); while ($row_feedback = mysqli_fetch_array($run_feedback)) { $sn = $row_feedback['id']; $image = $row_feedback['image']; $caption1 = $row_feedback['caption2']; echo " <div class='row' style='margin-bottom: 10px;border-bottom: 1px solid #E6E6E6;padding: 10px;padding-left: 0px;'> <div class='col-lg-5'> <img src='$image' height='70' width='70'/> </div> <div class='col-lg-5'> $caption1 </div> <div class='col-lg-1'> <a href='addsliders?sn=$sn' style='color: red;'>Delete</a> </div> </div> "; } ?> </div> </div> </div> </section> </div> <!-- end main-content --> <?php include_once 'section/footer.php'; ?>s