Search


 


    Main Menu  
  Main
  AuthMods
      Main
      Variables
      Cookie-Translations
      Functions
      Help
  Help for Administrators
  Help for End Users
     
    AuthMods - Main  
AuthMods are files that handle user authentication. They can be customized to allow X7 Chat to integrate with existing user management systems, such as bulletin boards or content management systems. This documentation covers how to program your own AuthMod. Basic knowledge of PHP and MySql is required in order to write your own AuthMod.

Throughout the course of this guide I will refer to the script that you are integrating X7 Chat with as the 'original script'.

AuthMod files are stored in /lib/auth/. The file config.php (in the root directory) controls which AuthMod file the chat room is using. The variable $X7CHAT_CONFIG['AUTH_MODE'] defines which AuthMod the chat room should load. This variable is simply the name of the AuthMod file without the .php extention.

AuthMod files have four basic jobs in an integration environment.
      1) Handle password encryption
      2) Get a user's password
      3) Change a user's password
      4) Automatically log a user into X7 Chat if they are logged into the original script.

Here is a blank authmod for you to start off with, all AuthMods must have these parts:
----------------------------------------------------------------------------------------
<?PHP
	$auth_ucookie = "X7C2U";			// Name of username cookie
	$auth_pcookie = "X7C2P";			// Name of password cookie
	$auth_register_link = "../register.php";	// Link to the registration Page
	$auth_disable_guest = true;			// Disable guest accounts
	
	// Any Cookie-Translations will have to go here
	
	function auth_encrypt($data){
		// Encrypt $data
		return $data;
	}
	
	function auth_getpass($auth_ucookie){
		// Get the password for user $_COOKIE[$auth_ucookie] (the user's username)
		return $password;
	}
	
	function change_pass($user,$newpass){
		// Change $user's password to $newpass
	}
?>

----------------------------------------------------------------------------------------
     


Powered By X7 Chat 2 © 2004 By The X7 Group