Martin
Martin

Reputation: 43

Allow website access once per week only ? Is this possible?

Is it possible, in any of the server-side languages, to have some sort of IP-address-based access list, where any particular IP address can only access the site once a week, and once that access has been made, no more access is allowed for 7 days?

I can see how an access log can be made with IP addresses and times against them using PHP, but I'm just not sure how you'd then go about blocking access once that initial log is made and checked against a subsequent access-attempt?

Upvotes: 1

Views: 404

Answers (1)

no.
no.

Reputation: 2376

Create a table in your database which logs the IP along with the current time when a user views your site (put the script in a global file and include it on every page).

Then whenever someone comes to the site you check the IP they are using with the ones in the database.

If there is a match then the user has been there before but check to see if the stored time is 7 days old or not by comparing it to the current time. If it is older than 7 days then let them view the content, if not, redirect them to another page.

But some users have dynamic IP addresses, people can use the same IP address over the same network, you can alter your IP etc So it's not a 100% full proof way though.

Upvotes: 1

Related Questions