"); } fo_showLoginForm(get_option('prompt_error')); } else { // set cookie if password was validated setcookie(COOKIE_KEY, md5($login.'%'.$supplied_address), 0, parse_url(get_bloginfo('wpurl'),PHP_URL_HOST)); // Clear password protector variables unset($_POST['access_login']); unset($_POST['access_password']); unset($_POST['Submit']); // Send email notifying of SUCCESSFUL login if (get_option('notify_success') && is_email($notify_address[0])) { wp_mail( $notify_address, "[".wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)."] SUCCESS for ".$supplied_address, "Successful login at ".wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)." by ".$supplied_address."\n\nTime: ".date("H:i:s \(\G\M\TP\)")."\nIP: ".$_SERVER['REMOTE_ADDR']." (http://www.ip2location.com/".$_SERVER['REMOTE_ADDR'].")", "From: Friends Only Notification <".get_settings('admin_email').">"); } } } // Check if password cookie is set else { if (!isset($_COOKIE[COOKIE_KEY])) { fo_showLoginForm(""); } } } // This function displays the login form if the user is required to authenticate with the sentry function fo_showLoginForm($error_message) { echo " "; echo htmlentities(bloginfo('name')); echo " "; wp_head(); // Reset the CSS styles using the Meyer Reset (http://meyerweb.com/eric/tools/css/reset/) before applying CSS styles echo " "; echo "

"; echo bloginfo('name'); echo "

"; if ($error_message == NULL) { echo get_option('prompt_email'); } else { echo $error_message; } echo "

 


Administrator login >>

"; // stop at this point die(); } function fo_cleanAddress(&$value, $key) { $value = strtolower(trim($value)); } function fo_removeInvalidAddress (&$value, $key) { if (!is_email($value)) $value = NULL; } function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } ?>