Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
[PAYH] Protected Directories on the PAYH platform - RESOLVED!
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [PAYH] Protected Directories on the PAYH platform ...
[PAYH] Protected Directories on the PAYH platform - RESOLVED!
15-10-2008 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
For the benefit of all readers of this post...
Try out the new platform! Plesk is a really easy to use control panel and offers lots of features not seen by PN users before.
The Protected Directories on the PAYH platform is a very useful feature and one i would like to explore further.
But I have a question...
A user called 'Fred' logs on to my protected area via a dialog box that looks like the one driven by .htaccess protection methods. (Maybe it is?)
Anyway, once Fred has sucessfully logged on, he can write news articles and those news articles will be displayed as being authored by him which means that the PHP scripting needs to remeber who logged on.
I think you would normally refer to HTTP_USER or similar but this can not be done on the PN platform because of limitations in the PHP.ini file (I beleive)
Will this work on the new PAYH platform?
Try out the new platform! Plesk is a really easy to use control panel and offers lots of features not seen by PN users before.
The Protected Directories on the PAYH platform is a very useful feature and one i would like to explore further.
But I have a question...
A user called 'Fred' logs on to my protected area via a dialog box that looks like the one driven by .htaccess protection methods. (Maybe it is?)
Anyway, once Fred has sucessfully logged on, he can write news articles and those news articles will be displayed as being authored by him which means that the PHP scripting needs to remeber who logged on.
I think you would normally refer to HTTP_USER or similar but this can not be done on the PN platform because of limitations in the PHP.ini file (I beleive)
Will this work on the new PAYH platform?
Message 1 of 2
(2,710 Views)
1 REPLY 1
Re: Protected Directories on the PAYH platform - RESOLVED!
15-10-2008 12:03 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I really should do more homework before I post stupid questions 
I was being lazy and trying to remember the variable name for getting the user info but the paragraph and code below, kindly borrowed from http://uk.php.net/features.http-auth is exactly what I was after.
HTTP authentication with PHP
The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version. In an Apache module PHP script, it is possible to use the header() function to send an "Authentication Required" message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the predefined variables PHP_AUTH_USER, PHP_AUTH_PW, and AUTH_TYPE set to the user name, password and authentication type respectively. These predefined variables are found in the $_SERVER and $HTTP_SERVER_VARS arrays. Both "Basic" and "Digest" (since PHP 5.1.0) authentication methods are supported. See the header() function for more information.
Basic HTTP Authentication example
This doesn't work on the PN platform but does in the new PAYH version

I was being lazy and trying to remember the variable name for getting the user info but the paragraph and code below, kindly borrowed from http://uk.php.net/features.http-auth is exactly what I was after.
HTTP authentication with PHP
The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version. In an Apache module PHP script, it is possible to use the header() function to send an "Authentication Required" message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the predefined variables PHP_AUTH_USER, PHP_AUTH_PW, and AUTH_TYPE set to the user name, password and authentication type respectively. These predefined variables are found in the $_SERVER and $HTTP_SERVER_VARS arrays. Both "Basic" and "Digest" (since PHP 5.1.0) authentication methods are supported. See the header() function for more information.
Basic HTTP Authentication example
<?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>";
}
?>
This doesn't work on the PN platform but does in the new PAYH version
Message 2 of 2
(308 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [PAYH] Protected Directories on the PAYH platform ...