Location: PHPKode > scripts > AdminPro class > adminpro-class/readme.html
<html>
<head>
<title>AdminPro Class v1.3 Readme File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
A {text-decoration: underline; color: #003F80;	text-align: center; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; }
A:Hover {text-decoration: none; color: #3163CE; }
.normal {font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 11px; text-align: justify; font-weight: bold;}
.small { font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 10px}
.header { font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-weight: bold;}
.subheader { font-family: Helvetica, Tahoma, Arial; font-size: 14px; font-weight: bold; font-style: italic; text-decoration: underline;}
.code {  font-family: "Courier New", Courier, mono; font-size: 14px; font-weight: bold; color: #000099; text-align: left}
-->
</style>
</head>

<body bgcolor="#CCCCCC">
<p class="normal"><span class="header">AdminPro Class v1.3 Readme File</span>
</p>
<hr></hr>
<table width="100%" border="0" bgcolor="#DDDDDD">
<tr>
<td class="small">
The source code included in this package is free. You can modify or pass it on under the conditions of the GNU general Public License, published by the Free Software Foundation.
</td>
</tr>
<tr>
<td class="small">
I would appreciate any comments or suggestions. Please visit www.phpclasses.org (where this package is published), if you would like to contact me.
</td>
</tr>
</table>
<hr></hr>
<p class="subheader">Contents</p>
<ul class="normal">
<table width="80%" border="0" bgcolor="#DDDDDD">
<tr><td><a href="#about">About this package</a></td></tr>
<tr><td><a href="#files">Files included in this package</a></td></tr>
<tr><td><a href="#quick">Quick installation</a></td></tr>
<tr><td><a href="#use">How to use the class</a></td></tr>
</table>
</ul>
<p class="subheader"><a name="about"></a>About AdminPro Class v1.3</p>
<p class="normal">AdminPro Class v1.3 is a User Authentication PHP Class, based on a MySQL database and the PHP Session functions, written for Websites, that need some password protected areas. The package includes a User Management PHP Application Script as well as a MySQL Table Setup PHP Application Script. The  AdminPro Class v1.3 and the application scripts have been tested on: PHP Version 4.3.7, MySQL Server Version 4.0.20 via TCP/IP, Apache HTTP Server Version 1.3 .</p>
<ul class="normal">
<u>AdminPro Class v1.3 can:</u>
<li>allow a user to login and logout via Web-based forms</li>
<li>check whether a logged user has administrator privileges</li>
<li>check whether a logged user has user group privileges</li>
<li>expire the session of an authenticated user if it passed a given session timeout</li>
<li>allow a user to use some cookie based "Remember Me" function</li>
<li>display error messages thanks to some very flexible error handling</li>
<li>point the user to the login/logout page when the user is not authenticated or the login session expired</li>
</ul>
<p class="subheader"><a name="files"></a>Files included in this package</p>
<ul>
<table width="80%" border="0">
<tr>
<td class="code" bgcolor="#DDDDDD">adminpro_class.php</td></tr>
<tr><td class="normal">The main class file. It should be included in each page, you would like to protect.</td>
</tr>
<tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminpro_config.php</td></tr>
<tr><td class="normal">The configuration file for the main class.</td>
</tr>
<tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminpro.css</td></tr>
<tr><td class="normal">The external stylesheet file for the error messages generated by the main class.</td>
</tr>
<tr>
<td class="code" bgcolor="#DDDDDD">mysql_dialog.php</td></tr>
<tr><td class="normal">The class file to send SQL commands to the MySQL database, required for the main class.</td>
</tr>
<tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminpro.sql</td></tr>
<tr><td class="normal">The SQL command to create the MySQL Table, which is required for the main class.</td>
</tr>
<tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminpro_setup.php</td></tr>
<tr><td class="normal">An application script to check your configuration file and create the MySQL Table, which is required for the main class.</td>
</tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminuser.php</td></tr>
<tr><td class="normal">The User Management application script.</td>
</tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminuser_config.php</td></tr>
<tr><td class="normal">The configuration file for the User Management application script.</td>
</tr>
<tr>
<tr>
<td class="code" bgcolor="#DDDDDD">adminuser.css</td></tr>
<tr><td class="normal">The external stylesheet file for the User Management application script.</td>
</tr>

<tr>
<td class="code" bgcolor="#DDDDDD">login.html</td></tr>
<tr><td class="normal">The default login page, that starts the User Management application script.</td>
</tr>
<tr>
<td class="code" bgcolor="#DDDDDD">logout.html</td></tr>
<tr><td class="normal">The default logout page.</td>
</tr>
<tr>
<td class="code" bgcolor="#DDDDDD">readme.html</td></tr>
<tr><td class="normal">This file.</td>
</tr>
</table>
</ul>
<p class="subheader"><a name="quick"></a>Quick installation</p>
<p class="normal">1. Open the <span class="code">adminpro_config.php</span> and follow the instructions to configure the main class. The following variables must be changed:
<ul class="normal">
<li><span class="code">$globalConfig['dbhost']</span> = "Your MySQL server host";</li> 
<li><span class="code">$globalConfig['dbuser']</span> = "Your MySQL username";</li>
<li><span class="code">$globalConfig['dbpass']</span> = "Your MySQL password";</li>
<li><span class="code">$globalConfig['dbase']</span> = "Your MySQL database name";</li>
You may leave the other variables in the configuration file unchanged.
</ul>
</p>
<p class="normal">2. Upload all files, included in this package, onto your server.
</p>
<p class="normal">3. Create the MySQL table required for the main class. There are 2 ways to do that:
<ul class="normal">
<li>Run the <span class="code">adminpro_setup.php</span> and follow the instuctions</li> 
<li>Use the SQL statement in the <span class="code">adminpro.sql</span> to create the MySQL table</li>
</ul>
</p>
<p class="normal">4. Run the <span class="code">login.html</span> to start the user management application <span class="code">adminuser.php</span>.
<p class="subheader"><a name="use"></a>How to use AdminPro Class v1.3</p>
<p class="normal">1. Use the following code on each page you would like to protect:
<ul class="normal">
Normal protected page (without administrator or user group protection):
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;?php
include(&quot;adminpro_class.php&quot;);<br>
$prot=new protect();<br>
if ($prot-&gt;showPage) {<br>
?&gt;<br>
&lt;!--- HERE COMES YOUR PHP CODE OR YOUR HTML CODE ---!&gt;<br>
&lt;?php
}
?&gt;
</td></tr></table>
<br>
Administrator protected page (without user group protection):<br>
Administrators will have always access, even if they belong in some user group.
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;?php
include(&quot;adminpro_class.php&quot;);<br>
$prot=new protect(&quot;1&quot;);<br>
if ($prot-&gt;showPage) {<br>
?&gt;<br>
&lt;!--- HERE COMES YOUR PHP CODE OR YOUR HTML CODE ---!&gt;<br>
&lt;?php
}
?&gt;
</td></tr></table>
<br>
User group protected page (without administrator protection):<br>
In this example only users of the user group "2" will have access.
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;?php
include(&quot;adminpro_class.php&quot;);<br>
$prot=new protect(&quot;0&quot;,&quot;2&quot;);<br>
if ($prot-&gt;showPage) {<br>
?&gt;<br>
&lt;!--- HERE COMES YOUR PHP CODE OR YOUR HTML CODE ---!&gt;<br>
&lt;?php
}
?&gt;
</td></tr></table>
<br>
Get the current user:
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;?php
include(&quot;adminpro_class.php&quot;);<br>
$prot=new protect();<br>
if ($prot-&gt;showPage) {<br>
$curUser=$prot->getUser();<br>
?&gt;<br>
&lt;!--- HERE COMES YOUR PHP CODE OR YOUR HTML CODE ---!&gt;<br>
&lt;?php
}
?&gt;
</td></tr></table>
</ul>
</p>
<p class="normal">2. Your login must be sent by HTTP_POST and have the following structure:
<ul class="normal">
Normal Login:
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;form action=&quot;first_protected_page_after_login.php&quot; method=&quot;POST&quot;&gt;<br>
&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;login&quot;&gt;<br>
&lt;input type=&quot;text&quot; name=&quot;userName&quot;&gt;<br>
&lt;input type=&quot;password&quot; name=&quot;userPass&quot;&gt;<br>
&lt;input type=&quot;submit&quot;&gt;<br>
&lt;/form&gt;
</td></tr></table>
<br>
Login with "Remember Me Function":<br>
The <span class="code">$globalConfig['enblRemember']</span> must be set <span class="code">true</span> to enable this function.
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;form action=&quot;first_protected_page_after_login.php&quot; method=&quot;POST&quot;&gt;<br>
&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;login&quot;&gt;<br>
&lt;input type=&quot;text&quot; name=&quot;userName&quot;&gt;<br>
&lt;input type=&quot;password&quot; name=&quot;userPass&quot;&gt;<br>
&lt;input type=&quot;radio&quot; name=&quot;userRemember&quot; value=&quot;no&quot;&gt;No<br>
&lt;input type=&quot;radio&quot; name=&quot;userRemember&quot; value=&quot;yes&quot;&gt;Yes<br>
&lt;input type=&quot;submit&quot;&gt;<br>
&lt;/form&gt;
</td></tr></table>
</ul>
</p>
<p class="normal">3. Your logout must be also sent by HTTP_POST and have the following structure:
<ul>
<table width="80%" border="0" bgcolor="#DDDDDD" class="code"><tr><td>
&lt;form action=&quot;some_existing_protected_page.php&quot; method=&quot;POST&quot;&gt;<br>
&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;logout&quot;&gt;
</td></tr></table>
</ul>
</p>

<hr></hr>
<table width="100%" border="0" bgcolor="#DDDDDD">
<tr>
<td class="small">
(c) 2004 - 2005 Giorgos Tsiledakis, Crete Greece
</td>
</tr>
</table>
<hr></hr>
</body>
</html>
Return current item: AdminPro class