PHP Classes
elePHPant
Icontem

PHP OTP Login: Authenticate users using the computer MAC address

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (13)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-03-09 (3 months ago) RSS 2.0 feedStarStarStarStar 72%Total: 601 This week: 2All time: 4,994 This week: 358Up
Version License PHP version Categories
php-otp-login 1.0.3GNU Free Document...5Networking, PHP 5, Security
Description Author

This class can authenticate users using the computer MAC address.

It generates a script that should be downloaded and when executed it will send the computer Mac Address to the server.

Different versions of the script are served according to whether the system is based on Windows, Linux or Mac.

The class stores an OTP session record that is associated to the current logged user and the obtained Mac address for a given period of time.

A session cookie is set with expiry time valid until the OTP session ends. After that the Mac address needs to be verified again.

Innovation Award
PHP Programming Innovation award winner
December 2015
Winner
Logged user session hijacking is security concern that many sites that deal with sensitive information have.

This class implements an higher level of security by tying a logged user session to a given MAC address.

Manuel Lemos
Name: Bijaya Kumar Behera <contact>
Classes: 6 packages by
Country: India India
Age: ???
All time rank: 57031 in India India
Week rank: 183 Up18 in India India Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Details
 _____ ___________ _                 _         __   _____  _____ 
|  _  |_   _| ___ \ |               (_)       /  | |  _  ||  _  |
| | | | | | | |_/ / |     ___   __ _ _ _ __   `| | | |/' || |/' |
| | | | | | |  __/| |    / _ \ / _` | | '_ \   | | |  /| ||  /| |
\ \_/ / | | | |   | |___| (_) | (_| | | | | | _| |_\ |_/ /\ |_/ /
 \___/  \_/ \_|   \_____/\___/ \__, |_|_| |_| \___(_)___(_)\___/ 
                                __/ |                            
                               |___/        


OTPLogin 1.0.0
@desc  This light weight class can be used to add one more step secure after login using OTP from ALL pre registered Machine using MAC Addresss
@author Bijaya Kumar Behera <it.bijaya@gmail.com> +91 9911033016

system requirements
---------------------*-
1. HTTP Server with PHP Enabled
2. PHP Version >=5.3
3. Supported OS Window/Linux/Mac


How to implement OTPLogin 
---------------------------------------------------
1. Create a database "test" if not already exists
2. Import OTPLogin.sql to "test" database
3. Get a MAC Address from your system
	For Window User :
		*. Click the Run button in the Windows Start Menu.
		*. Type cmd in the Open prompt of the Run menu and click OK to launch a command prompt window.
		*. maximised the window
		*. Type ipconfig /all at the command prompt to check the network card settings.  
		*. The MAC address is listed by ipconfig under Physical Address.
		below sample markked between '==>' and '<==' is the mac addresss
		-----------------------------------------------------------------
		|Physical Address. . . . . . . . . : ==>70-54-D2-19-78-C0<==
		----------------------------------------------------------------- 
	For Linux Use
		*. Open terminal
		*. Type ifconfig and hit enter
		*. The MAC address is listed by ipconfig under HWaddr.
		below sample markked between '==>' and '<==' is the mac addresss
		----------------------------------------------------
		|Link encap:Ethernet  HWaddr ==>00:26:18:25:6E:0E<==
		----------------------------------------------------
	For Mac OS Use
		*. Open terminal
		*. Type ifconfig and hit enter
		*. The MAC address is listed by ipconfig under ether.
		below sample markked between '==>' and '<==' is the mac addresss
		----------------------------------------------------
		|ether ==>e0:34:f5:ef:d4:a0<==
		----------------------------------------------------
4. Add MAC Address record to table otplogin_macs
   Example: Suppose MAC Address is 00-C0-26-C1-2D-6C
   remove '-' or ':' & changed it UPPERCASE 
   Final MAC Address: 00C026C12D6C	
   Execute SQL Query
   INSERT INTO otplogin_macs (macadd, name, parent, active ) VALUES ( '00C026C12D6C', 'My Machine', 0, '1' ) ;
   Continue the above steps for ALl MAC Address
3. create mysql connection 
	$DB=new mysqli("localhost", "root", "", "test");
Or
	$DB=mysql_connect("localhost", "root", "");mysql_select_db("test", $DB);
Or 
	$DB= new PDO("mysql:host=localhost;dbname=test", "root", "");
4. create OTPLogin object
	Params are
		1. $DB  mySQL Connection   		   [resourece/object]
		2. $prefix  Table prefix  text     [String]
		3. $cookiename  OTP Cookie Name    [String]
		4. $otpcookietimeout OTP Cookie Timeout in sec  [Integer]
		5. $otpsessiotimeout OTP Session Timeout 	   [Integer]
	Return 
		$oOTPLogin   [Object]
	$oOTPLogin=new OTPLogin($DB, $prefix, $cookiename, $otpcookietimeout, $otpsessiotimeout );
5.  check valid cookie session
	Params are:
		1. $userid Logged User Id [Integer]
	Return
		true/false  [boolean]
	$oOTPLogin->isValid($userid)  [true/false]
6.  Initialise OTP if not started  
	Params are :
		1. $userid Logged user id  [Integer]
	Return :
		true/false  [bollean]
	$initStatus = $oOTPLogin->initOTP($userid);
7. Download OTPGenerator of your OS
	Params are :
		1. $otpurl OTP URL   [String]
		2. $userid User ID   [Integer]
		3. $info   Info      [Array]
		4. $downloadfilename Download File Name [NULL [String] ]
			NULL for Auto generated file
		5. $os OS Name    [String] [Window|Mac|Linux]
			NULL for Auto Detected OS .
	Reruen :
		Void				 [null]
	$oOTPLogin->downloadOTPGenFile($otpurl, $userid, $info, $downloadfilename, $os); 
8. verify OTP
	Params are :
		1. $userid Logged user ID [Integer]
		2. $otp    User OTP       [Integer]
	Return :
		true/false 				  [bollean]		
	$oOTPLogin->verifyOTP($userid, $otp)
  Files folder image Files  
File Role Description
Files folder imagebin (1 file, 1 directory)
Accessible without login Plain text file OTPLogin.sql Data Database schema
Accessible without login Plain text file OTPLogin_Example.php Example Example
Accessible without login Plain text file README.md Doc. Help

  Files folder image Files  /  bin  
File Role Description
Files folder imageOTPLogin (1 file)
  Accessible without login Plain text file OTPLogin.php Aux. Including Class

  Files folder image Files  /  bin  /  OTPLogin  
File Role Description
  Plain text file OTPLogin.php Class Main Class

 Version Control Unique User Downloads Download Rankings  
 100%
Total:601
This week:2
All time:4,994
This week:358Up
User Ratings User Comments (11)
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:86%StarStarStarStarStar
Tests:-
Videos:-
Overall:72%StarStarStarStar
Rank:210
 
Everything perfectly set and defined.
1 year ago (Aakash)
80%StarStarStarStarStar
this is good package for me.
1 year ago (Shashi bhushan Kumar)
80%StarStarStarStarStar
Excellent work! The tutorial really helped me to learn new th...
1 year ago (Shivangi)
80%StarStarStarStarStar
Awesome.
1 year ago (Sadbhav Shah)
80%StarStarStarStarStar
This script is very helpful for a young developer to work upon.
1 year ago (Zaid Haider)
80%StarStarStarStarStar
helps me to y organisation
1 year ago (Bijaya Kumar)
80%StarStarStarStarStar
i was searching for it from so many days.
1 year ago (Devender Deep Grover)
80%StarStarStarStarStar
I found this service very helpful for my current system.
1 year ago (Hemlata Pandey)
80%StarStarStarStarStar
well commented code and deployment is explained in easy steps
1 year ago (sachin upmanyu)
80%StarStarStarStarStar
good
1 year ago (Amit Agrahari)
60%StarStarStarStar
good package
1 year ago (AVISHEKH SINGH)
60%StarStarStarStar