Şuanki Dizin: /home/wwwdreamtechnolo/www/panel.atsevairag.com/old2/atse_admin_panel007/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/panel.atsevairag.com/old2/atse_admin_panel007/add-downloads.php |
<?php require_once("../lib/class/functions.php"); $db = new functions(); $current_page = ""; if(!isset($_SESSION['current_admn_email'])) { header("Location:/atse_admin_panel007/index.php"); } $flag = 0; $success_msg = 0; $error_message = ""; $download_title = ""; $actual_image_name = ""; $delete_message = 0; if(isset($_GET['delete_download_file'])) { $delete_file_id = $_GET['delete_download_file']; $file_name = $db->get_file_name_from_file_id($delete_file_id); if($file_name!="") { unlink('../downloads/'.$file_name); } $db->delete_download_file($delete_file_id); $delete_message = 1; } if(isset($_POST['download_file_name'])) { $download_title = $_POST['download_file_name']; if($flag==0) { $path = "../downloads/"; $valid_formats = array("jpg", "png", "gif", "bmp", "JPG", "PNG", "GIF", "BMP","pdf","PDF"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['download_file_attachement']['name']; $size = $_FILES['download_file_attachement']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($_FILES['download_file_attachement']['size'] < 10485760) //10MB File size { $files = array(); function generateRandomString($length = 15) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $current_random_no = generateRandomString(); $actual_image_name = $current_random_no.".".strtolower($ext); $tmp = $_FILES['download_file_attachement']['tmp_name']; if(move_uploaded_file($tmp, $path.$actual_image_name)) { $success_msg = 1; } else { $error_message = "failed"; } } else { $error_message = "File size exceeded"; } } else { $error_message = "Invalid file format."; } } else { $error_message = "Please select image..!"; } } if($error_message=="") { $db->insert_new_file($download_title,$actual_image_name); $success_msg = 1; $download_title = ""; } } } ?> <html> <head> <meta charset="UTF-8"> <title>ATSE Vairag</title> <link rel="stylesheet" type="text/css" href="/css/stylesheet.css" /> <script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="/js/site.js"></script> </head> <body> <?php require_once('header.php'); ?> <div style="min-height:570px;"> <div class="admin-mid-section"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data"> <br /> <center><strong>डाउनलोडस </strong></center> <hr /> <div class="add_centre_container"> <?php if($delete_message=="1") { ?> <div class="add_centre_success"> फाईल काढून टाकली आहे </div> <?php } if($success_msg=="1") { ?> <div class="add_centre_success"> नवीन डाऊनलोड फाईल जतन केली आहे </div> <?php } ?> <input type="text" id="download_file_name" name="download_file_name" class="txtflds" value="<?php echo $download_title; ?>" placeholder="डाऊनलोड फाईलचे विषय टाका" required /> <br /> <br /> <center>सलेक्ट फाईल : <input type="file" name="download_file_attachement" class="upload_img_contnr" required /></center> <span class="error_indicator" style="margin:0px;"><?php echo $error_message; ?></span> <br /> <center><input type="submit" name="add_attachement_btn" value="जतन करा" id="update_fees_btn" class="reg_btn_form" style="width:140px;" /></center> </div> </form> <div class="fees_data_container"> <center> <table border="1" class="centre_tab"> <tr style="background-color:#EFEFEF;"> <td width="50">अ. क्र.</td> <td width="200">विषय</td> <td width="120">फाईलचे नाव</td> <td width="100">तारीख </td> <td width="">वेळ</td> <td width=""></td> <td width=""></td> </tr> <?php $download_files = array(); $download_files = $db->get_all_download_files(); $ext = ""; if(!empty($download_files)) { $count = 0; foreach($download_files as $data) { $id = $download_files[$count]['id']; $download_title = $download_files[$count]['download_title']; $attachment_title = $download_files[$count]['attachment_title']; $date = $download_files[$count]['date']; $time = $download_files[$count]['time']; list($txt, $ext) = explode(".", $attachment_title); ?> <tr> <td width="50"><?php echo $id; ?></td> <td width="200"><?php echo $download_title; ?></td> <td width="120"><?php echo $attachment_title; ?></td> <td width=""><?php echo $date; ?></td> <td width="80"><?php echo $time; ?></td> <td width="80"><a href="<?php echo $_SERVER['PHP_SELF']."?delete_download_file=".$id; ?>" class="slide_img_delete_link">Delete</a></td> <?php if($ext=="pdf") { ?> <td width="80"><a href="/downloads/<?php echo $attachment_title; ?>" target="_blank">View</a></td> <?php } else { ?> <td width="80"><a href="view-download-file.php?file_id=<?php echo $id; ?>" target="_blank">View</a></td> <?php } ?> </tr> <?php $count++; } } else { ?> <tr> <td colspan="5">कोणतीही फाईल जतन केलेली नाही </td> </tr> <?php } ?> </table> </center> </div> </div> </div> <?php require_once('footer.php'); ?> </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