D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u935876328
/
domains
/
ggcp.org.in
/
public_html
/
admin
/
Filename :
aboutPage.php
back
Copy
<?php include('config.php'); include('header.php'); $msg = ""; $aboutFile = "upload/about/"; $arr_aboutPageBannerSql = []; $arr_aboutPageDescSql = []; $arr_homeSection = array("Mission","Vision"); $aboutPageBannerSql = mysqli_query($db, "SELECT * FROM about_page_banner order by id DESC LIMIT 1"); $arr_aboutPageBannerSql = $aboutPageBannerSql->fetch_all(MYSQLI_ASSOC); $aboutPageDescSql = mysqli_query($db, "SELECT * FROM about_page_description order by id DESC LIMIT 1"); $arr_aboutPageDescSql = $aboutPageDescSql->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 = $aboutFile . $newfilename; $youtube_id = $_POST["youtube_id"]; $title = $_POST["title"]; if (!empty($arr_aboutPageBannerSql)){ // Get field information for all fields $hbid = "0"; $hbid = $arr_aboutPageBannerSql[0]['id']; if($filename == null){ $newfilename = $arr_aboutPageBannerSql[0]['filename']; } $result = mysqli_query($db, "UPDATE about_page_banner SET title=\"$title\", filename=\"$newfilename\", youtube_id=\"$youtube_id\" WHERE id=\"$hbid\""); } else { mysqli_query($db, "INSERT INTO about_page_banner (title,filename,youtube_id) VALUES (\"$title\",\"$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"; } $aboutPageBannerSql = mysqli_query($db, "SELECT * FROM about_page_banner order by id DESC LIMIT 1"); $arr_aboutPageBannerSql = $aboutPageBannerSql->fetch_all(MYSQLI_ASSOC); } if (isset($_POST['about'])) { $aboutDesc = $_POST["aboutDesc"]; if (!empty($arr_aboutPageDescSql)){ // Get field information for all fields $id = $arr_aboutPageDescSql[0]['id']; mysqli_query($db, "UPDATE about_page_description SET description=\"$aboutDesc\" WHERE id=\"$id\""); } else { mysqli_query($db, "INSERT INTO about_page_description (description) VALUES (\"$aboutDesc\")"); } $aboutPageDescSql = mysqli_query($db, "SELECT * FROM about_page_description order by id DESC LIMIT 1"); $arr_aboutPageDescSql = $aboutPageDescSql->fetch_all(MYSQLI_ASSOC); } if (isset($_POST['section'])) { $filename = $_FILES["uploadfile"]["name"]; $tempname = $_FILES["uploadfile"]["tmp_name"]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $newfilename = date('dmYHis') . "." . $ext; $folder = $aboutFile . $newfilename; $title = $_POST["title"]; $slogan = $_POST["slogan"]; $description = $_POST["description"]; $type = $_POST["type"]; $arr_homePageSectionSql = []; $homePageSectionSql = mysqli_query($db, "SELECT * FROM about_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 about_section SET filename=\"$newfilename\", title=\"$title\", slogan=\"$slogan\", description=\"$description\" WHERE id=\"$id\""); } else { $result = mysqli_query($db, "INSERT INTO about_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"; } } ?> <!DOCTYPE html> <html> <body> <!-- End Navbar --> <div class="content"> <div class="container-fluid"> <h2>About 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">Title</label> <?php if (!empty($arr_aboutPageBannerSql)){ $title = $arr_aboutPageBannerSql[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">Youtube Id</label> <?php if (!empty($arr_aboutPageBannerSql)){ $youtube_id = ""; $youtube_id = $arr_aboutPageBannerSql[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">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_aboutPageBannerSql)){ $filename = ""; $filename = $arr_aboutPageBannerSql[0]['filename']; ?> <img src="<?php echo $aboutFile.$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">About Description</h4> <p class="card-category">Add Or Update About Description !!!</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-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="bmd-label-floating">Descriptio</label> <?php if (!empty($arr_aboutPageDescSql)){ $description = $arr_aboutPageDescSql[0]['description']; ?> <textarea class="form-control" name="aboutDesc" rows="10"><?php echo $description ?></textarea> <?php } else { ?> <textarea class="form-control" name="aboutDesc" rows="10"></textarea> <?php } ?> </div> </div> <div class="col-md-3 col-sm-12 col-xs-12"> <button type="submit" name="about" 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">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 about_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 $aboutFile.$filename ?>" height="200px"> <?php } ?> </div> </div> <?php } ?> </div> </div> </div> </div> </div> </div> </div> <?php include('footer.php'); ?>