Monday 1 September 2014

Authenticate

    if (!isset($_SERVER['PHP_AUTH_USER'])) {
            header("WWW-Authenticate: Basic realm=\"Private Area\"");
            header("HTTP/1.0 401 Unauthorized");
            print "Please enter your username and password!\n";
            exit;
        } else {
            if (($_SERVER['PHP_AUTH_USER'] == 'modaym') && ($_SERVER['PHP_AUTH_PW'] == 'modaym123#')) {
               
            } else {
                header("WWW-Authenticate: Basic realm=\"Private Area\"");
                header("HTTP/1.0 401 Unauthorized");
                print "Please enter your username and password!\n";
                exit;
            }
        }