PHP Classes
elePHPant
Icontem

Login Controller: Manage registration and authentication of users

Recommend this page to a friend!
  Info   View files View files (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum (8)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2009-03-12 (8 years ago) RSS 2.0 feedStarStarStarStar 68%Total: 5,653 All time: 405 This week: 700Down
Version License PHP version Categories
logincontroller 1The PHP License5PHP 5, Databases, User Management
Description Author

This package can be used to manage registration and authentication of site users. Requires PHP 5 and MySQL

It can redirect the users to pages that present forms to let the users register and login a site.

It can also process the the forms and execute several types of actions that manage user records stored in a MySQL database, like: create new user records, validate user registration and login forms, reset user password, change the user password, etc..

  Performance   Level  
Name: Dave Hale <contact>
Classes: 2 packages by
Country: United Kingdom United Kingdom
Age: 41
All time rank: 47322 in United Kingdom United Kingdom
Week rank: 1171 Down41 in United Kingdom United Kingdom Down

Details
hi and thanks for looking at my class


	 1) First thing to do is copy the dictionary folder into your root directory<br/>
	the class looks for it here.
	

	
	protected $path_to_dictionary= '/dict/dict.dic';//path from \$_SERVER['document_root']

	the class uses $_SERVER['document_root'].$path_to_dictionary 
	so not doing this means either change the code or emailing new passwords will hang the script.

	

	2) then goto the database.inc file and set up your connection

	there is two sets for my own use but i have left them in for any who can use.
	
			$host = "localhost"; //Database host.
			$user = "root"; //Database username. 
			$pass = "password"; //Database password.
			$dbase = "mydatabase"; //Database.
	

3) now create a table in the database you named above with the following structure';


-- Table structure for table `members`
--

CREATE TABLE IF NOT EXISTS `members` (
  `memberID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `memberName` char(20) NOT NULL,
  `password` varchar(64) NOT NULL,
  `email` varchar(128) NOT NULL,
  PRIMARY KEY (`memberID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;




<?php
	$loginController->display_bar();	
	$loginController->display_page();
	echo $loginController->msg;
	echo '<br/>username = '.$loginController->get_username();
	echo '<br />user ID ='.$loginController->get_userId();
?>





Now in your script you wish to include the login bar simply add a link to the css file included with this class.
the html and css for the forms / bars etc is near 100% free from script files for easy modification of the display.


include 'LoginTracker.inc'; BEFORE !!! any session_start() calls

 and then when you want the bar to display add the following line to your script.


$loginController->display_bar();



in order to display any forms associated with the class you need to display them. 
 $loginController->display_page (); This will return true if the user has pressed / entered info or false if no action is required by the class.

so you can simply use 


	 if( !$loginController->display_page ()){
		<i>do something else</i>
 	}


or 

	 $loginController->display_page (); 


and let your script carry on regardless of if the user has asked for say registration. 
The registration form will be rendered followed by anything else in your script.

		
  Files folder image Files  
File Role Description
Files folder imageclasses (1 directory)
Files folder imagecss (1 file)
Files folder imagedict (1 file)
Files folder imagehtml (5 files)
Files folder imagelogs (2 files)
Files folder imagescripts (1 file)
Accessible without login Plain text file example.php Example example script
Accessible without login Plain text file index.php Example setup info and demo script
Plain text file LoginTracker.inc Class main class file
Accessible without login Plain text file readme.txt Doc. setup info

  Files folder image Files  /  classes  
File Role Description
Files folder imagedatabase (1 file)

  Files folder image Files  /  classes  /  database  
File Role Description
  Plain text file database.inc Class database class for extends

  Files folder image Files  /  css  
File Role Description
  Accessible without login Plain text file loginControl.css Data default css

  Files folder image Files  /  dict  
File Role Description
  Accessible without login Plain text file dict.dic Data onary password file

  Files folder image Files  /  html  
File Role Description
  Accessible without login Plain text file change_PasswordForm.inc Aux. html file
  Accessible without login Plain text file forgot_password_form.inc Aux. html file
  Accessible without login Plain text file loggedinpanel.inc Aux. html file
  Accessible without login Plain text file loginForm.inc Aux. html file
  Accessible without login Plain text file user_registrationForm.inc Aux. html inc file

  Files folder image Files  /  logs  
File Role Description
  Accessible without login Plain text file database.txt Data database access log
  Accessible without login Plain text file tracefile.txt Data class process tracking logfile

  Files folder image Files  /  scripts  
File Role Description
  Accessible without login Plain text file validate_fns.inc Aux. email verify ereg script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:5,653
This week:0
All time:405
This week:700Down
User Ratings User Comments (4)
 All time
Utility:87%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:81%StarStarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:68%StarStarStarStar
Rank:507
 
that's good.
6 years ago (Nam Nguyen)
80%StarStarStarStarStar
Thank you for that!
6 years ago (Simon)
77%StarStarStarStar
Hi, I have a problem, how can i do ,i'm using PHP Version 5.
8 years ago (kasmeesee)
40%StarStarStar
It need just a little more documentation to install, (ie.
8 years ago (Francisco Garcia)
75%StarStarStarStar