Şuanki Dizin: /home/wwwdreamtechnolo/public_html/uesmahilamahavidyalaya.org/old/admin/ |
Şuanki Dosya : /home/wwwdreamtechnolo/public_html/uesmahilamahavidyalaya.org/old/admin/edit-results.php |
<?php require_once("lib/functions.php"); $db = new login_function(); $flag = 0; $rank =""; $success_msg = 0; $f_name = ""; $succ_flag = 0; $department_error = ""; $department = ""; $semester = ""; $semester_error = ""; $marks = ""; $description = ""; $succ_flag = 0; $division_error = ""; $category = ""; $division_error = ""; $image_error = ""; $actual_image_name = ""; if(!isset($_SESSION['current_login_admin'])) { header("Location:/admin/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_result_profile($up_id); unlink('../gallery/'.$image); header("Location:/admin/edit-results.php"); } if(isset($_POST['add_btn1'])) { $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(); $actual_image_name = $current_random_string.".".strtolower($ext); $tmp = $_FILES['picture']['tmp_name']; $img_Dir = "../gallery/"; if(!file_exists($img_Dir)) { mkdir($img_Dir); } if(move_uploaded_file($tmp,$img_Dir.$actual_image_name)) { } else { $image_error = "failed" ; $flag = 1; } } else { $image_error = "Invalid file format"; $flag = 1; } } } if($flag==0) { $image_name = $db->get_result_image_name_by_id($up_id); if($image_name!="") { $db->update_result_image_info($up_id,$actual_image_name); unlink('../gallery/'.$image_name); }else { $db->update_result_image_info($up_id,$actual_image_name); } $flag = 1 ; } } if(isset($_POST['add_btn'])) { $department = $_POST['department']; $semester = $_POST['semster']; $category = $_POST['category']; $rank = $_POST['rank']; $f_name = $_POST['f_name']; $marks = $_POST['marks']; if($department == 'Select Department') { $department_error ="Please select Department"; $flag = 1; } if($semester == 'Select Semester') { $semester_error = "Please select Semester"; $flag = 1; } if($category == 'Select Category') { $division_error = "Please select Category"; $flag = 1; } if($flag==0) { $db->update_results_data($up_id,$department,$semester,$category,$rank,$f_name,$marks); $succ_flag = 1 ; } } $report_details = $db->get_all_result_data_by_id($up_id); if(!empty($report_details)) { $counter =0; $id = $report_details[$counter][0]; $department = $report_details[$counter][1]; $semester = $report_details[$counter][2]; $category = $report_details[$counter][3]; $rank = $report_details[$counter][4]; $image = $report_details[$counter][5]; $f_name = $report_details[$counter][6]; $marks = $report_details[$counter][7]; } ?> <?php require_once('header.php'); ?> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Update Results </h1> <?php if($succ_flag == 1) { ?> <div class="alert alert-success"> Saved 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"> <a href="results-report.php"><-- Back To Report </a><br /><br /> <div class="panel panel-default"> <div class="panel-heading"> Update Results </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> Select Department </label> <select class="form-control" name="department"> <?php if($department != "") { ?> <option value="<?php echo $department; ?>"> <?php echo $department; ?> </option> <?php } ?> <option value="Select Department">Select Department</option> <?php $report_details = $db->get_all_department(); if(!empty($report_details)) { $counter =0; foreach($report_details as $record) { $id = $report_details[$counter][0]; $department_name= $report_details[$counter][1]; ?> <option value="<?php echo $department_name; ?>"><?php echo $department_name; ?></option> <?php $counter++; } } ?> </select> <span style="color:red;"><?php echo $department_error; ?></span> </div> <div class="form-group"> <label> Select Semester </label> <select class="form-control" name="semster"> <?php if($semester != "") { ?> <option value="<?php echo $semester; ?>"> <?php echo $semester; ?> </option> <?php } ?> <option value="Select Semester">Select Semester</option> <?php $report_details = $db->get_all_semester(); if(!empty($report_details)) { $counter =0; foreach($report_details as $record) { $id = $report_details[$counter][0]; $semester_name = $report_details[$counter][1]; ?> <option value="<?php echo $semester_name; ?>"><?php echo $semester_name; ?></option> <?php $counter++; } } ?> </select> <span style="color:red;"><?php echo $semester_error; ?></span> </div> <div class="form-group"> <label> Category </label> <select class="form-control" name="category" required> <?php if($category != "") { ?> <option value="<?php echo $category; ?>"> <?php echo $category; ?> </option> <?php } ?> <option value="Select Category">Select Category</option> <?php $report_details = $db->get_all_result_category(); if(!empty($report_details)) { $counter =0; foreach($report_details as $record) { $id = $report_details[$counter][0]; $title = $report_details[$counter][1]; ?> <option value="<?php echo $title; ?>"><?php echo $title; ?></option> <?php $counter ++; } } ?> </select> <span style="color:red;"><?php echo $division_error; ?></span> </div> <div class="form-group"> <label> Rank </label> <input class="form-control" placeholder="Enter Rank " name="rank" type="text" required value="<?php echo $rank; ?>" > </div> <div class="form-group"> <label> Name </label> <input class="form-control" placeholder="Enter Name" name="f_name" type="text" required value="<?php echo $f_name; ?>"> </div> <div class="form-group"> <label> % Marks Obtained </label> <input class="form-control" placeholder="Enter % Marks Obtained" name="marks" type="text" required value="<?php echo $marks; ?>"> </div> <button type="submit" class="btn btn-success" name="add_btn"> Update</button> <br /><br /> </form> <form role="form" method="post" enctype="multipart/form-data"> <div class="form-group"> <label> Photo </label> <br /><br /> <?php if($image != "") { ?> <a href="/gallery/<?php echo $image; ?>" target="_blank"><img src="/gallery/<?php echo $image; ?>" height="50px" width="50px" title="view"></a><br /><br /> <?php } else { ?> <img src="/images/no_image_available.png" style="height:90px;width:90px;" /><br /><br /> <?php } ?> <label><a href="edit-results.php?u_id=<?php echo $id; ?>&image=<?php echo $image; ?>">Remove Image</a></label> <br /><br /> <input class="form-control" placeholder="Enter Name" name="picture" type="file" required> <span style="color:red;"><?php echo $image_error; ?></span> </div> <button type="submit" class="btn btn-success" name="add_btn1">Update Profile</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