I am trying to develop a simple PHP application with quite a 2 hour free trial for my application. I need the account to deactivate after 2 hour. Donít know how to do and I also want multiple IP protection on single user
So you have an application and want to give 2 hour trial to anyone?
I would do it via registration. But unless you use Facebook, or similar profile to sign in, you can never be sure that one person will register multiple times. (Even with facebook, this isn't sure, there are lot of fake profiles).
Or, you can force users to fill bigger amount of personal data. But still, they can use fake data. And you have to protect and work with their personal data according to laws in your country.
Assuming you have a registration page, you can send them an email with a link containing a unique id as a parameter - normally I use the record id from my users table. This way you can be reasonably sure that the email address is valid. You will also need a "downloaded" field in the users table that is defaulted to 0. When the link in the email is clicked, it goes to a page that has a look if the id exists and what the value in "downloaded" is. If it is "0" then update it to "1", drop a cookie that expires in 2 hours and redirect them to your application page. (the application page must only allow users in that have an unexpired cookie otherwise it must redirect to the "buy" page) If "downloaded" is "1", redirect to the application page. If it is someone else then there will not be a cookie and he will be redirected to the "buy" page. If he forwards the email to his buddy and his buddy clicks the link first, his buddy gets the usage and he gets the "buy" page - if he clicks first, his buddy gets the "buy" page. Good luck - hope its profitable for you.