D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u935876328
/
domains
/
ggcp.org.in
/
public_html
/
admin
/
Filename :
homePage.php
back
Copy
<?php include('config.php'); include('header.php'); $msg = ""; $homeFile = "upload/home/"; $arr_homePageBannerSql = []; $arr_homeImages = []; $arr_homeCounterSection = []; $arr_homeTestimonial = []; $arr_homeDescriptionType = array("chakra","chakra-2","lotus","yoga"); $arr_homeSection = array("Section-1","Section-2","Section-3"); $homePageBannerSql = mysqli_query($db, "SELECT * FROM home_page_banner order by id DESC LIMIT 1"); $arr_homePageBannerSql = $homePageBannerSql->fetch_all(MYSQLI_ASSOC); $homeImagesSql = mysqli_query($db, "SELECT * FROM home_images order by id"); $arr_homeImages = $homeImagesSql->fetch_all(MYSQLI_ASSOC); $homeCounterSectionSql = mysqli_query($db, "SELECT * FROM home_counter_section order by id"); $arr_homeCounterSection = $homeCounterSectionSql->fetch_all(MYSQLI_ASSOC); if (isset($_POST['upload'])) { $filename = $_FILES["uploadfile"]["name"]; $tempname = $_FILES["uploadfile"]["tmp_name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $newfilename = date('dmYHis') . "." . $ext; $folder = $homeFile . $newfilename; $youtube_id = $_POST["youtube_id"]; if (!empty($arr_homePageBannerSql)){ // Get field information for all fields $hbid = "0"; $hbid = $arr_homePageBannerSql[0]['id']; if($filename == null){ $newfilename = $arr_homePageBannerSql[0]['filename']; } $result = mysqli_query($db, "UPDATE home_page_banner SET filename=\"$newfilename\", youtube_id=\"$youtube_id\" WHERE id=\"$hbid\""); } else { mysqli_query($db, "INSERT INTO home_page_banner (title,filename,youtube_id) VALUES (\"-\",\"$newfilename\",\"$youtube_id\")"); } // Now let's move the uploaded image into the folder: image if (move_uploaded_file($tempname, $folder)) { $msg = "Image uploaded successfully"; } else { $msg = "Failed to upload image"; } $homePageBannerSql = mysqli_query($db, "SELECT * FROM home_page_banner order by id DESC LIMIT 1"); $arr_homePageBannerSql = $homePageBannerSql->fetch_all(MYSQLI_ASSOC); } if (isset($_POST['uploadImage'])) { $filename = $_FILES["uploadfile"]["name"]; $tempname = $_FILES["uploadfile"]["tmp_name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $newfilename = date('dmYHis') . "." . $ext; $folder = "upload/home/" . $newfilename; mysqli_query($db, "INSERT INTO home_images (filename) VALUES (\"$newfilename\")"); // Now let's move the uploaded image into the folder: image if (move_uploaded_file($tempname, $folder)) { $msg = "Image uploaded successfully"; } else { $msg = "Failed to upload image"; } $homeImagesSql = mysqli_query($db, "SELECT * FROM home_images order by id"); $arr_homeImages = $homeImagesSql->fetch_all(MYSQLI_ASSOC); } if(isset($_POST['imageDelete'])){ $id = $_POST['delete']; $sql = "DELETE FROM home_images WHERE id='$id'"; $result = $db->query($sql); $homeImagesSql = mysqli_query($db, "SELECT * FROM home_images order by id"); $arr_homeImages = $homeImagesSql->fetch_all(MYSQLI_ASSOC); } if(isset($_POST['yogaIntroductionDelete'])){ $id = $_POST['delete']; $sql = "DELETE FROM home_yoga_introduction WHERE id='$id'"; $result = $db->query($sql); } if (isset($_POST['yogaIntroduction'])) { $data = $_POST["data"]; //$data = mysqli_real_escape_string($data); $type = $_POST["type"]; mysqli_query($db, "INSERT INTO home_yoga_introduction (data,type) VALUES (\"$data\",\"$type\")"); } if (isset($_POST['section'])) { $filename = $_FILES["uploadfile"]["name"]; $tempname = $_FILES["uploadfile"]["tmp_name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $newfilename = date('dmYHis') . "." . $ext; $folder = "upload/home/" . $newfilename; $title = $_POST["title"]; $slogan = $_POST["slogan"]; $description = $_POST["description"]; $type = $_POST["type"]; $arr_homePageSectionSql = []; $homePageSectionSql = mysqli_query($db, "SELECT * FROM home_section WHERE type = '$type'"); $arr_homePageSectionSql = $homePageSectionSql->fetch_all(MYSQLI_ASSOC); if (!empty($arr_homePageSectionSql)){ // Get field information for all fields $id = "0"; $id = $arr_homePageSectionSql[0]['id']; if($filename == null){ $newfilename = $arr_homePageSectionSql[0]['filename']; } $result = mysqli_query($db, "UPDATE home_section SET filename=\"$newfilename\", title=\"$title\", slogan=\"$slogan\", description=\"$description\" WHERE id=\"$id\""); } else { mysqli_query($db, "INSERT INTO home_section (title,slogan,description,filename,type) VALUES (\"$title\",\"$slogan\",\"$description\",\"$newfilename\",\"$type\")"); } // Now let's move the uploaded image into the folder: image if (move_uploaded_file($tempname, $folder)) { $msg = "Image uploaded successfully"; } else { $msg = "Failed to upload image"; } } if (isset($_POST['counterSection'])) { $active_member = $_POST["active_member"]; $youtube_video = $_POST["youtube_video"]; $ig_followers = $_POST["ig_followers"]; $year_experience = $_POST["year_experience"]; if (!empty($arr_homeCounterSection)){ // Get field information for all fields $id = "0"; $id = $arr_homeCounterSection[0]['id']; $result = mysqli_query($db, "UPDATE home_counter_section SET active_member=\"$active_member\", youtube_video=\"$youtube_video\", ig_followers=\"$ig_followers\", year_experience=\"$year_experience\" WHERE id=\"$id\""); } else { mysqli_query($db, "INSERT INTO home_counter_section (active_member,youtube_video,ig_followers,year_experience) VALUES (\"$active_member\",\"$youtube_video\",\"$ig_followers\",\"$year_experience\")"); } $homeCounterSectionSql = mysqli_query($db, "SELECT * FROM home_counter_section order by id"); $arr_homeCounterSection = $homeCounterSectionSql->fetch_all(MYSQLI_ASSOC); } if(isset($_POST['testimonialDelete'])){ $id = $_POST['delete']; $sql = "DELETE FROM home_testimonial WHERE id='$id'"; $result = $db->query($sql); } if (isset($_POST['testimonial'])) { $name = $_POST["name"]; $testimonialDesc = $_POST["testimonialDesc"]; mysqli_query($db, "INSERT INTO home_testimonial (name,testimonial) VALUES (\"$name\",\"$testimonialDesc\")"); } ?> <!DOCTYPE html> <html> <body> <!-- End Navbar --> <div class="content"> <div class="container-fluid"> <h2>Home Page</h2> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Banner & Banner Youtube video</h4> <p class="card-category">Add Or Update Banner & Banner Youtube video !!!</p> </div> <div class="card-body"> <div class="row"> <div class="col-md-5 col-sm-12 col-xs-12"> <form method="POST" action="" enctype="multipart/form-data"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Youtube Id</label> <?php if (!empty($arr_homePageBannerSql)){ $youtube_id = ""; $youtube_id = $arr_homePageBannerSql[0]['youtube_id']; ?> <input type="text" name="youtube_id" class="form-control" value="<?php echo $youtube_id ?>" required> <?php } else { ?> <input type="text" name="youtube_id" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <label class="bmd-label-floating">Banner Image</label><br> <input type="file" name="uploadfile" value="" /> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <button type="submit" name="upload" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">UPLOAD</button> </div> </div> </form> </div> <div class="col-md-7 col-sm-12 col-xs-12" style="text-align: center;"> <?php if (!empty($arr_homePageBannerSql)){ $filename = ""; $filename = $arr_homePageBannerSql[0]['filename']; ?> <img src="<?php echo $homeFile.$filename ?>" height="150px"> <?php } ?> </div> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Yoga Introduction</h4> <p class="card-category">Add Or Update Yoga introduction data !!!</p> </div> <div class="card-body"> <?php foreach ($arr_homeDescriptionType as $value) { $arr_homeYogaDescriptionSql = []; $homeYogaDescriptionSql = mysqli_query($db, "SELECT * FROM home_yoga_introduction where type = '$value'"); $arr_homeYogaDescriptionSql = $homeYogaDescriptionSql->fetch_all(MYSQLI_ASSOC); ?> <h3 style="font-weight: bold;border-bottom: solid 1px gray;border-top: solid 1px gray;text-align: center;"><?php echo strtoupper($value)?></h3> <div class="row"> <div class="col-md-5 col-sm-12 col-xs-12"> <form method="POST" action=""> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating"><?php echo strtoupper($value)?>'s Point</label> <input type="hidden" name="type" value="<?php echo $value?>" class="form-control" required> <input type="text" name="data" class="form-control" required> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <button type="submit" name="yogaIntroduction" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">SAVE</button> </div> </div> </form> </div> <div class="col-md-7 col-sm-12 col-xs-12"> <table class="table table-bordered"> <tr> <th>Point</th> <th>Action</th> </tr> <?php if (!empty($arr_homeYogaDescriptionSql)){ foreach ($arr_homeYogaDescriptionSql as $column) { ?> <tr> <td><?php echo $column['data'] ?></td> <td style="width: 20%;"> <form method="post" action=""> <input type="hidden" name="delete" value="<?php echo $column['id']; ?>"> <input name="yogaIntroductionDelete" type="submit" value="Delete" class="btn btn-primary btn-sm btn-block waves-effect text-center" /> </form> </td> <?php }} ?> </table> </div> </div> <?php } ?> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Section(s)</h4> <p class="card-category">Add Or Update Section(s) !!!</p> </div> <div class="card-body"> <?php foreach ($arr_homeSection as $value) { $arr_homeSectionSql = []; $homeSectionSql = mysqli_query($db, "SELECT * FROM home_section where type = '$value'"); $arr_homeSectionSql = $homeSectionSql->fetch_all(MYSQLI_ASSOC); ?> <h3 style="font-weight: bold;border-bottom: solid 1px gray;border-top: solid 1px gray;text-align: center;"><?php echo strtoupper($value)?></h3> <div class="row"> <div class="col-md-5 col-sm-12 col-xs-12"> <form method="POST" action="" enctype="multipart/form-data"> <input type="hidden" name="type" value="<?php echo $value ?>"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Title</label> <?php if (!empty($arr_homeSectionSql)){ $title = $arr_homeSectionSql[0]['title']; ?> <input type="text" name="title" class="form-control" value="<?php echo $title ?>" required> <?php } else { ?> <input type="text" name="title" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Slogan</label> <?php if (!empty($arr_homeSectionSql)){ $slogan = $arr_homeSectionSql[0]['slogan']; ?> <input type="text" name="slogan" class="form-control" value="<?php echo $slogan ?>" required> <?php } else { ?> <input type="text" name="slogan" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Description</label> <?php if (!empty($arr_homeSectionSql)){ $description = $arr_homeSectionSql[0]['description']; ?> <textarea name="description" class="form-control" rows="5" required><?php echo $description ?></textarea> <?php } else { ?> <textarea name="description" class="form-control" required></textarea> <?php } ?> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <label class="bmd-label-floating">Image</label><br> <input type="file" name="uploadfile" value="" /> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <button type="submit" name="section" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">SAVE</button> </div> </div> </form> </div> <div class="col-md-7 col-sm-12 col-xs-12" style="text-align: center;"> <?php if (!empty($arr_homeSectionSql)){ $filename = $arr_homeSectionSql[0]['filename']; ?> <img src="<?php echo $homeFile.$filename ?>" height="200px"> <?php } ?> </div> </div> <?php } ?> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Photos</h4> <p class="card-category">Add Or Delete Photos !!!</p> </div> <div class="card-body"> <div class="row"> <div class="col-md-5 col-sm-12 col-xs-12"> <form method="POST" action="" enctype="multipart/form-data"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <input type="file" name="uploadfile" value="" required/> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <button type="submit" name="uploadImage" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">UPLOAD</button> </div> </div> </form> </div> <div class="col-md-7 col-sm-12 col-xs-12"> <table class="table table-bordered"> <tr> <th>Image</th> <th>Action</th> </tr> <?php foreach ($arr_homeImages as $column) { ?> <tr> <td><img src="upload/home/<?php echo $column['filename'] ?>" height="50px" width="80px"></td> <td style="width: 20%;"> <form method="post" action=""> <input type="hidden" name="delete" value="<?php echo $column['id']; ?>"> <input name="imageDelete" type="submit" value="Delete" class="btn btn-primary btn-sm btn-block waves-effect text-center" /> </form> </td> <?php } ?> </table> </div> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Counter Section</h4> <p class="card-category">Add Or Update Conter Section !!!</p> </div> <div class="card-body"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <form method="POST" action="" enctype="multipart/form-data"> <div class="row"> <div class="col-md-3 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Active Member</label> <?php if (!empty($arr_homeCounterSection)){ $active_member = $arr_homeCounterSection[0]['active_member']; ?> <input type="text" name="active_member" class="form-control" value="<?php echo $active_member ?>" required> <?php } else { ?> <input type="text" name="active_member" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-3 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Youtube Video</label> <?php if (!empty($arr_homeCounterSection)){ $youtube_video = $arr_homeCounterSection[0]['youtube_video']; ?> <input type="text" name="youtube_video" class="form-control" value="<?php echo $youtube_video ?>" required> <?php } else { ?> <input type="text" name="youtube_video" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-3 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">IG Followers</label> <?php if (!empty($arr_homeCounterSection)){ $ig_followers = $arr_homeCounterSection[0]['ig_followers']; ?> <input type="text" name="ig_followers" class="form-control" value="<?php echo $ig_followers ?>" required> <?php } else { ?> <input type="text" name="ig_followers" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-3 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Year's Experience</label> <?php if (!empty($arr_homeCounterSection)){ $year_experience = $arr_homeCounterSection[0]['year_experience']; ?> <input type="text" name="year_experience" class="form-control" value="<?php echo $year_experience ?>" required> <?php } else { ?> <input type="text" name="year_experience" class="form-control" required> <?php } ?> </div> </div> <div class="col-md-3 col-sm-12 col-xs-12"> <button type="submit" name="counterSection" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">Save</button> </div> </div> </form> </div> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header card-header-primary" style="background: #71774b;"> <h4 class="card-title">Testimonials</h4> <p class="card-category">Add Or Update Testimonial !!!</p> </div> <div class="card-body"> <div class="row"> <div class="col-md-5 col-sm-12 col-xs-12"> <form method="POST" action=""> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Name</label> <input type="text" name="name" class="form-control" required> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Testimonial</label> <textarea name="testimonialDesc" class="form-control" rows="5"></textarea> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12"> <button type="submit" name="testimonial" class="btn btn-primary btn-sm btn-block waves-effect text-center m-b-20">SAVE</button> </div> </div> </form> </div> <div class="col-md-7 col-sm-12 col-xs-12"> <table class="table table-bordered"> <tr> <th>Name</th> <th>Testimonial</th> <th>Action</th> </tr> <?php $homeTestimonialSql = mysqli_query($db, "SELECT * FROM home_testimonial order by id"); $arr_homeTestimonial = $homeTestimonialSql->fetch_all(MYSQLI_ASSOC); if (!empty($arr_homeTestimonial)){ foreach ($arr_homeTestimonial as $column) { ?> <tr> <td><?php echo $column['name'] ?></td> <td style="white-space: pre-wrap;"><?php echo $column['testimonial'] ?></td> <td style="width: 20%;"> <form method="post" action=""> <input type="hidden" name="delete" value="<?php echo $column['id']; ?>"> <input name="testimonialDelete" type="submit" value="Delete" class="btn btn-primary btn-sm btn-block waves-effect text-center" /> </form> </td> <?php }} ?> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div> <?php include('footer.php'); ?>