Şuanki Dizin: /home/wwwdreamtechnolo/www/spmsolapur.org/admin/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/spmsolapur.org/admin/edit-photo-title.php |
<?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require_once("lib/functions.php"); $db = new login_function(); $success_msg = 0; $succ_flag = 0; $flag=0; $image_error = ""; $attachment_error = ""; if(isset($_SESSION['page_id'])) { $page_id_code = $_SESSION['page_id']; $received_page_name = $_SESSION['page_name']; } if(isset($_GET['edit_id'])) { $up_id = $_GET['edit_id']; $_SESSION['edit_id'] = $up_id; } else if(isset($_SESSION['edit_id'])) { $up_id = $_SESSION['edit_id']; } if(isset($_GET['image_file'])) { $image = $_GET['image_file']; $db->update_file_image_removed($up_id); unlink('../crm_img_gallery/'.$image); header("Location:edit-photo-title.php"); } if(isset($_POST['image_file_add_btn'])) { $valid_formats = array("jpg","png","gif","bmp","jpeg","pdf","JPEG","JPG","BMP","PNG","GIF","PDF"); 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(); $actual_image_name = $current_random_string.".".strtolower($ext); $tmp = $_FILES['picture']['tmp_name']; $img_Dir = "../crm_img_gallery/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$actual_image_name)) { $db->update_file_image_id_and_name($actual_image_name,$up_id); } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } } /**************************************************************************************/ if(isset($_GET['attachment_image_file'])) { $image = $_GET['attachment_image_file']; $db->update_attachment_file_image_removed($up_id); unlink('../crmdocs/'.$image); header("Location:edit-photo-title.php"); } if(isset($_POST['attachment_file_add_btn'])) { $valid_formats = array("jpg","png","gif","bmp","jpeg","pdf","JPEG","JPG","BMP","PNG","GIF","PDF"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['attachment']['name']; $size = $_FILES['attachment']['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(); $actual_image_name = $current_random_string.".".strtolower($ext); $tmp = $_FILES['attachment']['tmp_name']; $img_Dir = "../crmdocs/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$actual_image_name)) { $db->update_attachment_file_image_id_and_name($actual_image_name,$up_id); } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } } /***************************************************************************/ if(isset($_POST['add_btn'])) { $title = $_POST['title']; $subtitle = $_POST['subtitle']; $sq_no = $_POST['sq_no']; if($db->update_placement_cell_details($title,$subtitle,$sq_no,$up_id)) { $succ_flag = 1 ; } } $image = ""; $attachment = ""; $details = $db->get_all_placement_cell_upload_data($up_id); $counter = 0; if(!empty($details)) { $id = $details[$counter][0]; $title = $details[$counter][1]; $sub_title = $details[$counter][2]; $sq_no = $details[$counter][3]; $image = $details[$counter][4]; $attachment = $details[$counter][5]; } ?> <?php require_once('header.php'); ?> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Update <?php echo $received_page_name; ?> : Photo & Title Upload </h1> <?php if($succ_flag == 1) { ?> <div class="alert alert-success"> Updated Successfully. </div> <?php } ?> <?php if($success_msg == 2) { ?> <div class="alert alert-danger"> Deleted Successfully. </div> <?php } ?> </div> </div> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> Update <?php echo $received_page_name; ?> Photo & Title Upload </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> Title </label> <input class="form-control" placeholder="Enter Title" name="title" type="text" value="<?php echo $title; ?>" required> </div> <div class="form-group"> <label> Title </label> <input class="form-control" placeholder="Enter Sub Title" name="subtitle" type="text" value="<?php echo $sub_title; ?>" required> </div> <div class="form-group"> <label> Sequence Number </label> <input class="form-control" placeholder="Enter Sequence Number" name="sq_no" type="text" value="<?php echo $sq_no; ?>" required> </div> <button type="submit" class="btn btn-success" name="add_btn">Submit </button><br /><br /> <a href="photo-title.php">Back To Report</a> </form> </div> <!-- /.col-lg-6 --> </div> <div class="col-lg-3"> <form role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Attachments</label><br /><br /> <?php if($image != "") { list($txt, $ext) = explode(".", $image); if($ext=="pdf") { ?> <a href="/crm_img_gallery/<?php echo $image; ?>" target="_blank"><img src="/images/pdfimg.jpg" height="50px" width="50px" title="view"></a><br /><br /> <?php } else { ?> <a href="/crm_img_gallery/<?php echo $image; ?>" target="_blank"><img src="/crm_img_gallery/<?php echo $image; ?>" height="50px" width="50px" title="view"></a><br /><br /> <?php } ?> <?php } else { ?> <img src="/images/no_image_available.png" style="height:90px;width:90px;" /><br /><br /> <?php } ?> <label><a href="edit-photo-title.php?u_id=<?php echo $id; ?>&image_file=<?php echo $image; ?>">Remove Image</a></label> <br /><br /> <input class="form-control" name="picture" type="file" required> <span style="color:red;"><?php echo $image_error; ?></span> </div> <button type="submit" class="btn btn-success" name="image_file_add_btn">Update Button</button> <br /><br /> </form> </div> <div class="col-lg-3"> <form role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Attachment</label><br /><br /> <?php if($attachment != "") { list($txt, $ext) = explode(".", $attachment); if($ext=="pdf") { ?> <a href="/crmdocs/<?php echo $attachment; ?>" target="_blank"><img src="/images/pdf.png" height="50px" width="50px" title="view"></a><br /><br /> <?php } else { ?> <a href="/crmdocs/<?php echo $attachment; ?>" target="_blank"><img src="/gallery/pdf.png" height="50px" width="50px" title="view"></a><br /><br /> <?php } ?> <?php } else { ?> <img src="/images/no_image_available.png" style="height:90px;width:90px;" /><br /><br /> <?php } ?> <label><a href="edit-photo-title.php?u_id=<?php echo $id; ?>&attachment_image_file=<?php echo $attachment; ?>">Remove Image</a></label> <br /><br /> <input class="form-control" name="attachment" type="file" required> <span style="color:red;"><?php echo $attachment_error; ?></span> </div> <button type="submit" class="btn btn-success" name="attachment_file_add_btn">Update Button</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