<?php $message = ''; $id = intval($_GET['id']); //we use $_GET because data input came from the URL if (isset($_GET['id'])) { $id = trim($id); $deleteStudent = find_student($id); if ($deleteStudent) { delete_student(0, $id); delete_photo(0, $id); $message = "<div class = 'alert alert-success' style = 'width: 350px;'>Selected student has been successfully deleted.</div>"; echo "<script>"; //go back to viewMed page after 3 seconds. echo "setTimeout(function(){ document.location = '?p=viewStudent'; }, 2000);"; echo "</script>"; } else { $message = "<div class = 'alert alert-warning' style = 'width: 350px;'>Specified student cannot be found</div>"; } } ?> <html> <body> <div class="container"> <div class="row"> <div class="col-lg-4"> <?php echo $message; ?> </div> </div>
<?php $id = intval($_GET['id']); $get_info = get_photo($id); $student = find_student($id); $get_detail = get_sitinDetails($id); $id = intval($_GET['id']); $viewSitin = view_Sitin($id); ?> <html> <body> <div class="container"> <div class="row"> <div class="col-md-6"> <h3>Profile</h3> <h4> <?php echo htmlentities($student['STUDLNAME']) . ' , ' . htmlentities($student['STUDFNAME']) . ' ' . htmlentities($student['STUDMNAME']); ?> <a href="?p=addSitIn&id=<?php echo htmlentities($id); ?> "><i class="glyphicon glyphicon-plus"></i>Add Sit-in </a> </h4> <img src="photo.php?id=<?php echo htmlentities($id); ?> " height="300" width="300" style="border:2px black solid;padding:10px 10px;"/> <?php if ($get_info['stat'] == 1) { echo "<div class='alert alert-success text-center' style='max-width:300px'>Status: ACTIVE</div>";
$bytes = file_get_contents($path); $user = $_SESSION['user']; update_photo($name, $type, $bytes, $user, $id); update_student($fName, $mName, $lName, $course, $yr, $id); $message = "<div class = 'alert alert-success' style = 'width: 350px;'>{$fName} {$mName} {$lName} record has been successfully updated.</div>"; echo "<script>"; //go back to viewMed page after 3 seconds. echo "setTimeout(function(){ document.location = '?p=viewStudent'; }, 2000);"; echo "</script>"; } else { $message = "<div class = 'alert alert-warning' style = 'width: 350px;'>Invalid File.</div>"; } } } else { //if not submitted we retrieve the data from the database $studentFind = find_student($id); if ($studentFind) { $fName = $studentFind['STUDFNAME']; $mName = $studentFind['STUDMNAME']; $lName = $studentFind['STUDLNAME']; $course = $studentFind['STUDCOURSE']; $yr = $studentFind['STUDYR']; } else { $message = '<div class="alert alert-warning">The specified student record cannot be found.</div>'; } } ?> <html> <body> <div class="container"> <h4>Update Student Record</h4>