Location: PHPKode > scripts > dbum_class.inc > dbum_class-inc/dbum_doc.htm
<html>
<head>
<title>DBUM - Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Steffen Stollfuß">
<meta name="Email" content="hide@address.com">
<meta name="description" content="Documentation for DataBase User Managment">

</head>
<style type="text/css">
<!--
body {
 
 font-family: "Times New Roman", Times, serif;
}
td {
 text-align: center;
}
h1 {
 text-align: center;
}
h3,h2 {
 text-decoration: underline;
}
p {
 font-size: 14px;
}
div.code {
 text-align: left;
 background-color: #CCCCCC;
}
div.mixed {
 background-color: #33CCFF;
}
-->
</style>
<body bgcolor="">
<h1>DataBase User Managment Documentation</h1>
<p>&nbsp;</p>
<h2>Introduction</h2>
<p><strong>What can DBUM do for you ??</strong></p>
<p>DBUM should help you to managment your users and session data for your website. 
  <br>
  It based on PEAR DB class so you can use many db types like (mysql , mssql, 
  postgre7 and more )<br>
  You can use this class only with php above version 4.3.0. </p>
<p>Questions ??</p>
<p>Can i change the db Table names ??? </p>
<p>Answer !!</p>
<p>Yes you can !</p>
<div class="code">/********************************************************<br>
  define( &quot;DBUM_SESSION_TABLE&quot; , &quot;yourtablename&quot; ); <br>
  define( &quot;DBUM_USERS_TABLE&quot; , &quot;yourtablename&quot; );<br>
  define( &quot;DBUM_GROUPS_TABLE&quot; , &quot;yourtablename&quot; ); <br> <br>
  require(&quot;./dbum_class.inc&quot;); <br>
  ********************************************************/</div>
<p>Question ??</p>
<p>Can i change DBUM_MAX_FAILED_LOGINS ?</p>
<p>Answer !!</p>
<p>Yes how like tablenames !!! but you can't take no more as 98 failed logins...if 
  you use more i can't garanted that the script will run !!!<br>
  because the field in db is an smallint(2) field</p>
<div class="code">define(&quot;DBUM_MAX_FAILED_LOGINS&quot; , &quot;xx&quot; );</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Tested DB Types</h2>
<p>Have you tested another DB Types as MySQL, please can you send me a little 
  statement. thx :)</p>
<table width="50%" border="1">
  <tr>
    <td> DB Type</td>
    <td>Result</td>
    <td>Tester</td>
  </tr>
  <tr>
    <td>MySQL</td>
    <td><font color="#009933"> dev platform </font></td>
    <td>Steffen Stollfu&szlig;</td>
  </tr>
  <tr>
    <td>MySQL4</td>
    <td><font color="#009933">tested</font></td>
    <td>Steffen Stollfu&szlig;</td>
  </tr>
  <tr>
    <td> Mini SQL </td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td>MSSQL</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td>PostgreSQL</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> Oracle 7/8/8i</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> InterBase</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> ODBC (Open Database Connectivity)</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> SyBase</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> Informix</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
  <tr>
    <td> Frontbase</td>
    <td><font color="#FF0000">not tested</font></td>
    <td>--</td>
  </tr>
</table>
<p>&nbsp;</p>
<h2>Error Handling</h2>
<p><table width="75%" border="1">
<colgroup>
<col width="35%">
<col width="5%">
<col width="60%">
</colgroup>
<tr>
 <th colspan="3"> Error Constans </th>
</tr>
<tr>
<td> Constans </td> <td> Code </td> <td> Desciption </td>
</tr>
<tr>
 <td>DBUM_HACKER_ATTEMPT</td><td>  1000  </td> 
    <td>returned when anyone is try to send a string that is longer as allowed, 
      so you should always give by your input field in html (maxlength) so the 
      normal user can't send longer strings, but hacker using his own length because 
      they maniplulate the get or post fields </td>
</tr>
<tr>
 <td>DBUM_INPUT_ERROR</td><td> 1001  </td> 
    <td>returned if in the given string invalid chars</td>
</tr>
<tr>
 <td>DBUM_SQL_ERROR</td><td> 1002 </td> 
    <td> returned when a sql command goes failed</td>
</tr>
<tr>
 <td>DBUM_LOGIN_FAILED</td><td> 1003 </td> 
    <td>return if username or password wrong </td>
</tr>
<tr>
 <td>DBUM_USER_NOT_ACTIVATED</td><td> 1004 </td> 
    <td> returned if user not activated</td>
</tr>
<tr>
 <td>DBUM_USER_EXISTS</td><td> 1005 </td> 
    <td> returned if you try to create a user that exists ( username field = unique 
      id </td>
</tr>
<tr>
 <td>DBUM_CREATE_USER_FAILED</td><td> 1006 </td> <td> returned (affectedRows() != 1) when you try to create a user</td>
</tr>
<tr>
 <td>DBUM_SESSION_START_FAILED</td><td> 1007 </td>
    <td> returned when session_start() return FALSE ( run without &quot;@&quot;)</td>
</tr>
<tr>
 <td>DBUM_USER_LOCKED</td><td> 1008 </td> 
    <td>returned if a user try to login and he is locked </td>
</tr>
<tr>
 <td>DBUM_INSERT_SESSION_FAILED</td><td> 1009 </td> <td> returned if (affectedRows() != 1) after input session data  </td>
</tr>
<tr>
 <td>DBUM_UPDATE_SESSION_FAILED</td><td> 1010 </td> <td> !!! is taken out !!! </td>
</tr>
<tr>
 <td>DBUM_MAX_FAILED_LOGINS_REACHED</td><td> 1011 </td> 
    <td> thats a very important error code he comes when a user have reached his 
      failed login border...but only onetime after then the user get his locked 
      message, so you imediatly should send the user an email with his unlock 
      data or what ever you think todo... :)</td>
</tr>
<tr>
 <td>DBUM_GROUP_NOT_ACTIVATED</td><td> 1012 </td> <td> login error code if group not activated </td>
</tr>
<tr>
 <td>DBUM_GROUP_NOT_EXISTS</td><td> 1013 </td> <td> login error code if group not exists </td>
</tr>
<tr>
 <td>DBUM_NOT_LOGGED</td><td> 1014 </td> 
    <td> is_login error code is user not logged</td>
</tr>
<tr>
 <td>DBUM_LOGIN_TIMEOUT_REACHED</td><td> 1015 </td><td> is_login error code if user login timeout reached </td>
</tr>
<tr>
 <td>DBUM_UNLOCK_USER_FAILED</td><td> 1016 </td> <td> unlock_user error code if unlock goes failed </td>
</tr>
<tr>
 <td>DBUM_ACTIVATED_USER_FAILED</td><td> 1017 </td> <td> activate_user error code if activation goes failed </td>
</tr>
<tr>
 <td>DBUM_USER_NOT_EXISTS</td><td> 1018 </td> 
    <td>error code if user not exists</td>
</tr>
<tr>
 <td>DBUM_CHANGE_PASSWORD_FAILED</td><td> 1019 </td> <td> error code goes change password failed </td>
</tr>
<tr>
 <td>DBUM_CHANGE_EMAIL_FAILED</td><td> 1020 </td> <td> error code goes change email failed <br> ( !!! after email is changed user is deactivated !!! ) </td>
</tr>
<tr>
 <td>DBUM_ACCESS_DENIED</td><td> 1021 </td> <td> is_authorized error code </td>
</tr>
<tr>
 <td>DBUM_GROUP_EXISTS</td><td> 1022 </td> <td> returned if you try to create an exists group </td>
</tr>
<tr>
 <td>DBUM_USER_DELETE_FAILED</td><td> 1023 </td> 
    <td> returned if you try to delete a not exists user</td>
</tr>
<tr>
 <td>DBUM_GROUP_DELETE_FAILED</td><td> 1024 </td>
    <td> returned if you try to delete a not exists group</td>
</tr>
<tr>
 <td>DBUM_GROUP_ACTIVATE_FAILED</td><td> 1025 </td> <td> returned if activation of group goes failed </td>
</tr>
<tr>
 <td>DBUM_GROUP_DEACTIVATE_FAILED</td><td> 1026 </td> <td> return if deactivation goes failed </td>
</tr>
<tr>
 <td>DBUM_EDIT_USER_FAILED</td><td> 1027 </td> <td> returned if edit user goes failed (affectedRows() != 1) </td>
</tr>
<tr>
 <td>DBUM_GROUP_EDIT_FAILED</td><td> 1028 </td> <td> returned if edit group goes failed (affectedRows() != 1) </td>
</tr>
<tr>
 <td>DBUM_ACTION_FAILED</td><td> 1029 </td> <td> action error code returned 
        if action goes failed
      </td>
</tr>
<tr>
    <td>DBUM_EMAIL_EXISTS</td>
    <td> 1030 </td>
    <td>This error is occured if you try to change an email address with a new 
      that is already in db....and with user creat&iacute;ng it is the same</td>
</tr>
<tr>
    <td>DBUM_FORGOT_PASSWORD_FAILED</td>
    <td>1031</td>
    <td>return if change password goes failed (affectedRows() != 1)</td>
</tr>
</table>
<p>Error Hanling Example !!!</p>
<div class="code"> 
&lt;?php<br>
/*&nbsp;Only&nbsp;an&nbsp;Example&nbsp;*/<br>
/*&nbsp;How&nbsp;do&nbsp;you&nbsp;want&nbsp;to&nbsp;make&nbsp;your&nbsp;error&nbsp;handling&nbsp;is&nbsp;your&nbsp;turn&nbsp;,&nbsp;not&nbsp;my&nbsp;job..sry&nbsp;!!!<br>
<br>
*/<br>
<br>
if(&nbsp;isset(&nbsp;$_COOKIE["DBUM_SID"]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;$sess_id&nbsp;=&nbsp;$_COOKIE["DBUM_SID"];<br>
}<br>
else<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;$sess_id&nbsp;=&nbsp;NULL;<br>
}<br>
<br>
if(&nbsp;!$dbum-&gt;load_session(&nbsp;$sess_id&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;message_die(&nbsp;$dbum-&gt;err_code&nbsp;);<br>
}<br>
<br>
//&nbsp;and&nbsp;soon&nbsp;!!!<br>
<br>
<br>
  /*&nbsp;Function&nbsp;Message&nbsp;Die&nbsp;very&nbsp;helpfull....you&nbsp;can&nbsp;use&nbsp;for&nbsp;your&nbsp;scripts,&nbsp;too&nbsp;*/<br>
function&nbsp;message_die(&nbsp;$err_code&nbsp;,&nbsp;$err_title&nbsp;=&nbsp;"",&nbsp;$err_msg&nbsp;=&nbsp;"",&nbsp;$line&nbsp;=&nbsp;"",&nbsp;$file&nbsp;=&nbsp;"",&nbsp;$query&nbsp;=&nbsp;"")<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;$dbum,&nbsp;$db;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$err_code&nbsp;==&nbsp;DBUM_SQL_ERROR&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;!$debug&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$err_code&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;!!!&nbsp;SQL&nbsp;Error&nbsp;!!!&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$err_code&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Query:&nbsp;".&nbsp;$dbum-&gt;query&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;was&nbsp;in&nbsp;File:&nbsp;".&nbsp;$dbum-&gt;err_file&nbsp;".&nbsp;at&nbsp;line:&nbsp;".&nbsp;$dbum-&gt;err_line&nbsp;."&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$err_code&nbsp;&gt;=&nbsp;DBUM_HACKER_ATTEMPT&nbsp;&&&nbsp;$err_code&nbsp;&lt;=&nbsp;DBUM_ACTION_FAILED&nbsp;&&&nbsp;$err_code&nbsp;!=&nbsp;DBUM_SQL_ERROR&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;!$debug&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$err_code."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$err_code."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&lt;br&gt;";<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;err_line&nbsp;!=&nbsp;""&nbsp;||&nbsp;$dbum-&gt;err_file&nbsp;!=&nbsp;""&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;was&nbsp;in&nbsp;File:&nbsp;".&nbsp;$dbum-&gt;err_file&nbsp;".&nbsp;at&nbsp;line:&nbsp;".&nbsp;$dbum-&gt;err_line&nbsp;."&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Your&nbsp;scripts&nbsp;error&nbsp;handling&nbsp;!!!<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;$db-&gt;disconnect();<br>
&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>
}<br>
<br>
?&gt;
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>DBUM Functions</h2>
<p>// Constructor <br>
  <a href="#"> $object = new DBUM( $db , $sql_layer , $debug = FALSE )</a></p>
<p>// Public<br>
  <a href="#login" >$object-&gt;login( $username , $password )</a></p>
<p><a href="#is_login">$object-&gt;is_login( $session_id = NULL )</a></p>
<p><a href="#logout">$object-&gt;logout( $session_id = NULL )</a></p>
<p><a href="#is_autorized">$object-&gt;is_authorized( $need_level )</a></p>
<p><a href="#action">$object-&gt;action( $session_id = NULL )</a></p>
<p><a href="#create_user">$object-&gt;create_user( $user )</a></p>
<p><a href="#activated_user">$object-&gt;activated_user( $username , $activ_id )</a></p>
<p><a href="#lock_user">$object-&gt;lock_user( $username )</a></p>
<p><a href="#unlock_user">$object-&gt;unlock_user( $username , $unlock_id )</a></p>
<p><a href="#change_password">$object-&gt;change_password( $username , $old_pwd , $new_pwd , re_new_pwd )</a></p>
<p><a href="#change_email">$object-&gt;change_email( $username , $new_email )</a></p>
<p><a href="#edit_user">$object-&gt;edit_user( $user )</a></p>
<p><a href="#return_user">$object-&gt;return_user( $user_id )</a></p>
<p><a href="#delete_user">$object-&gt;delete_user( $user_id )</a></p>
<p><a href="#create_group">$object-&gt;create_group( $group )</a></p>
<p><a href="#activate_group">$object-&gt;activate_group( $group_name )</a></p>
<p><a href="#deactivate_group">$object-&gt;deactivate_group( $group_name )</a></p>
<p><a href="#edit_group">$object-&gt;edit_group( $group )</a></p>
<p><a href="#delete_group">$object-&gt;delete_group( $group_name )</a></p>
<p><a href="#load_session">$object-&gt;load_session( $sess_id , $sess_name , $sess_cache_limiter , $sess_cache_expire , $sess_cookie_params )</a></p>
<p><a href="#destroy_session">$object-&gt;destroy_session()</a></p>
<p><a href="#destroy_session">$object-&gt;install_tables( $options )</a></p>
<p>&nbsp;</p>
<h2>DBUM Fucntion Description</h2>
<h3>Constructor</h3>

<div class="code">
  &lt;?php<br>
<br>
//&nbsp;This&nbsp;should&nbsp;show&nbsp;you&nbsp;what&nbsp;you&nbsp;have&nbsp;todo,&nbsp;befor&nbsp;you&nbsp;use&nbsp;dbum&nbsp;!<br>
////////////////////////////////////////////////////////////////////////////////<br>
//&nbsp;Part&nbsp;in&nbsp;your&nbsp;config.php<br>
$debug&nbsp;=&nbsp;TRUE;&nbsp;&nbsp;//&nbsp;or&nbsp;false&nbsp;if&nbsp;your&nbsp;site&nbsp;is&nbsp;running&nbsp;public...<br>
//&nbsp;i&nbsp;use&nbsp;TRUE&nbsp;only&nbsp;for&nbsp;delevopment,&nbsp;so&nbsp;the&nbsp;pub&nbsp;user&nbsp;didn't&nbsp;know&nbsp;my&nbsp;sqldata<br>
<br>
//&nbsp;Open&nbsp;PEAR&nbsp;DB&nbsp;Connection<br>
//&nbsp;for&nbsp;more&nbsp;information&nbsp;about&nbsp;PEAR&nbsp;have&nbsp;a&nbsp;look&nbsp;at&nbsp;"pear.php.net"<br>
require_once("DB.php");<br>
require_once("./dbum_class.inc");<br>
<br>
$dsn&nbsp;=&nbsp;"dbtype://username:hide@address.com/database_name";<br>
<br>
$db&nbsp;=&nbsp;DB::connect(&nbsp;$dsn&nbsp;);<br>
<br>
if(&nbsp;DB::isError(&nbsp;$db&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;!$debug&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;$db-&gt;getMessage()&nbsp;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;printf(&nbsp;"Error&nbsp;Title:&nbsp;%s.&nbsp;&lt;br&gt;&nbsp;Error&nbsp;Message:&nbsp;%s"&nbsp;,&nbsp;$db-&gt;getMessage()&nbsp;,&nbsp;$db-&gt;UserInfo());<br>
&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>
}<br>
////////////////////////////////////////////////////////////////////////////////<br>
<br>
//&nbsp;Now&nbsp;you&nbsp;can&nbsp;open&nbsp;the&nbsp;constructor<br>
<br>
$dbum&nbsp;=&nbsp;new&nbsp;DBUM(&nbsp;$db&nbsp;,&nbsp;"mysql"&nbsp;,&nbsp;$debug&nbsp;);<br>
<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">mixed <a name="login"><b>$object-&gt;login(</b> string <b>$username</b> 
  , string <b>$password )</b></a></font></p>
<p> - check are username and password are correct strings <br>
  - make all needed entries in database <br>
  - valid chars for username are: [A-Za-z0-9] and [ _- ] <br>
  - for password are all chars valid !!! <br>
  - if max_failed_logins reached user will locked, get new password and at this 
  time [ array <strong>$object-&gt;unlock</strong> ] is set <br>
  - !!! the error &quot;DBUM_MAX_FAILED_LOGINS_REACHED&quot; will only come one 
  time, then user is locked and this error will return !!!</p>
<p>&nbsp;&nbsp;$username - Username String</p>
<p>&nbsp;&nbsp;$password - Password String</p>
<p>&nbsp;&nbsp;$mixed - if all right return an array() else bool (FALSE)</p>
<div class="mixed">&nbsp;$mixed = Array<br>
(<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[username]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[password]&nbsp;=&gt;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[user_id]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[group_id]&nbsp;=&gt; <br>
&nbsp;&nbsp;&nbsp;&nbsp;[first_name]&nbsp;=&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;[last_name]&nbsp;=&gt;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[email]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[created]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[failed_logins]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[group_name]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[group_desc]&nbsp;=&gt;&nbsp;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;[last_action]&nbsp;=&gt;&nbsp;<br>
)<br></div>

<b>Example:</b><br>
<div class="code">&lt;?php<br>
<br>
if(&nbsp;!$_SESSION["user_data"]&nbsp;=&nbsp;$dbum-&gt;login(&nbsp;$_POST["username"]&nbsp;,&nbsp;$_POST["password"]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Have&nbsp;a&nbsp;look&nbsp;at&nbsp;DBUM&nbsp;Error&nbsp;Handling&nbsp;!!!<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
<br>
/*<br>
&nbsp;&nbsp;Your&nbsp;code&nbsp;if&nbsp;all&nbsp;right&nbsp;!!!<br>
*/<br>
<br>
  ?&gt;</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="is_login"><b>$object-&gt;is_login(</b> mixed <b> 
  session_id = NULL )</b></a></font></p>
<p>- check is User logged ! <br>
  - if $timeout reached user will logout and session will destroy !!!</p>
<p><b>Example: </b> </p>
<div class="code" >
  <p>&lt;?php<br>
    // Check is user logged and isn't stored login timeout reached<br>
    // <br>
    $_SESSION["is_login"]&nbsp;=&nbsp;FALSE;<br>
    <br>
    if(&nbsp;$dbum-&gt;is_login( &nbsp;)&nbsp;) &nbsp;&nbsp;// optional you can 
    give session_id() // <br>
    {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;$_SESSION["is_login"]&nbsp;=&nbsp;TRUE;<br>
    }<br>
    else<br>
    {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Reaction&nbsp;can&nbsp;be&nbsp;!!!<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$dbum-&gt;err_code&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
    }<br>
    <br>
    /*<br>
    &nbsp;&nbsp;Your&nbsp;code&nbsp;!!!<br>
    */<br>
    ?&gt;</p>
  </div>
<p>&nbsp;</p>
<p>
<p><font size="4">bool <a name="logout"><b>$object-&gt;logout(</b> <b> )</b></a></font></p>
<p>- set &quot;session_stop&quot; , &quot;last_action&quot; and &quot;user_id&quot; 
  = ''</p>
<div class="code">&lt;?php<br>
//&nbsp;-&nbsp;set&nbsp;"session_stop"&nbsp;,&nbsp;"last_action"&nbsp;and&nbsp;"user_id"&nbsp;=&nbsp;''<br>
//&nbsp;-&nbsp;optional&nbsp;you&nbsp;can&nbsp;give&nbsp;session_id()<br>
if(&nbsp;!$dbum-&gt;logout()&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$dbum-&gt;err_code&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;query&nbsp;!=&nbsp;''&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Query:&nbsp;".&nbsp;$dbum-&gt;query&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}<br>
  ?&gt;</div>
<p></p>
<p></p>
<p><font size="4">bool <a name="is_authorized"><b>$object-&gt;is_authorized(</b>int 
  <b>$need_level )</b></a></font></p>
<p>- user must be logged , befor you can use this function !!!</p>
<div class="code">&lt;?php<br>
//&nbsp;befor&nbsp;you&nbsp;use&nbsp;it&nbsp;be&nbsp;sure&nbsp;user&nbsp;is&nbsp;login,&nbsp;if&nbsp;user&nbsp;not&nbsp;logged&nbsp;he&nbsp;get&nbsp;"FALSE"<br>
  //&nbsp;check&nbsp;is&nbsp;stored&nbsp;group&nbsp;level&nbsp;"&gt;"&nbsp;given&nbsp;need&nbsp;level&nbsp;you&nbsp;get&nbsp;false<br>
  //&nbsp;is&nbsp;it&nbsp;"&lt;="&nbsp;you&nbsp;get&nbsp;TRUE<br>
  //&nbsp;max&nbsp;levels&nbsp;"999"<br>
define("AUTH_ADMIN"&nbsp;,&nbsp;100&nbsp;);<br>
define("AUTH_USER"&nbsp;,&nbsp;900&nbsp;);<br>
<br>
<br>
if(&nbsp;!$dbum-&gt;is_authorized(&nbsp;AUTH_USER&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;err_code&nbsp;!=&nbsp;DBUM_ACCESS_DENIED&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".&nbsp;$dbum-&gt;err_code&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&nbsp;&lt;br&gt;&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;query&nbsp;!=&nbsp;''&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Query:&nbsp;".&nbsp;$dbum-&gt;query&nbsp;."&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Access&nbsp;denied";<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>
}<br>
<br>
<br>
  ?&gt;</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="action"><b>$object-&gt;action(</b> string 
  <b>$session_id = NULL )</b></a></font></p>
<p>- set &quot;last_action&quot; in SESSIONS Table with Unix Timestamp</p>
<div class="code">&lt;?php<br>
  //&nbsp;Set&nbsp;"last_action"&nbsp;in&nbsp;Session&nbsp;Table with Unix Timestamp<br>
//&nbsp;You&nbsp;can&nbsp;give&nbsp;optional&nbsp;another&nbsp;session_id,&nbsp;else&nbsp;it&nbsp;will&nbsp;take&nbsp;the&nbsp;func&nbsp;session_id()<br>
<br>
if(&nbsp;!$dbum-&gt;action()&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".$dbum-&gt;err_code."&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&nbsp;&lt;br&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;query&nbsp;!=&nbsp;""&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Query:&nbsp;".&nbsp;$dbum-&gt;query;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>
}<br>
?&gt;<br>
</div>
<p>&nbsp;</p>
<p><font size="4">string<a name="create_user"><b>$object-&gt;create_user(</b> 
  array <b>$user )</b></a></font></p>
<div class="mixed"> 
  <p> /************************************************************<br>
    * User Array build up<br>
    * - the key are constans, you can't rename it<br>
    <br><br>$user&nbsp;=&nbsp;array(&nbsp;"group_id"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"timeout"&nbsp;=&gt;&nbsp;"60",&nbsp;//&nbsp;minutes<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"activated"&nbsp;=&gt;&nbsp;"0",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"username"&nbsp;=&gt;&nbsp;"", 
    // can't be empty<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"password"&nbsp;=&gt;&nbsp;"", 
    // can't be empty<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"mobil"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"signature"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"icq"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"msn"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"aim" 
    &nbsp;=&gt;&nbsp;""&nbsp;);<bR> </p>
  </div>  
<div class="code">
  <p>&lt;?php<br>
    /***************************************************************************<br>
    &nbsp;*&nbsp;-&nbsp;check&nbsp;if&nbsp;all&nbsp;input&nbsp;data&nbsp;are&nbsp;valid&nbsp;!!!<br>
    &nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;User&nbsp;already&nbsp;exists&nbsp;!!!<br>
    &nbsp;*&nbsp;-&nbsp;generate&nbsp;an&nbsp;activation&nbsp;id&nbsp;that&nbsp;will&nbsp;return&nbsp;if&nbsp;all&nbsp;right<br>
    &nbsp;*&nbsp;-&nbsp;create&nbsp;user<br>
    &nbsp;**************************************************************************/<br>
    <br>
    <br>
    if(&nbsp;!$activ_id&nbsp;=&nbsp;$dbum-&gt;create_user(&nbsp;$user&nbsp;)&nbsp;)<br>
    {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Code:&nbsp;".$dbum-&gt;err_code."&nbsp;&lt;br&gt;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Title:&nbsp;".&nbsp;$dbum-&gt;err_title&nbsp;."&nbsp;&lt;br&gt;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Error&nbsp;Message:&nbsp;".&nbsp;$dbum-&gt;err_msg&nbsp;."&nbsp;&lt;br&gt;";<br>
    &nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;$dbum-&gt;query&nbsp;!=&nbsp;""&nbsp;)<br>
    &nbsp;&nbsp;&nbsp;&nbsp;{<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"Query:&nbsp;".&nbsp;$dbum-&gt;query;<br>
    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
    &nbsp;&nbsp;&nbsp;&nbsp;exit;<br>
    }<br>
  </p>
  <p>! Your Code if alright !</p>
  <p> ?&gt;<br>
  </p>
</div>
<p>&nbsp;</p>
<p><font size="4">bool<a name="activated_user"><b>$object-&gt;activated_user(</b> 
  string <b>$username , </b>string<b> $activ_id )</b></a></font></p>
<div class="code"> &lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;input&nbsp;data<br>
&nbsp;*&nbsp;-&nbsp;activate&nbsp;user<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;$dbum-&gt;activated_user(&nbsp;$_GET["username"]&nbsp;,&nbsp;$_GET["activ_id"]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Error&nbsp;Handling<br>
}<br>
//&nbsp;Your&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;</div>
<p>&nbsp;</p>
<p><font size="4">bool<a name="lock_user"><b>$object-&gt;lock_user(</b> string 
  <b>$username )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;set&nbsp;the&nbsp;unlock&nbsp;array<br>
  &nbsp;*&nbsp;generate&nbsp;new&nbsp;password and set it<br>
  &nbsp;*&nbsp;set&nbsp;in&nbsp;table&nbsp;users<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;lock(&nbsp;$username&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Error&nbsp;Handling<br>
}<br>
<br>
  //&nbsp;Now&nbsp;unlock array&nbsp;is&nbsp;set.<br>
//&nbsp;"id"&nbsp;and&nbsp;"username"&nbsp;you&nbsp;need&nbsp;to&nbsp;unlock&nbsp;user...and&nbsp;new&nbsp;"password"&nbsp;is&nbsp;need&nbsp;by&nbsp;user<br>
//&nbsp;Unlock&nbsp;ID<br>
  $dbum-&gt;unlock["id"]<br>
//&nbsp;Username<br>
  $dbum-&gt;unlock["username"]<br>
//&nbsp;New&nbsp;Password&nbsp;for&nbsp;user<br>
  $dbum-&gt;unlock["password"]<br>
<br>
//&nbsp;Your&nbsp;Code&nbsp;if&nbsp;alright.<br>
?&gt;
</div>  
<p>&nbsp;</p>
<p><font size="4">bool<a name="unlock_user"><b>$object-&gt;unlock_user(</b> 
  string <b>$username , </b>string<b> $unlock_id )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;input&nbsp;data<br>
&nbsp;*&nbsp;-&nbsp;set&nbsp;locked&nbsp;in&nbsp;DB&nbsp;"0"&nbsp;false&nbsp;!!!<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;unlock_user(&nbsp;$_GET["username"]&nbsp;,&nbsp;$_GET["unlock_id"]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Error&nbsp;Handling<br>
}<br>
<br>
//&nbsp;Your&nbsp;code&nbsp;if&nbsp;alright.<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool<a name="change_password"><b>$object-&gt;change_password(</b> 
  string <b>$username , </b>string<b> $old_pwd , </b>string <b>$new_pwd , </b>string <b>$re_new_pwd 
  )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
*&nbsp;-&nbsp;check&nbsp;are&nbsp;all&nbsp;given&nbsp;string&nbsp;valid<br>
*&nbsp;-&nbsp;check&nbsp;is&nbsp;new_pwd&nbsp;==&nbsp;retyp_pwd<br>
*&nbsp;-&nbsp;change&nbsp;password&nbsp;when&nbsp;old&nbsp;pwd&nbsp;is&nbsp;correct<br>
**************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;change_password($_SESSION["user_data"]["username"]&nbsp;,&nbsp;$_POST["old_pwd"]&nbsp;,&nbsp;$_POST["new_pwd"]&nbsp;,&nbsp;$_POST["retype_pwd"])&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool<a name="change_email"><b>$object-&gt;change_email(</b> string 
  <b>$username , </b>string<b> $new_email </b><b> )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;new&nbsp;email&nbsp;format&nbsp;valid<br>
&nbsp;*&nbsp;-&nbsp;generate&nbsp;new&nbsp;activation_id&nbsp;and&nbsp;set&nbsp;it&nbsp;in&nbsp;db<br>
&nbsp;*&nbsp;-&nbsp;change&nbsp;email&nbsp;,&nbsp;if&nbsp;not&nbsp;exists&nbsp;because&nbsp;email&nbsp;field&nbsp;is&nbsp;"unique_id"<br>
&nbsp;*&nbsp;&nbsp;&nbsp;and&nbsp;set&nbsp;activated&nbsp;=&nbsp;FALSE<br>
&nbsp;*&nbsp;-&nbsp;return&nbsp;activation_id<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$activ_id&nbsp;=&nbsp;$dbum-&gt;change_email(&nbsp;$_SESSION["user_data"]["username"]&nbsp;,&nbsp;$_POST["new_email"]&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;!!!&nbsp;Error&nbsp;Handling&nbsp;!!!<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;!!!&nbsp;Code&nbsp;if&nbsp;alright&nbsp;!!!<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool<a name="edit_user"><b>$object-&gt;edit_user(</b> array 
  <b>$user</b><b> )</b></a></font></p>
<div class="code">
  <p>&lt;?php<br>
    /***************************************************************************<br>
    &nbsp;*&nbsp;-&nbsp;check&nbsp;all&nbsp;data&nbsp;!!!<br>
    &nbsp;* - all data must be given.... so you must use return_user() and give 
    it to user then he must submit it with his changes the you can call edit_user()<br>
    &nbsp;*&nbsp;-&nbsp;update&nbsp;User&nbsp;data&nbsp;in&nbsp;Database<br>
    &nbsp;**************************************************************************/<br>
    <br>
    $user&nbsp;=&nbsp;array&nbsp;("timeout"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"first_name"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"last_name"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"msn"&nbsp;=&gt;&nbsp;"",<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"aim"&nbsp;=&gt;&nbsp;""&nbsp;);<br>
    <br>
    if(&nbsp;!$dbum-&gt;edit_user(&nbsp;$user&nbsp;)&nbsp;)<br>
    {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;/*<br>
    &nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
    }<br>
    //&nbsp;Code&nbsp;if&nbsp;alright<br>
    ?&gt; </p>
  </div>
<p>&nbsp;</p>
<p><font size="4">array <a name="return_user"><b>$object-&gt;return_user(</b> 
  int <b>$user_id )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
  &nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;user_id&nbsp;valid<br>
&nbsp;*&nbsp;-&nbsp;return&nbsp;all&nbsp;found&nbsp;able&nbsp;user&nbsp;data<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$user_data&nbsp;=&nbsp;$dbum-&gt;return_user(&nbsp;$user_id&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;!!!&nbsp;Error&nbsp;Handling&nbsp;!!!<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
&nbsp;<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="delete_user"><b>$object-&gt;delete_user(</b> string 
  <b>$username )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
*&nbsp;-&nbsp;check&nbsp;are&nbsp;given&nbsp;username&nbsp;valid<br>
  *&nbsp;-&nbsp;delete&nbsp;all&nbsp;userdata&nbsp;for&nbsp;given&nbsp;username<br>
***************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;delete_user($_SESSION["user_data"]["username"])&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
<br>
  //&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="create_group"><b>$object-&gt;create_group(</b> 
  mixed <b>$group )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;are&nbsp;given&nbsp;datas&nbsp;correct<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;group&nbsp;already&nbsp;exists<br>
&nbsp;*&nbsp;-&nbsp;create&nbsp;group<br>
&nbsp;**************************************************************************/<br>
<br>
  $group&nbsp;=&nbsp;array(&nbsp;"group_name"&nbsp;=&gt;&nbsp;"", // Group Name<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"group_desc"&nbsp;=&gt;&nbsp;"", 
  // Group Description<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"activated"&nbsp;=&gt;&nbsp;"",&nbsp;&nbsp;//&nbsp;"0"&nbsp;=&nbsp;false&nbsp;&nbsp;"1"&nbsp;=&nbsp;true<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"level"&nbsp;=&gt;&nbsp;""&nbsp;); 
  // Level for Authorization max &quot;999&quot;<br>
<br>
if(&nbsp;!$dbum-&gt;create_group(&nbsp;$group&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="activate_group"><b>$object-&gt;activate_group(</b> string 
  <b>$group_name )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;given&nbsp;group&nbsp;name&nbsp;valid<br>
&nbsp;*&nbsp;-&nbsp;activate&nbsp;group&nbsp;if&nbsp;exists<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;activate_group(&nbsp;$group_name&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="deactivate_group"><b>$object-&gt;deactivate_group(</b> string 
  <b>$group_name )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;group_name&nbsp;valid<br>
&nbsp;*&nbsp;-&nbsp;deactivate&nbsp;group&nbsp;if&nbsp;exists<br>
&nbsp;**************************************************************************/<br>
<br>
if(&nbsp;!$dbum-&gt;deactivate(&nbsp;$group_name&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="edit_group"><b>$object-&gt;edit_group(</b> 
  mixed <b>$group )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;if&nbsp;you&nbsp;not&nbsp;set&nbsp;level&nbsp;it&nbsp;will&nbsp;set&nbsp;to&nbsp;default&nbsp;"999"<br>
&nbsp;**************************************************************************/<br>
<br>
$group&nbsp;=&nbsp;array(&nbsp;"group_name"&nbsp;=&gt;&nbsp;"",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"group_desc"&nbsp;=&gt;&nbsp;"",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"activated"&nbsp;=&gt;&nbsp;"",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"level"&nbsp;=&gt;&nbsp;""&nbsp;);<br>
<br>
if(&nbsp;!$dbum-&gt;edit_group(&nbsp;$group&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="delete_group"><b>$object-&gt;delete_group(</b> 
  mixed <b>$group )</b></a></font></p>
<div class="code">
&lt;?php<br>
/***************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;check&nbsp;is&nbsp;given&nbsp;group_name&nbsp;valid<br>
&nbsp;*&nbsp;-&nbsp;delete&nbsp;all&nbsp;groupdata<br>
&nbsp;**************************************************************************/<br>
&nbsp;<br>
if(&nbsp;!$dbum-&gt;delete(&nbsp;$group_name&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="load_session"><b>$object-&gt;load_session(</b> 
  mixed <b>$sess_id = NULL , </b>string <b> $sess_name = &quot;DBUM_SID&quot; 
  , </b>string <b>$sess_cache_limiter = &quot;private_no_expire&quot; , </b>int 
  <b>$sess_cache_expire = &quot;0&quot; ,</b> mixed <b>$cookie_params = array() 
  )</b></a></font></p>
<div class="code">
&lt;?php<br>
//&nbsp;Will&nbsp;load&nbsp;the&nbsp;session&nbsp;is&nbsp;given&nbsp;by&nbsp;sess_id&nbsp;,<br>
//&nbsp;else&nbsp;it&nbsp;will&nbsp;start&nbsp;a&nbsp;new&nbsp;one&nbsp;and&nbsp;put&nbsp;this&nbsp;data&nbsp;to&nbsp;sessions&nbsp;table&nbsp;!!!<br>
//<br>
<br>
////////////////////////////////////////////////////////////////////////////////<br>
//&nbsp;Part&nbsp;in&nbsp;your&nbsp;config.php&nbsp;&nbsp;&nbsp;!!!&nbsp;Only&nbsp;Example&nbsp;!!!<br>
$sess_name&nbsp;=&nbsp;"PAGE_SESSION_NAME";<br>
$sess_cache_expire&nbsp;=&nbsp;1;&nbsp;&nbsp;//&nbsp;Browser&nbsp;Cache&nbsp;Time&nbsp;in&nbsp;min&nbsp;!!<br>
$sess_cache_limiter&nbsp;=&nbsp;"private_no_expire";<br>
$sess_cookie_params["ttl"]&nbsp;=&nbsp;0;&nbsp;//&nbsp;Cookie&nbsp;Live&nbsp;Time&nbsp;in&nbsp;seconds&nbsp;(&nbsp;0&nbsp;=&nbsp;browser&nbsp;restated&nbsp;)<br>
$sess_cookie_params["path"]&nbsp;=&nbsp;"/";<br>
$sess_cookie_params["domain"]&nbsp;=&nbsp;$_SERVER["HTTP_HOST"].&nbsp;dirname($_SERVER['PHP_SELF']);<br>
$sess_cookie_params["secure"]&nbsp;=&nbsp;FALSE;&nbsp;//&nbsp;Should&nbsp;Cookie&nbsp;only&nbsp;send&nbsp;by&nbsp;SSL&nbsp;Connections&nbsp;!!!<br>
//<br>
////////////////////////////////////////////////////////////////////////////////<br>
<br>
if(&nbsp;isset(&nbsp;$_COOKIE[$sess_name]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;$sess_id&nbsp;=&nbsp;$_COOKIE[$sess_name];<br>
}<br>
else<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;$sess_id&nbsp;=&nbsp;NULL;<br>
}<br>
//&nbsp;!!!&nbsp;all&nbsp;option&nbsp;are&nbsp;optional&nbsp;!!!<br>
//&nbsp;this&nbsp;run&nbsp;too&nbsp;...&nbsp;$dbum-&gt;load_session()<br>
//&nbsp;these&nbsp;are&nbsp;default&nbsp;options<br>
//&nbsp;sess_id&nbsp;=&nbsp;NULL<br>
//&nbsp;$sess_name&nbsp;=&nbsp;"DBUM_SID"<br>
//&nbsp;$sess_cache_limiter&nbsp;=&nbsp;"private_no_expire"<br>
//&nbsp;$sess_cache_expire&nbsp;=&nbsp;0<br>
//&nbsp;$sess_cookie_params["ttl"]&nbsp;=&nbsp;0;<br>
//&nbsp;$sess_cookie_params["path"]&nbsp;=&nbsp;"/";<br>
  //&nbsp;$sess_cookie_params["domain"]&nbsp;=&nbsp;&quot;yourdomainname&quot;; 
  // can be &quot;$_SERVER["HTTP_HOST"].&nbsp;dirname($_SERVER['PHP_SELF'])&quot; 
  or when u have your own domain like www.xxx.yyy you can use $_SERVER[&quot;HTTP_HOST&quot;];<br>
//&nbsp;$sess_cookie_params["secure"]&nbsp;=&nbsp;FALSE;<br>
<br>
if(&nbsp;!$dbum-&gt;load_session(&nbsp;$sess_id&nbsp;,&nbsp;$sess_name&nbsp;,&nbsp;$sess_cache_limiter&nbsp;,&nbsp;$sess_cache_expire&nbsp;,&nbsp;$sess_cookie_params&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
//&nbsp;Code&nbsp;if&nbsp;alright<br>
$session_id&nbsp;=&nbsp;session_id();<br>
?&gt;
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="destroy_session"><b>$object-&gt;destroy_session()</b></a></font></p>
<div class="code">
&lt;?php<br>
/*******************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;unset&nbsp;all&nbsp;$_SESSION&nbsp;Vars<br>
&nbsp;*&nbsp;-&nbsp;destroy&nbsp;session&nbsp;and&nbsp;go&nbsp;secure&nbsp;that&nbsp;sess_file&nbsp;was&nbsp;delete&nbsp;!!!<br>
&nbsp;******************************************************************************/<br>
&nbsp;<br>
$dbum-&gt;destroy_session();<br>
?&gt; 
</div>
<p>&nbsp;</p>
<p><font size="4">bool <a name="install_tables"><b>$object-&gt;install_tables( 
  </b> mixed <b> options )</b></a></font></p>
<div class="code">
&lt;?php<br>
/*******************************************************************************<br>
&nbsp;*&nbsp;-&nbsp;create&nbsp;needed&nbsp;tables<br>
&nbsp;*&nbsp;-&nbsp;and&nbsp;given&nbsp;groups&nbsp;and&nbsp;user<br>
  &nbsp;* - !!! you must create min one group and one user !!!<br>
&nbsp;******************************************************************************/<br>
<br>
<br>
$options&nbsp;=&n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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"activated"&nbsp;=&gt;&nbsp;"1"&nbsp;)&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br>
<br>
if(&nbsp;!$dbum-&gt;install_tables(&nbsp;$options&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;/*<br>
&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;Handling<br>
&nbsp;&nbsp;&nbsp;&nbsp;*/<br>
}<br>
<br>
echo&nbsp;"all&nbsp;tables&nbsp;";<br>
<br>
if(&nbsp;is_array(&nbsp;$options["users"]&nbsp;)&nbsp;)<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;for(&nbsp;$i&nbsp;=&nbsp;0;&nbsp;$i&nbsp;&lt;&nbsp;count($options["users"]);&nbsp;$i++&nbsp;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;"and&nbsp;user:&nbsp;".&nbsp;$options["users"][$i]["username"]&nbsp;.",&nbsp;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}<br>
echo&nbsp;"installed."<br>
$db-&gt;disconnect();<br>
exit;<br>
?&gt;
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div>
<p align="center">created by Steffen Stollfu&szlig; email: hide@address.com <br>
    DocVersion: 0.9.5 - 29-08-2003 21:46 -</p>
</div>
<p>&nbsp;</p>
</body>
</html>
Return current item: dbum_class.inc