The class libraries that intersect other CodeIgniter, Tank_auth, are simple to configure, easy to use, and the author has been updating, and is now 1.0.9. 1.0.8 has supported the CI2.0, I am now the general project is to use it, so recommend to everyone.
Steps to install Tankauth
Download the latest version of the class library (download address: http://www.konyukhov.com/soft/tank_auth/tank_auth.zip)
Unzip the file
Copy the appropriate files under Application to your Ciapplication folder.
Copy the Captcha folder to your CI folder (project directory, and application the same directory). And make sure that the directory is writable under the Web server.
Install the database (schema.sql file) structure in your MySQL database.
Open the application/config/config.php file under your CI project and change the value of $config[' Sess_use_database ' to true.
Installation is complete!
If the access appears as follows error:
Anerrorwasencountered
Inordertousethesessionclassyouarerequiredtosetanencryptionkeyinyourconfigfile.
This error message requires a key. So open config.php, after the $config[' Encryption_key '], just add a key.
Tankauth website address:http://www.konyukhov.com/soft/tank_auth/
If an error occurs, do not forget to look at the configuration files (tank_auth.php and email.php), after the installation of the library should be able to work perfectly, but according to the conditions of your server and your needs, it is best to selectively modify.
Tip: By default, the class library produces a strong system-specific password that is not portable, which means that once created, the user database cannot be exported and imported into other databases, and this feature can also be modified through configuration files.
A brief description of the Tankauth class library
The class library uses the MVC model, which means that all database-related methods are encapsulated in the model file, and that the class library itself is used for the interface of these methods. Controller (AUTH), and invokes the method in the class library to render the corresponding view (displayed in the browser or sent by email). The controller contains the following methods:
Login: The user logs on to the website. If the login is successful and the user account is active, the user will be redirected to the first page. If it is not activated, Send_again will be called (see below). If the login fails, the user will remain on the same page (login page);
Logout: Log off the user.
Register: Registered users to the site. If the registration succeeds, a user account is created. If the value of the Email_activation entry in the configuration file is set to True, the user needs to activate the account by clicking on a special connection sent to the email, otherwise activated by default. Please note: Users are not authenticated by login after registration and still need to log in.
Send_again: Send the activation email again to the same or new email address. This method is called every time that the user is logged on as an activation. This feature is useful when a user has not received a letter due to a mailbox problem or an incorrect emial address. Users can change their email or stay the same.
Activate: Activate user account. Usually this method is activated by clicking on the link in the email call. You can activate your account by clicking on "Forgotpassword" and entering an email. The user is authenticated by the user's ID and verification code in the URL.
Forgot_password: Generates a special reset code (in order to change the password) and sends it to the user. It is obvious that the user will use this method when they forget the password.
Reset_password: Replace the old (forgotten) password with a new (user-set) password. This method can be called by clicking the connection in the message. The user is authenticated by the user's ID and verification code in the URL.
Change_password: "Normal" password modification (compared to resetting the password). Can only be called when the user is logged on and activated. To ensure security, you still need to verify user secrets.
Change_email: Modify the user's email. Can only be called when the user is logged on and activated. To ensure security, you still need to verify user secrets. This new email will only be activated by clicking on the link sent to this email.
Reset_email: Activate the new email address and replace it with a new email address. You can call this method by clicking the link in the message. The user is authenticated by the user's ID and verification code in the URL.
Unregister: Delete the user account. Can only be called when the user is logged on and activated. To ensure security, you still need to verify user secrets.
Since the Auth controller manages the user's methods (including login and logoff), you may not necessarily have to call the methods in the class library directly. But here are some things to call:
Is_logged_in: Detects if the user is logged on to the website.
GET_USER_ID: Returns False if the user logs in and obtains the user ID.
Get_username: Gets the user name of the authenticated user, otherwise returns false. If the user name is not registered, calling this method is meaningless (at which point any user will return an empty string).