function single_user_login_uid_check() { global $wpdb; $ID = wp_get_current_user(); $logout_url = wp_logout_url(home_url()); $user_uni_uid = $_COOKIE["user_uni_uid" . $ID->user_login . ""]; $sql = "SELECT uni_hash FROM `wp_users` WHERE uni_hash='" . $user_uni_uid . "'"; $getinfo = $wpdb->get_results($sql); $check_time = $wpdb->get_results("SELECT session_time FROM `wp_users` WHERE user_login='******'"); if (!is_null($check_time)) { $time_result = $check_time[0]->session_time; } else { $time_result = time() - 2000; } if ($getinfo[0]->uni_hash != $user_uni_uid && time() - $time_result < 1800 && is_user_logged_in()) { wp_clearcookie(); myEndSession(); do_action('wp_logout'); nocache_headers(); $redirect_to = home_url(); wp_redirect($redirect_to); exit; } else { myStartSession(); if (!isset($_SESSION["LAST_ACTIVITY"])) { $_SESSION["LAST_ACTIVITY"] = time(); } elseif (time() - $_SESSION["LAST_ACTIVITY"] > 120) { $_SESSION["LAST_ACTIVITY"] = time(); } $new_time = $_SESSION["LAST_ACTIVITY"]; $sql = "UPDATE `wp_users` set `session_time`='" . $new_time . "' WHERE user_login='******'"; $wpdb->get_results($sql); } }
> <head> <?php include "inc/meta.php"; ?> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> " /> <?php wp_head(); myStartSession(); if (isset($_GET['logout'])) { myEndSession(); } elseif (isset($_GET['new_app'])) { unset($_SESSION['app_id']); unset($_SESSION['basic_form_id']); } ?> </head> <body <?php body_class($containerClass); ?> id="wordpress"> <div id="topbar"> <?php if ($_SESSION['developer_id']) { ?>