在用户将URL输入浏览器时对用户进行身份验证

Try the following URL: https://cms1.gre.ac.uk/collaborativeprogrammes/student/index.asp

It brings up an authentication prompt with username and password which is separate from the accounts on their site; groups of users have the same username and password to gain entry, however once inside, you log in with you own username and password.

How could I implement this? i.e. the first authentication prompt only.

If you're hosting on windows then turn on windows authentication in IIS. Your users would need their Active Directory credentials to log on.

OR

You can read this article on HTTP Authentication in PHP

Although this is an asp page, you can do this in php with .htaccess file

See this article: http://www.addedbytes.com/lab/password-protect-a-directory-with-htaccess/

See http://php.net/manual/en/features.http-auth.php

<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Text to send if user hits Cancel button';
    exit;
} else {
    echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
    echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>