I have php website.
How I limit the user to login the website only with 2 devices.
So if the user try to login with other these 2 devices they can't!
I have php website.
How I limit the user to login the website only with 2 devices.
So if the user try to login with other these 2 devices they can't!
Store the IP addresses of those devices in db and at the time of login check if the user is accessing from that registered devices or not. You can get client's IP using this code in PHP. the code is :
$ip = $_SERVER['HTTP_CLIENT_IP'];
follow these steps : 1. Create a page to register the devices. 2. Access that page from the devices you want to give the pass. 3. Register the IP addresses of those devices and store it into the db. 4. And lastly from the main site at the time of login check if that device IP is in the list or not.
And of-course hide that page to register or simply delete that page for security purpose.
in the same network ip will be conflicting. in that case you can use system MAC address to resolve the conflict . the code to find the MAC address in php is ..
<?php
ob_start();
//Get the ipconfig details using system command
system('ipconfig /all');
// Capture the output into a variable
$mycom=ob_get_contents();
// Clean (erase) the output buffer
ob_clean();
$findme = "Physical";
//Search the "Physical" | Find the position of Physical text
$pmac = strpos($mycom, $findme);
// Get Physical Address
$mac=substr($mycom,($pmac+36),17);
//Display Mac Address
echo $mac;
?>