PHP Classes

File: info.txt

Recommend this page to a friend!
  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: 21 years ago
Size: 1,136 bytes


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 So long Cowboys.