phpMember ver 0.1.0 Documentation
General Information
Please read the INSTALL file for installation instructions.
phpMember is split into three parts:
- An administration interface, accessible through http://<yourdomain>/<PathToPhpMember>/admin/
- A web interface for your members, accessible through http://<yourdomain>/<PathToPhpMember>/
- A backend, which handles protected page.
The Admin Interface
Through this web based control center, you can manage your members.
The Member Interface
Your members can sign-up and administer their account.
This version is using cookies yet, it will make more simple.
The Backend
You can protect pages from non-member visitors by inserting a code fragment below into a php-powered page so only valid member can read the page. On every page you want to protect, you have to include config.php and authentication.php. These files are in your phpMember-module-installation-directory. Authentication performed using the authenticate()-function. This function has the following syntax
string authenticate(string login, string password );
this function return error message if failed and return valid member data if succeed.
See the usage example below :
<?
require("require/config.php");
require("require/authentication.php");
$auth=authenticate($login, $password); #
authentication
?>
<html>
<head>
<title>phpMember demo</title>
</head>
<body>
<?
if ($auth[error]) {
# check whether the authentication
fail
?>
Your <b>failed-authentication-member</b>
see this "<?echo $auth[error]?>" message
<?
} else {
# the authentication success
?>
Your <b>valid-member</b> see this HTML
code.
You can personalize the page by greet your member with
their name using $auth
variable
<?
}
# end if error
?>
</body>
</html>
To supply the restricted-page with login-password you must add a login form below to the source page which set the restricted-page URL as a ref hidden input.
<form action="login.php"
method=post>
<input type=hidden name=ref value="/URL/of/restricted/page.php">
Login : <input type=text name=login><br>
Password : <input type=password name=password><br>
<input type=submit value=Login>
</form>
So theoretically there are two pages where the first page as source-page with submit-form inserted and the second page as destination-page with authenticate()-function inserted. But technically the destination-page and source-page could be the same file.