Hello,
Can someone help me realize this little trick?
I would like accounts using more than 3 different ips to get a warning and/or disabled for 24hrs.
I know the mysql part to do but i cant figure out the ‘if’ for php part
Each login log their IP address and the time.
I dont understand. I have $ip variable and $row[‘ip’]
then store it in a database and make any check you want with SQL.
What don’t you understand?
User attempts to log in:
is the account locked?
No ->
- log IP and date
- allow user to proceed
Yes ->
- Is the lock timestamp more than 24 hours ago?
Yes ->
- Unlock account
- Allow user to proceed
No ->
- Do not allow user access
- Display user message
What i dont understand and know is how to begin with the code
I would have it call the methods from the login code.
If i cant see some little snippet i wouldn’t be able to figure it out… Im not that expert for this
Are you interested in investing quite a a lot time learning how to program or are you only after a quick fix for this script? If it’s the latter then I’d suggest to pay someone to fix it for you.
Well i want to learn while fixing it.
I told you the flow, and what steps there would be for the decision structures. So, code something that meets them.
- Im on mobile in another country
- If I would’ve know how i wouldn’t post in the beginner’s topic
- I understand the flow, but dont understand how to do it, even how to start.
Do you have a login process now? Or does everything need to be written?
Yes i have, and yes it stores current ip used by acct
Then that is where you want to add the additional functionality.
I think you are over thinking things and that is making them more complicated than they really are.
Well I’ve tried but cant figure out what to use so that the check will see last 3 ips used by acct and at the 4th one to get flagged/disabled
A SQL query. I will warn you though, that the idea that only three lP’s would create an issue for several users. ISP’s switch user IPs regularly, and if I were to access your site from home, work, and my phone, there are no telling how many IP’s would be generated in a weeks period.
Well… I know that. But i cant do anything about it… I need to prevent this somehow… Ppl keep giving accounts to others and I don’t like this
Do multiple people use the same account at the same time? If so I’d consider doing something like spotify and only allowing connections from one device at a time. This would annoy the real account owner and put them off sharing accounts.
I had thought at this query and wrote it down in my mobile notepad…
https://pastebin.com/T1pi373j
Now i cant figure out how to do the IF clause to check for x number ips and to execute another query…
Maybe should be like…?
If $rowd[‘ipd’] >= 3 {
Another query here to update users table and to punish the user in question
}