File manager - Edit - /home/asiatechinc/public_html/asiatechinc-websites/panchachulihouse.com/admin/attraction.php
Back
<?php include 'core/init.php'; protect_page($mysqli); $qs = $_SERVER['QUERY_STRING']; $get = $_GET['id']; $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; if($get != ''){ $sql = mysqli_query($mysqli, "SELECT * FROM attraction WHERE id = '$get'"); $result = mysqli_fetch_array($sql); $title0 = $result['title']; $description0 = $result['description']; $image0 = $result['image']; } if (empty($_POST) === false && empty($errors) === true) { if($get != ''){ $allowed = array('jpg', 'jpeg', 'gif', 'png'); $file_name = $_FILES['image'] ['name']; $id = $_POST['id']; $user_id = $_POST['user_id']; $title = $_POST['title']; $description = $_POST['description']; if($file_name != ''){ $file_extn = strtolower(end(explode('.', $file_name))); $mi_img_path = $_FILES['image']['tmp_name']; if (in_array($file_extn, $allowed) === true) { attraction_update1($mysqli, $id, $user_id, $title, $description, $image, $file_extn, $mi_img_path, $file_name); } else { $error = 'Incorrect file type. Allowed : '.implode(', ', $allowed); } }else{ $file_path_up = $_POST['image_added_update']; attraction_update2($mysqli, $id, $user_id, $title, $description, $image, $file_extn, $file_path_up); } header('Location: attraction?success'); }else{ if(empty($_FILES['image'] ['name']) === true) { $error = 'Please Choose a File'; } else { $allowed = array('jpg', 'jpeg', 'gif', 'png'); $file_name = $_FILES['image'] ['name']; $file_extn = strtolower(end(explode('.', $file_name))); $mi_img_path = $_FILES['image']['tmp_name']; $user_id = $_POST['user_id']; $title = $_POST['title']; $description = $_POST['description']; if (in_array($file_extn, $allowed) === true) { attraction($mysqli, $user_id, $title, $description, $image, $file_extn, $mi_img_path, $file_name); } else { $error = 'Incorrect file type. Allowed : '.implode(', ', $allowed); } } header('Location: attraction?success'); exit(); } } else if (empty($errors) === false) { $error = output_errors($errors); } ?> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/html"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <link rel="shortcut icon" href="../images/favicon.PNG"> <title>Attraction - <?=$user_data['name'];?></title> <link href="bs3/css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap-reset.css" rel="stylesheet"> <link href="css/table-responsive.css" rel="stylesheet" /> <link href="font-awesome/css/font-awesome.css" rel="stylesheet" /> <link href="css/style.css" rel="stylesheet"> <link href="css/style-responsive.css" rel="stylesheet" /> </head> <body> <section id="container" > <?php include 'include/top.php';?> <section id="main-content" class=""> <section class="wrapper"> <div class="row"> <div class="col-lg-12"> <section class="panel"> <header class="panel-heading"> Add New Attraction <span class="tools pull-right"> <a href="javascript:;" class="fa fa-chevron-down"></a> </span> </header> <div class="panel-body"> <div class="position-center"> <?php if($qs == 'success'){ echo '<div class="alert alert-success alert-block fade in"> <h4> <i class="icon-ok-sign"></i> Success! </h4> <p>Add New Attraction <a href="attraction" style="color:blue">Click Here</a></p> </div>'; }else{ echo $error; ?> <form class="form-horizontal" role="form" method="post" action="" enctype="multipart/form-data" autocomplete="off"> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 col-sm-2 control-label">Title *</label> <div class="col-lg-10"> <input type="hidden" name="id" value="<?=$get; ?>" > <input type="hidden" name="user_id" value="<?=$user_id;?>"> <input type="text" class="form-control" name="title" placeholder="Title" <?php if($get != '') { echo 'value="'.$title0.'"'; } ?> required> </div> </div> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 col-sm-2 control-label">Image (Less Than 1 MB)*</label> <div class="col-lg-10"> <input type="file" id="image" name="image" class="form-control" <?php if($get == ''){ echo 'required'; } ?> > <?php if($get != ''){ ?> <input type="hidden" name="image_added_update" value="<?= $image0;?>"><br/> <img src="<?=$image0;?>" width="160px"> <?php } ?> </div> </div> <div class="form-group"> <label for="inputPassword1" class="col-lg-2 col-sm-2 control-label">Description *</label> <div class="col-lg-10"> <textarea rows="5" class="form-control" name="description" required><?php if($get != '') { echo $description0; } ?></textarea> </div> </div> <div class="form-group"> <div class="col-lg-offset-2 col-lg-10"> <input type="submit" class="btn btn-primary" name="event_submit" value="Submit"> </div> </div> </form> <?php }?> </div> </div> </section> <?php if($get == ''){ ?> <section class="panel"> <?php $sql1 = mysqli_query($mysqli, "SELECT * FROM attraction WHERE user_id = '$user_id'"); $rows1 = mysqli_num_rows($sql1); ?> <header class="panel-heading">Currently Added attraction : <?=$rows1;?> </header> <div class="panel-body"> <section id="flip-scroll"> <?php if($rows1==0){ ?> No Entries Till Now... <?php }else{ ?> <table class="table table-bordered table-striped table-condensed cf"> <thead class="cf"> <tr> <th>SR No</th> <th>Image</th> <th>Title</th> <th>Description</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $count = 1; while($result1 = mysqli_fetch_array($sql1)){ $id = $result1['id']; $image = $result1['image']; $title = $result1['title']; $description = $result1['description']; $status = $result1['status']; echo '<tr id="response_'.$id.'"> <td>'.$count.'</td> <td align="center"><img src="'.$image.'" style="height: 90px; width: 190px;"></td> <td>'.$title.'</td> <td>'.substr($description, 0, 370).'...</td> <td id="status_id'.$id.'"><a href="#" id="status_id" data-id="'.$id.'" data-status="'.$status.'">'; if($status == '1'){ echo '<span class="label label-success label-mini"><i class="fa fa-check"></i> Active</span>'; }else{ echo '<span class="label label-danger label-mini"><i class="fa fa-times"></i> Inactive</span>'; } echo '</a></td> <td> <a class="btn btn-info btn-xs" href="attraction?id='.$id.'"><i class="fa fa-refresh"></i> Update</a> <a href="#" class="btn btn-danger del_button btn-xs" id="del-'.$id.'"><i class="fa fa-trash-o"></i> Delete</a> </td> </tr>'; $count++; } ?> </tbody> </table> <?php } ?> </section> </div> </section> <?php } ?> </div> </div> </section> </section> <div class="right-sidebar"><div class="right-stat-bar"><ul class="right-side-accordion"><li class="widget-collapsible"><ul class="widget-container"><li><div class="prog-row side-mini-stat clearfix"><div class="side-mini-graph"><div class="target-sell"></div></div></div></li></ul></li></ul></div></div> </section> <script src="js/jquery.js"></script> <script src="bs3/js/bootstrap.min.js"></script> <script class="include" type="text/javascript" src="js/jquery.dcjqaccordion.2.7.js"></script> <script src="js/jquery.scrollTo.min.js"></script> <script src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script> <script src="js/jquery.nicescroll.js"></script> <script src="js/scripts.js"></script> <script type="text/javascript"> $(function(){ $("#image").change(function() { var file = this.files[0]; var imagefile = file.type; var match= ["image/jpeg","image/png","image/jpg"]; if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2]))){ alert('Invalid File Type Only jpeg png jpg allowed'); $("#image").val(''); return false; } }); }); $(document).ready(function() { $("body").on("click", " #status_id", function(e) { e.preventDefault(); var id=$(this).data("id") var status="status="+$(this).data("status"); var updatestatus="id="+id+"&"+status; jQuery.ajax({ type: "POST", url: "ajax/attraction.php", dataType:"text", data:updatestatus, success:function(response){ $("#status_id"+id).html(response).stop(); } }); }); $("body").on("click", " .del_button", function(e) { e.preventDefault(); var clickedID = this.id.split('-'); var DbNumberID = clickedID[1]; var myData = 'Delete='+ DbNumberID; var con = confirm('Are you sure to delete this event permanently?'); if(con == true) { $(this).hide(); jQuery.ajax({ type: "POST", url: "ajax/attraction.php", dataType:"text", data:myData, success:function(response){ $('#response_'+DbNumberID).fadeOut(); }, error:function (xhr, ajaxOptions, thrownError){ alert(thrownError); } }); return false; } }); }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings