Login   Register  
PHP Classes
elePHPant
Icontem

File: info.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Moellers Oma  >  CAuth  >  info.txt  >  Download  
File: info.txt
Role: ???
Content type: text/plain
Description: How to use the Class
Class: CAuth
authenticates users on mysql_db, with session
Author: By
Last change: Added the include directive
Date: 2002-07-01 14:27
Size: 1,136 bytes
 

Contents

Class file image Download
***************This is the Infofile for using the Class CAuth*************
Before you can use this you've to edit CSession.php and CAuth.php. Search for mysql_connect and overwrite username, password, and host with your data. Then we can use it.
It is really simple how you do that.

Just create a new instance of the Class CAuth with 
<?php
include("CAuth.php");
$auth = new CAuth(str username, str password, bool debug(optional));
?>
Now, the Script connects to the MySQL database and checks if the username or password are valid. If the system knows the user then it fetches his data, like his group and his rights on the system. Then the next thing is writing the fetched data into the session with:
<?php
$auth->write_to_session();
?>
Now you've to check if the user is authenticated or not. You can brief it with the variable 
<php 
if($auth->authenticated==1){
     HTML & PHP Code
     .
     .
     .
}
else{
     echo "You are not authenticated";
     .
     .
     .
}
?>

That's all. I hope i've described it clearly enough. If not just email to
Sven.Zurnieden@t-online.de

So long Cowboys.