Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('init', 'start_ap_session', 1);
- function start_ap_session() {
- if( !session_id() ) {
- session_start();
- if ( isset( $_SESSION['last_activity'] ) && ( time() - $_SESSION['last_activity'] > 1800) ) {
- session_unset();
- session_destroy();
- }
- $_SESSION['last_activity'] = time();
- if ( !isset( $_SESSION['records'] ) ) {
- require ABSPATH . '/FM/fmdb.php';
- $records = get_webflats();
- foreach ($records as $key => $value) {
- if ( $value->floor == 'ground floor' ) {
- unset($records[$key]);
- }
- }
- $_SESSION['records'] = $records;
- $total_disp_nr = count($records);
- foreach ( $records as $r ) {
- if ( $r->reserved == 'yes' ) {
- $total_disp_nr--;
- }
- }
- $_SESSION['disp'] = $total_disp_nr;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement