public function edit_dep($dept_id = '', $name = '')
 {
     if (loggedIn() && (privilege() === 'teacher' || privilege() === 'dppc' || privilege() === 'dupc')) {
         return 3;
     } else {
         if (loggedIn()) {
             $this->_connect();
             $this->_dept_id = $this->_db->real_escape_string(escape($dept_id));
             $this->_name = $this->_db->real_escape_string(escape($name));
             $query = "UPDATE department SET name = '" . $this->_name . "' WHERE dept_id='" . $this->_dept_id . "'";
             $result = $this->_db->query($query);
             if ($this->_db->affected_rows) {
                 if ($this->_db->error == '') {
                     $log = new Log();
                     $log->actionLog('Edited Department');
                     return 1;
                 } else {
                     die($this->_db->error);
                 }
             } else {
                 return 2;
             }
         } else {
             if (!loggedIn()) {
                 return 0;
             }
         }
     }
 }
<?php

require_once '../core/init.php';
if (!Input::exists('get')) {
    die;
    exit;
}
if (privilege() == NULL) {
    die;
} else {
    $dep = new Department();
    $del = $dep->deleteDep(Input::get('did'));
    if ($del === 'Department has been Deleted') {
        $log = new Log();
        $log->actionLog('Deleted Department');
        ?>
			<script>
				save_edit_dep();
			</script>
		<?php 
    }
    echo '<div class="alert alert-danger alert-dismissible" role="alert">';
    echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
    echo $del;
    echo '</div>';
}
require_once 'core/init.php';
if (!Session::exists('teacher_email') && !loggedIn()) {
    Redirect::to('index.php');
}
if (Input::exists('post')) {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('mobile' => array('required' => true, 'min' => 10, 'max' => 10)));
    if ($validate->passed()) {
        $dep = new Teacher();
        $add = $dep->add(Session::get('displayname'), Session::get('teacher_email'), 'teacher', Input::get('department'), Input::get('mobile'), '0');
        if ($add == 1) {
            Session::destroy();
            Redirect::to('includes/errors/not_approved.php');
            $log = new Log();
            $log->actionLog('Added Teacher');
        } else {
            if ($add == 0) {
                echo 'Temporary Error, while creating saving information.';
            }
        }
    }
}
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
    $j = 0;
    $k = 0;
    $status = "Marks was left empty of Scholar Number :-";
    while (Input::get('scholar_number' . $i)) {
        $m = new Marks();
        if (Input::get('marks' . $i) != '') {
            $mm = $m->MarksEntryLoad(Input::get('scholar_number' . $i), Input::get('c_code'), Input::get('c_dep'), Input::get('examtype'), Input::get('marks' . $i));
            if ($mm == 2) {
                $k++;
                //die("Something went wrong after Scholar number: ".Input::get('scholar_number'.$i)." . Please Try again.");
            }
        } else {
            $status = $status . Input::get('scholar_number' . $i) . ", ";
            $k++;
            $j++;
        }
        $i++;
    }
    if ($k) {
        echo "Number of rows effected:" . ($i - $k - 1) . "<br />";
    }
    if ($j != 0) {
        $log = new Log();
        $log->actionLog('Saved Marks');
        echo $status . '<br/> Rest Saved Successfully.';
    } else {
        $log = new Log();
        $log->actionLog('Saved Marks');
        echo "Saved Successfully";
    }
}
     $semester = Input::get('semester');
     $department = Input::get('department');
     $mobile = Input::get('mobile');
     $parents_mobile = Input::get('parents_mobile');
     $courses = Input::get('courses');
     $courses = explode(' ,', $courses);
     $courses = $courses[1];
     $courses_load = strtoupper(Input::get('loadcode1') . ',' . Input::get('loadcode2'));
     $courses_load = rtrim($courses_load, ',');
     $course_credits = Input::get('course_credits');
     $home_address = Input::get('home_address');
     $hostel_address = Input::get('hostel_address');
     $add = $stud->register($email, $name, $gender, $scholar_no, $category, $programme, $semester, $session, $department, $mobile, $parents_mobile, $courses, $courses_load, $home_address, $hostel_address);
     if ($add == 1) {
         $log = new Log();
         $log->actionLog('Student Registered');
         echo 1;
         $otp = new OTP();
         $otp->send($mobile);
         //Redirect::to('registration.php?step=2');
     } else {
         echo 'Something went wrong... Please try again after clicking cancel.';
     }
 } else {
     echo "Please fill the required fields : ";
     foreach ($validate->errors() as $errors) {
         switch ($errors) {
             case 'programme is required':
                 echo 'Programme, ';
                 break;
             case 'mobile is required':
     $edit = $dep->edit_course(Input::get('coursecode'), Input::get('coursename'), Input::get('department'), Input::get('credit'));
     if ($edit == 3) {
         echo '<div class="alert alert-warning alert-dismissible" role="alert">';
         echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
         echo 'Sorry, you don\'t have privilege to edit course details.';
         echo '</div>';
     } else {
         if ($edit == 2) {
             echo '<div class="alert alert-warning alert-dismissible" role="alert">';
             echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
             echo 'Nothing changed.';
             echo '</div>';
         } else {
             if ($edit == 1) {
                 $log = new Log();
                 $log->actionLog('Edited Course');
                 echo '<div class="alert alert-success alert-dismissible" role="alert">';
                 echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
                 echo 'Course details changed successfully';
                 echo '</div>';
             } else {
                 if ($edit == 0) {
                     echo '<div class="alert alert-success alert-dismissible" role="alert">';
                     echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
                     echo 'Temporary Error';
                     echo '</div>';
                 }
             }
         }
     }
 } else {
 if ($edit == 4) {
     echo '<div class="alert alert-warning alert-dismissible" role="alert">';
     echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
     echo 'Maximum no. of possible ' . Input::get('privilege') . ' exists.';
     echo '</div>';
 } else {
     if ($edit == 3) {
         echo '<div class="alert alert-warning alert-dismissible" role="alert">';
         echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
         echo 'Sorry, you don\'t have privilege to edit teacher\'s information.';
         echo '</div>';
     } else {
         if ($edit == 1) {
             $log = new Log();
             if ($teach->getApproved() == 0 && Input::get('approved') == 1) {
                 $log->actionLog('Approved Teacher');
             }
             if ($teach->getApproved() == 1 && Input::get('approved') == 0) {
                 $log->actionLog('Disapproved Teacher');
             }
             if ($teach->getBlocked() == 1 && Input::get('blocked') == 0) {
                 $log->actionLog('Unblocked Teacher');
             }
             if ($teach->getBlocked() == 0 && Input::get('blocked') == 1) {
                 $log->actionLog('Blocked Teacher');
             }
             $log->actionLog('Edited Teacher');
             echo '<div class="alert alert-success alert-dismissible" role="alert">';
             echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
             echo 'Teacher\'s information edited successfully.';
             echo '</div>';
<?php

require_once '../core/init.php';
if (!Input::exists('get')) {
    die;
}
if (privilege() == NULL) {
    die;
} else {
    $c = new Course();
    $c = $c->deleteCourse(Input::get('cid'));
    if ($c === 'Course has been Removed') {
        $log = new Log();
        $log->actionLog('Deleted Course');
        ?>
			<script>
				save_edit_c();
			</script>
		<?php 
    }
    echo '<div class="alert alert-danger alert-dismissible" role="alert">';
    echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
    echo $c;
    echo '</div>';
}
<?php

require_once '../core/init.php';
if (!Input::exists('get')) {
    die;
}
if (privilege() == NULL) {
    die;
} else {
    $dep = new Teacher();
    $del = $dep->deleteT(Input::get('tid'), Input::get('p'));
    if ($del === 'Teacher removed.') {
        $log = new Log();
        $log->actionLog('Removed Teacher');
        ?>
		<script>
			save_edit_t();
		</script>
		<?php 
    }
    echo '<div class="alert alert-danger alert-dismissible" role="alert">';
    echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
    echo $del;
    echo '</div>';
}