PHP Classes

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    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 72%Total: 783 All time: 4,330 This week: 87Up
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
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
Picture of Bijaya Kumar  Behera
Name: Bijaya Kumar Behera <contact>
Classes: 6 packages by
Country: India India
Age: ???
All time rank: 56136 in India India
Week rank: 500 Up38 in India India Down
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

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

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 <> +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");
	$DB=mysql_connect("localhost", "root", "");mysql_select_db("test", $DB);
	$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]
		$oOTPLogin   [Object]
	$oOTPLogin=new OTPLogin($DB, $prefix, $cookiename, $otpcookietimeout, $otpsessiotimeout );
5.  check valid cookie session
	Params are:
		1. $userid Logged User Id [Integer]
		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 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  
This week:0
All time:4,330
This week:87Up
User Ratings User Comments (11)
 All time
Everything perfectly set and defined.
6 years ago (Aakash)
this is good package for me.
6 years ago (Shashi bhushan Kumar)
Excellent work! The tutorial really helped me to learn new th...
6 years ago (Shivangi)
6 years ago (Sadbhav Shah)
This script is very helpful for a young developer to work upon.
6 years ago (Zaid Haider)
helps me to y organisation
6 years ago (Bijaya Kumar)
i was searching for it from so many days.
6 years ago (Devender Deep Grover)
I found this service very helpful for my current system.
6 years ago (Hemlata Pandey)
well commented code and deployment is explained in easy steps
6 years ago (sachin upmanyu)
6 years ago (Amit Agrahari)
good package
6 years ago (AVISHEKH SINGH)
For more information send a message to info at phpclasses dot org.