A test post for a short lived experiment

Been playing around with WordPress today wanted to see what it would take to quickly add password protection to the rss feeds. Wasn’t too hard, the quick and dirty test looked like this:

    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="RSS Feeds"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Text to send if user hits Cancel button';
        exit;
      } else {
        if (user_pass_ok($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])) {
            //  can proceed normally
        } else {
            header('WWW-Authenticate: Basic realm="My Realm"');
            header('HTTP/1.0 401 Unauthorized');
            echo 'Text to sends incorrect username and password';
            exit;
    }

Worked for what I needed…

ps have I mentioned that I like MarkDown

One thought on “A test post for a short lived experiment”

Comments are closed.