Hi Guys,
I would like to block memeber to enter the members area from 2 different computer.
I though save user ip on registration and compare the ip address every time he logs in but I can’t find a method to find user IP address.
Any ideas?
The purpose is to deny many users to use the same uderid from many computers
Thanks
https://russian-dima.wixsite.com/meinewebsite/ip-adress
import { fetch } from 'wix-fetch';
$w.onReady(function () { });
function getIP(){
fetch('https://extreme-ip-lookup.com/json', {
method: 'get'
})
.then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json();
}
})
.then((json) => {
const ipAddress = json.query;
const country = json.country;
const city = json.city;
$w("#TXTip").text = "Your Current IP Address Is: " + ipAddress + " located in " + city + ", " + country;
return ipAddress;
});
}
Thanks for replying.
Where should I put it?
Is it possible to get mac address?
This was just an example-code, how to get the IP-Adress.
You will have to code 2-parts.
- Recognizing the IP (ok.)
- Find user-ID
…but wait, i am wondering myself, if there is not even another way to go without IP-CHECK ?
What do you think ?
You are trying to stop users to use the same user-id?
My first question would be —> Is this possible, that the same user-id can log-in from 2-different computers?.
If → YES, then my next question would be…
Am i not able to check the loged-in-state of each user?
If a user is already logged-in and another tries to log-in with the same login-data, but from another IP, am i not able to interrupt this, without the IP or MAC-verification ?
Don’t i need just to look onto the log-in-state of this user-id, to find out if the user is already ONLINE ?
If so, couldn’t i write some code which can prevent the second log-in?
These are just theoretical thoughts
@russian-dima The client sells courses.
He his afraid that all the students in the class will use the same username and password, in different times (it happens in some places on the planet).
The purpose is to avoid it by identify the user by his computer (IP or mac).
If you have better solution I’ll be happy to hear.
Ronen
Similar problem here?
@ronen This wll only work if the users have static IPs. Most home Internet users have dynamic IPs that are automatically assigned by the Internet provider.
@yisrael-wix
That means there is no possibility to get a solution for this issue?