D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
vitalityhealth
/
public_html
/
aa
/
invite
/
Filename :
test.php
back
Copy
<?php $page = "Banner"; session_start(); if(!isset($_SESSION['LOGIN']['SUMMER'])) { header("location:index.php"); } include("include/global.php"); if($_REQUEST['lid'] !=''){ $selectRole = "SELECT * FROM banners WHERE bannerId ='".$_REQUEST['lid']."'"; $fireRole = mysqli_query($connect, $selectRole); $rowRole = mysqli_fetch_array($fireRole); } if(isset($_POST['savedata'])) { if($_REQUEST['lid'] !=''){ $temp_name=$_FILES['bannerPath']['tmp_name']; $file_name=$_FILES['bannerPath']['name']; $fbl = time(); $nefilename = $fbl.$file_name; $file_path="../assets/imgs/banner/".$nefilename; move_uploaded_file($temp_name,$file_path); if($file_name ==""){ $file_path = $rowRole['bannerPath']; }else{ unlink($rowRole['bannerPath']); } $insert1 ="update banners set bannerTitle = '".addslashes($_REQUEST['bannerTitle'])."', bannerTitleurl = '".addslashes($_REQUEST['bannerTitleurl'])."', bannerSubtitle = '".addslashes($_REQUEST['bannerSubtitle'])."', bannerSubtitleurl = '".addslashes($_REQUEST['bannerSubtitleurl'])."', bannerPath = '". $file_path."' where bannerId ='".$_REQUEST['lid']."' "; $result=mysqli_query($connect,$insert1) or die(mysqli_error()); header("location:banner-list.php?msg=u"); }else{ $temp_name=$_FILES['bannerPath']['tmp_name']; $file_name=$_FILES['bannerPath']['name']; $fbl = time(); $nefilename = $fbl.$file_name; $file_path="../assets/imgs/banner/".$nefilename; move_uploaded_file($temp_name,$file_path); if($temp_name !='') { $newfilename ='../assets/imgs/banner/'.$nefilename; }else{ $newfilename = ''; } $insert1 ="insert into banners set bannerTitle = '".addslashes($_REQUEST['bannerTitle'])."', bannerTitleurl = '".addslashes($_REQUEST['bannerTitleurl'])."', bannerSubtitle = '".addslashes($_REQUEST['bannerSubtitle'])."', bannerSubtitleurl = '".addslashes($_REQUEST['bannerSubtitleurl'])."', bannerPath = '". $newfilename."'"; $result=mysqli_query($connect,$insert1) or die(mysqli_error()); header("location:banner-list.php?msg=c"); //} } } include("include/header.php"); if($_REQUEST['msg'] == "e"){ $msgs = '<div class="alert alert-danger alert-dismissible d-flex align-items-center fade show text-center"> <i class="bi-check-circle-fill"></i> <strong class="text-center">Salon Banner added only 8 </strong> <button type="button" class="btn-close" data-bs-dismiss="alert"></button></div>'; } ?> <div class="page-body"> <div class="container-fluid"> <div class="page-header"> <div class="row"> <div class="col-sm-6"> <ol class="breadcrumb"> </ol> </div> <div class="col-sm-6"> <ol class="breadcrumb pull-right"> <li class="breadcrumb-item"><a href="dashboard.php" data-bs-original-title="" title="">Home</a></li> <li class="breadcrumb-item"><?php echo $page; ?> list</li> </ol> </div> </div> </div> </div> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <?php echo $msgs; ?> <div class="card"> <div class="card-header"> <div class="header-top"> <h5 class="pull-left">Add <?php echo $page; ?> </h5> </div> </div> <div class="card-body"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <form class="theme-form" action="" method="post" enctype="multipart/form-data"> <div class="mb-3 row"> <label class="col-sm-3 col-form-label">Title</label> <div class="col-sm-9"> <input class="form-control" type="text" placeholder="Title" name="bannerTitle" id="bannerTitle" value="<?php echo $rowRole['bannerTitle']; ?>"> </div> </div> <!-- <div class="mb-3 row"> <label class="col-sm-3 col-form-label">Title Url</label> <div class="col-sm-9"> <input class="form-control" type="url" placeholder="Title Url" name="bannerTitleurl" id="bannerTitleurl" value="<?php //echo $rowRole['bannerTitleurl']; ?>"> </div> </div> --> <div class="mb-3 row"> <label class="col-sm-3 col-form-label">Sub Title</label> <div class="col-sm-9"> <input class="form-control" type="text" placeholder="Sub Title" name="bannerSubtitle" id="bannerSubtitle" value="<?php echo $rowRole['bannerSubtitle']; ?>"> </div> </div> <!--<div class="mb-3 row">--> <!-- <label class="col-sm-3 col-form-label">Video url</label>--> <!-- <div class="col-sm-9">--> <!-- <input class="form-control" type="url" placeholder="Video url" name="bannerSubtitleurl" id="bannerSubtitleurl" value="<?php //echo $rowRole['bannerSubtitleurl']; ?>">--> <!-- </div>--> <!-- </div>--> <div class="mb-3 row"> <label class="col-sm-3 col-form-label">Banner Image</label> <div class="col-sm-9"> <input class="form-control" required type="file" placeholder="" accept="image/*" name="bannerPath" id="bannerPaths" value="<?php echo $rowRole['bannerPath']; ?>"> <h6 class="form-text text-muted">Allowed file types: png, jpg, jpeg.</h6> <h6 class="form-text text-muted">File Ratio: 2:1 | File size limit is 2Mb</h6> <?php if($rowRole['bannerPath']!='') {?> <img src="<?php echo $rowRole['bannerPath'] ;?>" class="img-fluid top-radius-blog hide" style="height: 100px !important; width:200px !important; margin-top:10px !important;"> <?php }?> <img id="preview-image-before-upload" src="https://dummyimage.com/200x100/ebecf0/1e2ad4" alt="preview image" class="img-fluid top-radius-blog show" style="height: 100px !important; width:200px !important; margin-top:10px !important;"> </div> </div> <div class="card-footer text-center"> <button class="btn btn-primary" type="submit" name="savedata"><span class="d-none spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Submit</button> </div> </form> </div> </div> </div> </div> </div> </div> </div> <div class="modal fade" id="exampleModalc" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel1">Message</h5> <button class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body text-danger" style="text-align:center;"> Please select image less than 2 MB </div> </div> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $('#bannerType').on('change', function(){ var demovalue = $(this).val(); $("div.myDiv").hide(); $("#show"+demovalue).show(); }); var radioValue = $('#bannerType option:selected').val(); if(radioValue == "Category" || radioValue == "Salon" || radioValue =="Link"){ $("#show"+radioValue).show(); } }); </script> <script type="text/javascript"> $(document).ready(function (e) { $('#bannerPaths').change(function(){ $('.hide').hide(); $('.show').show(); let reader = new FileReader(); reader.onload = (e) => { $('#preview-image-before-upload').attr('src', e.target.result); } var a=(this.files[0].size); if(a > 2000000) { $('.show').hide(); $('#exampleModalc').modal('show'); $('#bannerPaths').val(''); return false; }else{ reader.readAsDataURL(this.files[0]); } }); }); </script> <script> $(() => { $('button').on('click', e => { $('input[type=file]').attr('required',false); let spinner = $(e.currentTarget).find('span') spinner.removeClass('d-none') setTimeout(_ => spinner.addClass('d-none'), 10000) }) }) </script> <script> $(function () { $('#subtilte').colorpicker(); }); $(function () { $('#tilte').colorpicker(); }); </script> <?php if($_REQUEST['lid']) { ?> <style type="text/css"> .show{ display: none; } </style> <?php }else{ ?> <style type="text/css"> .show{ display: block; } </style> <?php } ?> </style> <style> .myDiv{ display: none; } </style> <?php include("include/footer.php"); ?>