Şuanki Dizin: /home/wwwdreamtechnolo/public_html/balajimall.com/admin/ |
Şuanki Dosya : /home/wwwdreamtechnolo/public_html/balajimall.com/admin/edit-advertise-section.php |
<?php require_once("../lib/functions.php"); $db = new login_function(); $flag = 0; $e_date=""; $success_msg = 0; $s_date = ""; $p_amount = ""; $r_commission = ""; $r_name = ""; $amount_error = ""; $category = ""; $category_error = ""; $image_error = ""; $title = ""; if(!isset($_SESSION['current_login_admin'])) { header("Location:index.php"); } if(isset($_SESSION['current_login_admin'])) { $email = $_SESSION['current_login_admin']; } if(isset($_GET['up_id'])) { $up_id = $_GET['up_id']; $_SESSION['current_update_id'] = $up_id; } else if(isset($_SESSION['current_update_id'])) { $up_id = $_SESSION['current_update_id']; } if(isset($_GET['image'])) { $image = $_GET['image']; $db->update_advertise_image_field($up_id); unlink('../advertise-images/'.$image); header("Location:edit-advertise-section.php"); } if(isset($_POST['image_btn'])) { $valid_formats = array("jpg","png","gif","bmp","jpeg","JPEG","JPG","BMP","PNG","GIF"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['picture']['name']; $size = $_FILES['picture']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { $files = array(); function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $current_random_string = generateRandomString(); $advertise_picture = $current_random_string.".".strtolower($ext); $tmp = $_FILES['picture']['tmp_name']; $img_Dir = "../advertise-images/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$advertise_picture)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } else { $flag = 1; } } if($flag == 0) { $image_name = $db->get_advertise_image_name($up_id); if($image_name!="") { $db->update_advertise_data($up_id,$advertise_picture); unlink('../advertise-images/'.$image_name); } else { $db->update_advertise_data($up_id,$advertise_picture); } $success_msg = 1; } } if(isset($_POST['add_btn'])) { $category = $_POST['category']; $s_date = $_POST['s_date']; $e_date = $_POST['e_date']; $p_amount = $_POST['p_amount']; $r_name = $_POST['r_name']; $r_commission = $_POST['r_commission']; $title = $_POST['title']; if($category == "Select Category") { $category_error = "Please Select Category"; $flag = 1; } if(!is_numeric($p_amount)) { $amount_error = "Please enter numeric Value"; $flag = 1; } if($flag == 0) { if($db->update_advertisement($up_id,$category,$title,$s_date,$e_date,$p_amount,$r_name,$r_commission)) { $success_msg = 1 ; } } } $report_details = $db->get_all_advertise_info_by_id($up_id); if(!empty($report_details)) { $counter =0; $id = $report_details[$counter][0]; $category = $report_details[$counter][1]; $advertise_image = $report_details[$counter][2]; $s_date = $report_details[$counter][3]; $e_date = $report_details[$counter][4]; $p_amount = $report_details[$counter][5]; $r_name = $report_details[$counter][6]; $r_commission = $report_details[$counter][7]; $title = $report_details[$counter][8]; } ?> <?php require_once('header.php'); ?> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { $( "#datepicker" ).datepicker({ dateFormat: 'dd-mm-yy' }); } ); </script> <script> $( function() { $( "#datepicker1" ).datepicker({ dateFormat: 'dd-mm-yy' }); } ); </script> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"> Advertise Section </h1> <?php if($success_msg == 1) { ?> <div class="alert alert-success"> Advertise Updated Successfully. </div> <?php } ?> </div> </div> <div class="row"> <a href="advertise-report.php"><-- Back To Report</a><br /><br /> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> Advertise Section </div> <div class="panel-body"> <div class="row"> <div class="col-lg-6"> <form role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Advertise Image</label> <br /><br /> <?php if($advertise_image!="") { ?> <center><a href="/advertise-images/<?php echo $advertise_image; ?>" target="_blank"><img src="/advertise-images/<?php echo $advertise_image; ?>" height="90px" width="90px"> <br /></a></center> <center><a href="edit-advertise-section.php?image=<?php echo $advertise_image; ?>" style="">Remove Image</a></center><br /> <?php }else { ?> <center><img src="/images/no_image_available.png" style="height:90px;width:90px;" /></center><br /> <?php } ?> <input class="form-control" name="picture" type="file" required> <span style="color:red;"><?php echo $image_error; ?></span> </div> <center><button type="submit" class="btn btn-success" name="image_btn">Update Advertise Image </button> </center> </form> <form role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Category</label> <select name="category" class="form-control"> <?php if($category != "") { ?> <option value="<?php echo $category; ?>"><?php echo $category; ?></option> <?php } ?> <option value="Select Category">Select Category</option> <option value="Big Banner Ad1">Big Banner Ad1</option> <option value="Big Banner Ad2">Big Banner Ad2</option> <option value="Dual First Ad1">Dual First Ad1</option> <option value="Dual First Ad2">Dual First Ad2</option> <option value="Dual First Ad3">Dual First Ad3</option> <option value="Dual First Ad4">Dual First Ad4</option> <option value="Details Page Ad1">Details Page Ad1</option> <option value="Details Page Ad2">Details Page Ad2</option> </select> <span style="color:red;"><?php echo $category_error; ?></span> </div> <div class="form-group"> <label>Title</label> <input class="form-control" placeholder="Enter Title" name="title" type="text" value="<?php echo $title; ?>" required> </div> <div class="form-group"> <label>Start Date</label> <input class="form-control" placeholder="Enter Start Date" id="datepicker" name="s_date" value="<?php echo $s_date; ?>" required> </div> <div class="form-group"> <label>Expire Date</label> <input class="form-control" placeholder="Enter Expire Date" id="datepicker1" name="e_date" value="<?php echo $e_date; ?>" required> </div> <div class="form-group"> <label>Paid Amount</label> <input class="form-control" placeholder="Enter Paid Amount" name="p_amount" type="text" value="<?php echo $p_amount; ?>" required> <span style="color:red;"><?php echo $amount_error; ?></span> </div> <div class="form-group"> <label>Reference Name</label> <input class="form-control" placeholder="Enter Reference Name" name="r_name" type="text" value="<?php echo $r_name; ?>" required> </div> <div class="form-group"> <label>Referral Commission</label> <input class="form-control" placeholder="Enter Referral Commission" name="r_commission" type="text" value="<?php echo $r_commission; ?>" required> </div> <button type="submit" class="btn btn-success" name="add_btn">Update Advertise </button> <br /><br /> </form> </div> </div> </div> </div> </div> </div> </div> </div> </body> </html>
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4