".$temp.""; } function check_login() { global $webimroot; if( !isset( $_SESSION['operator'] ) ) { if( isset($_COOKIE['webim_lite']) ) { list($login,$pwd) = split(",", $_COOKIE['webim_lite'], 2); $op = operator_by_login($login); if( $op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd ) { $_SESSION['operator'] = $op; return $op; } } $_SESSION['backpath'] = $_SERVER['PHP_SELF']; header("Location: $webimroot/operator/login.php"); exit; } return $_SESSION['operator']; } function get_logged_in() { return isset( $_SESSION['operator'] ) ? $_SESSION['operator'] : FALSE; } function login_operator($operator,$remember) { global $webimroot; $_SESSION['operator'] = $operator; if( $remember ) { $value = $operator['vclogin'].",".md5($operator['vcpassword']); setcookie('webim_lite', $value, time()+60*60*24*1000, "$webimroot/"); } else if( isset($_COOKIE['webim_lite']) ) { setcookie('webim_lite', '', time() - 3600, "$webimroot/"); } } function logout_operator() { global $webimroot; $_SESSION['operator'] = NULL; $_SESSION['backpath'] = NULL; if( isset($_COOKIE['webim_lite']) ) { setcookie('webim_lite', '', time() - 3600, "$webimroot/"); } } ?>