<?php
    include '../assets/config/config.php';
    session_start();
    $GLOBALS['id']=$_SESSION['id'];
    if(!isset($_SESSION['id'])||($_SESSION['level']=='Staff'))
    {
      header('Location:../');
    }

    else{
      $now = time(); 
        
      // if($now > $_SESSION['expire']) { 
      //     session_destroy(); 
      //     header('Location:../');
      // } 
    }
    if(date('y')>2025)
    {
      header('Location:../invalid.php');
    }
?>
<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>ECI</title>
    <!-- Favicon icon -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
    <!-- Custom CSS -->
    <link href="../assets/libs/flot/css/float-chart.css" rel="stylesheet" />
    <!-- Custom CSS -->
    <link href="../dist/css/style.min.css" rel="stylesheet" />
    <link
      href="../assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.css"
      rel="stylesheet"
    />

  </head>

  <body>
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader">
      <div class="lds-ripple">
        <div class="lds-pos"></div>
        <div class="lds-pos"></div>
      </div>
    </div>
    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <div
      id="main-wrapper"
      data-layout="vertical"
      data-navbarbg="skin5"
      data-sidebartype="full"
      data-sidebar-position="absolute"
      data-header-position="absolute"
      data-boxed-layout="full"
    >
      <!-- ============================================================== -->
      <!-- Topbar header - style you can find in pages.scss -->
      <!-- ============================================================== -->
      <header class="topbar" data-navbarbg="skin5">
        <nav class="navbar top-navbar navbar-expand-md navbar-dark">
          <div class="navbar-header" data-logobg="skin5">
            <!-- ============================================================== -->
            <!-- Logo -->
            <!-- ============================================================== -->
            <a class="navbar-brand" href="dashboard.php">
              <!-- Logo icon -->
              <b class="logo-icon ps-2">
                <!--You can put here icon as well // <i class="wi wi-sunset"></i> //-->
                <!-- Dark Logo icon -->
                <img
                  src="../assets/images/logo-icon.png"
                  alt="homepage"
                  class="light-logo"
                  width="25"
                />
              </b>
              <!--End Logo icon -->
              <!-- Logo text -->
              <span class="logo-text ms-2">
                <!-- dark Logo text -->
               <!--  <img
                  src="../assets/images/logo-text.png"
                  alt="homepage"
                  class="light-logo"
                />  -->
                <h3 class="nav pt-2" style="color:lightBlue;font-weight: bold;">EXCELLENT</h3>
              </span>
              <!-- Logo icon -->
              <!-- <b class="logo-icon"> -->
              <!--You can put here icon as well // <i class="wi wi-sunset"></i> //-->
              <!-- Dark Logo icon -->
              <!-- <img src="../assets/images/logo-text.png" alt="homepage" class="light-logo" /> -->

              <!-- </b> -->
              <!--End Logo icon -->
            </a>
            <!-- ============================================================== -->
            <!-- End Logo -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Toggle which is visible on mobile only -->
            <!-- ============================================================== -->
            <a
              class="nav-toggler waves-effect waves-light d-block d-md-none"
              href="javascript:void(0)"
              ><i class="ti-menu ti-close"></i
            ></a>
          </div>
          <!-- ============================================================== -->
          <!-- End Logo -->
          <!-- ============================================================== -->
          <div
            class="navbar-collapse collapse"
            id="navbarSupportedContent"
            data-navbarbg="skin5"
          >
            <!-- ============================================================== -->
            <!-- toggle and nav items -->
            <!-- ============================================================== -->
            <ul class="navbar-nav float-start me-auto">
              <li class="nav-item d-none d-lg-block">
                <a
                  class="nav-link sidebartoggler waves-effect waves-light"
                  href="javascript:void(0)"
                  data-sidebartype="mini-sidebar"
                  ><i class="mdi mdi-menu font-24"></i
                ></a>
              </li>
              <!-- ============================================================== -->
              <!-- create new -->
              <!-- ============================================================== -->
              
              <!-- ============================================================== -->
              <!-- Search -->
              <!-- ============================================================== -->
              
            </ul>
            <!-- ============================================================== -->
            <!-- Right side toggle and nav items -->
            <!-- ============================================================== -->
            <ul class="navbar-nav float-end">
              <!-- ============================================================== -->
              <!-- Comment -->
              <!-- ============================================================== -->
              <li class="nav-item dropdown">
                <a
                  class="nav-link dropdown-toggle"
                  href="#"
                  id="navbarDropdown"
                  role="button"
                  data-bs-toggle="dropdown"
                  aria-expanded="false"
                >
                  <i class="mdi mdi-bell font-24"></i>
                </a>
              
              </li>
              <!-- ============================================================== -->
              <!-- End Comment -->
              <!-- ============================================================== -->
              <!-- ============================================================== -->
              <!-- Messages -->
              <!-- ============================================================== -->
              <li class="nav-item dropdown">
                <a
                  class="nav-link dropdown-toggle waves-effect waves-dark"
                  href="#"
                  id="2"
                  role="button"
                  data-bs-toggle="dropdown"
                  aria-expanded="false"
                >
                  <i class="font-24 mdi mdi-comment-processing"></i>
                </a>
                <ul
                  class="
                    dropdown-menu dropdown-menu-end
                    mailbox
                    animated
                    bounceInDown
                  "
                  aria-labelledby="2"
                >
                  <ul class="list-style-none">
                    <li>
                      <div class="">
                        <!-- Message -->
                        
                        <!-- Message -->
              
                        <!-- Message -->
                        <!-- <a href="javascript:void(0)" class="link border-top">
                          <div class="d-flex no-block align-items-center p-10">
                            <span
                              class="
                                btn btn-primary btn-circle
                                d-flex
                                align-items-center
                                justify-content-center
                              "
                              ><i class="mdi mdi-account fs-4"></i
                            ></span>
                            <div class="ms-2">
                              <h5 class="mb-0">Excilent Computer Institute</h5>
                              <span class="mail-desc"
                                >Education Center</span
                              >
                            </div>
                          </div>
                        </a> -->
  <!-- </span> -->
                              <!-- Message -->
          
                      </div>
                    </li>
                  </ul>
                </ul>
              </li>
              <!-- ============================================================== -->
              <!-- End Messages -->
              <!-- ============================================================== -->

              <!-- ============================================================== -->
              <!-- User profile and search -->
              <!-- ============================================================== -->
              <li class="nav-item dropdown">
                <a
                  class="
                    nav-link
                    dropdown-toggle
                    text-muted
                    waves-effect waves-dark
                    pro-pic
                  "
                  href="#"
                  id="navbarDropdown"
                  role="button"
                  data-bs-toggle="dropdown"
                  aria-expanded="false"
                >
                  <img
                    src="../assets/images/users/1.jpg"
                    alt="user"
                    class="rounded-circle"
                    width="31"
                  />
                </a>
                <ul
                  class="dropdown-menu dropdown-menu-end user-dd animated"
                  aria-labelledby="navbarDropdown"
                >
                  <a class="dropdown-item" href="user.php"
                    ><i class="mdi mdi-account me-1 ms-1"></i> User Setting</a
                  >
                  <a class="dropdown-item" href="email-Setup.php"
                    ><i class="mdi mdi-email me-1 ms-1"></i> Email Setting</a
                  >
                  <div class="dropdown-divider"></div>
                  <a class="dropdown-item" href="organization.php"
                    ><i class="mdi mdi-settings me-1 ms-1"></i> Organization
                    Setting</a
                  >
                  <div class="dropdown-divider"></div>
                  <a class="dropdown-item" href="logout.php"
                    ><i class="fa fa-power-off me-1 ms-1"></i> Logout</a
                  >
                  <div class="dropdown-divider"></div>
                  <div class="ps-4 p-10">
                  <a id="psw"
                      href="#"
                      class="btn btn-sm btn-success btn-rounded text-white">Change Password</a>
                  </div>
                </ul>
              </li>
              <!-- ============================================================== -->
              <!-- User profile and search -->
              <!-- ============================================================== -->
            </ul>
          </div>
        </nav>
      </header>
      <!-- ============================================================== -->
      <!-- End Topbar header -->
      <!-- ============================================================== -->
      <!-- ============================================================== -->
      <!-- Left Sidebar - style you can find in sidebar.scss  -->
      <!-- ============================================================== -->
      <aside class="left-sidebar" data-sidebarbg="skin5">
        <!-- Sidebar scroll-->
        <div class="scroll-sidebar">
          <!-- Sidebar navigation-->
          <nav class="sidebar-nav">
            <ul id="sidebarnav" class="pt-4">
              <li class="sidebar-item">
                <a
                  class="sidebar-link waves-effect waves-dark sidebar-link"
                  href="dashboard.php"
                  aria-expanded="false"
                  ><i class="mdi mdi-view-dashboard"></i
                  ><span class="hide-menu">Dashboard</span></a
                >
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-receipt"></i
                  ><span class="hide-menu">Students </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="registration.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> New Registration </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="students.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Student List </span></a
                    >
                  </li>
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-chart-timeline"></i
                  ><span class="hide-menu">Course </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="assign-course.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Assign Course </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="course-list.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Course List </span></a
                    >
                  </li>
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-chart-bar"></i
                  ><span class="hide-menu">Attendence </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="attendence.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Attendence Single</span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="multi-attendence.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Attendence Multi </span></a
                    >
                  </li>
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-pencil"></i
                  ><span class="hide-menu">Examination </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="student-exam.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Examination </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="results.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-note-outline"></i
                      ><span class="hide-menu"> Results </span></a
                    >
                  </li>
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-cast-connected"></i
                  ><span class="hide-menu">Student Fee </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="student-fee.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-box-shadow"></i
                      ><span class="hide-menu"> Fee List </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="pending-fee.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-box-shadow"></i
                      ><span class="hide-menu"> Pending Fee </span></a
                    >
                  </li>
                </ul>
              </li>


              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-archive"></i
                  ><span class="hide-menu">Inventory </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="inventory.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-all-inclusive"></i
                      ><span class="hide-menu"> View List </span></a
                    >
                  </li>
    
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-alert-octagram"></i
                  ><span class="hide-menu">Report </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
                  <li class="sidebar-item">
                    <a href="accounts.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-album"></i
                      ><span class="hide-menu"> Accounts </span></a>
                    <a href="reportAttendence.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-application"></i
                      ><span class="hide-menu"> Attendence </span></a>
                    <a href="reportInventory.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-album"></i
                      ><span class="hide-menu"> Inventory </span></a>
                      <a href="reportFee.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-album"></i
                      ><span class="hide-menu"> Fee </span></a>
                  </li>
              
                </ul>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link has-arrow waves-effect waves-dark"
                  href="javascript:void(0)"
                  aria-expanded="false"
                  ><i class="mdi mdi-brightness-7"></i
                  ><span class="hide-menu">Configuration </span></a
                >
                <ul aria-expanded="false" class="collapse first-level">
              
                  <li class="sidebar-item">
                    <a href="course.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-multiplication-box"></i
                      ><span class="hide-menu"> Course </span></a
                    >
                  </li>

                  <li class="sidebar-item">
                    <a href="shift.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-alert-octagon"></i
                      ><span class="hide-menu"> Shift </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="fee.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-briefcase"></i
                      ><span class="hide-menu"> Fee </span></a
                    >
                  </li>
                  <li class="sidebar-item">
                    <a href="exam.php" class="sidebar-link"
                      >&nbsp;&nbsp;&nbsp;&nbsp;<i class="mdi mdi-checkbox-multiple-marked"></i
                      ><span class="hide-menu"> Exam </span></a
                    >
                  </li>

                  
                </ul>
              </li>
              
             
           
            </ul>
          </nav>
          <!-- End Sidebar navigation -->
        </div>
        <!-- End Sidebar scroll-->
      </aside>
      <!-- ============================================================== -->
      <!-- End Left Sidebar - style you can find in sidebar.scss  -->
      <!-- ============================================================== -->
      <!-- ============================================================== -->
<div class="modal" id="psw_modal">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Change Password</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">      
                    <input type="hidden" id="id" value="<?php echo $GLOBALS['id']; ?>" class="form-control">
                    <div class="form-group">
                        <input type="password" id="psw1" class="form-control" placeholder="Enter Password">
                    </div>
                    <div class="form-group">
                        <input type="text" id="psw2" class="form-control" placeholder="Confirm Password">
                    </div>
      </div>
      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" id="save">Update</button>
      </div>

    </div>
  </div>
</div>
      <!-- Page wrapper  -->
      <!-- ============================================================== -->
      <script>
                  $('#psw').click(function(){
                        $("#psw_modal").modal('show');
                      
                  });
                  $('#save').click(function(){
                   var psw1 = $("#psw1").val();
                   var psw2 = $("#psw2").val();
                   var id = $("#id").val();   
                   alert(id);                
                   if((psw1.length === 0)||(psw2.length === 0)) {
                    showAlert('some field is empty!','warning');return 0;
                                            }  
                  if(psw1.localeCompare(psw2)!==0)
                  {
                    showAlert('Confirm Password did not Matched!','warning');return 0;
                            }                
                         $.ajax({
                             url:"core/pswChange.php",
                             method:"post",
                             data: {
                                psw1:psw1,
                                id:id,                                              
                             },
                             success: function(data){                          
                               if(data==1)
                               {
                                $("#psw_modal").modal('toggle');
                                showAlert('Password Successfully Changed!','success');
                                setTimeout(function(){window.location='logout.php';}, 2000); 
                               }
                          
                             }
                         });
                    
               });

</script>

     
      