IP Lock

Hi,

I need someone to tell me how to lock a user on my website for 24 hours using his IP

Thanks.

Hey
First create a list or a Data Collection that will hold the users IP Addresses that you want to lock down. Then use an external API like this http://ip-api.com/json to get the users IP Address. You can use fetch to get that, there is a video on that on wixshow.com/videos.

Then when users come to your site lookup the IP Address from the API, query the Data Collection to match IP Addresses in your Data Collection with the one coming to your site. If you also check the CreatedDate in the Data Collection you can see if it has passed the 24 hour limit. If it has delete the record in the Data Collection, if not use wixLocation.to to redirect them to an informal page telling them why they got locked out.

Hope it helps you.

Ok thanks a lot, i’ll try it and i’ll get back to you if anything goes wrong