<?php
$must_login                    = true ;
$require_path                  = '../../../' ;
$require_sub                   = '../../' ;
require( $require_sub.'header.php' ) ;

if ( $boolean_login ){
    $status                    = '312' ;

    if ( $array['is_tick']    == 'yes' ){
    	$status   		       = '201' ;

    	$search_query          = '' ;
        $search_query         .= " AND handbook_id = '".$array['id']."'" ;

        $query                 = "SELECT handbook_id FROM handbook
                                  WHERE deleted_at IS NULL AND ( ( receiver_type IN ( '0' ) ) OR ( receiver_type IN ( '1', '2' ) AND staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) " . $search_query ;
        $mysqli_query          = $mysqli->query( $query ) ;

        if ( $mysqli_query->num_rows > 0 ){
            $status            = '200' ;

            $mysqli->query( "INSERT INTO staff_handbook
                             ( handbook_id, staff_id ) VALUES
                             ( '".$array['id']."', '".$staff_info['staff_id']."' ) " ) ;
        }
    }
}

require( $require_sub.'footer.php' ) ;
?>