May 2003
Intermediate to advanced
592 pages
14h 28m
English
New to PHP 4 is the ability to do HTTP authentication, although it is available only when running PHP as a module with Apache. HTTP authentication is a way to protect a file or directory by requiring users to enter a username and password in a pop-up window to gain access (Figure 8.1).

An authentication prompt is created using the line
header ('WWW-Authenticate: Basic realm="Some Caption"');
The realm attribute can be changed to give the box whatever description you want (for example, My Web Site in Figure 8.1).
Normally you would follow up this line with
header ('HTTP/1.0 401 ...Read now
Unlock full access