Buttons and subscriptions
-------------------------

PHP-SecureArea uses PayPal subscripion or PayPal buy now buttons.

If the purchase is made with PayPal subscriptions, then the subscription is controlled from PayPal and will be 
automatically disabled at the end of term of the subscription using an IPN from PayPal.  If the purchase is made 
via a PayPal single purchase button, the subscription is disabled using a CRON job.  You will need to set up the CRON 
jon on your server.  The advantage with using a PayPal single purchase button, is that the purchaser does not have have a 
PayPal account, where as using a PayPal button the purchaser does have to have a PayPal account.

The buttons are created for you through the admin interface.  You do not have to create the buttons yourself.


Desciption of signup process using the registration method
----------------------------------------------------------

The customer is taken to the registration form where they enter their details.  When they click on the submit
button, a new record is created in table tblusers.  The record id of the newly created record is placed into 
the custom field which is posted to PayPal.  This is needed because the record id has to be known when the
IPN comes back from PayPal to match up the fields entered.  A dummy email address is created made up of random
characters and entered into the email address field.  This is needed because the email address field in the 
table is a required field.

When PayPal sends back the IPN, the signupuser function in user.php will process differently depending on if there
is an entry in the custom field.  If the custom field is empty, it means that the registration form is not being
used and processing continues normally.  If the custom field is not empty, then a record is already created for this
user.  In this situation, the email address is updated with the correct payer email address.  The processing then 
continues and the user is created in the htaccess files.

The signed up flag in tblusers is used to indicate when the user has signed up.  For a registration method, this 
will be initially set to 0.  Only when PayPal sends back the IPN will it get changed to 1.


Description of signup process with no PayPal subscription
---------------------------------------------------------

This is really a manually created user allowing the subscription to an area without payment to PayPal.  This means
that it is possible to collect user details because the csutomer has to fill in the registration page.

The manual flag in tblpurchased_securearea is set to 1 for a manually created subscription.

The advantage of this method is that the person can pay without a subscription, so they can pay by credit card and do not 
have to be a PayPal subscriber.


Button for zero cost product
----------------------------

Putting a value of 0.00 as the product cost will allow this method to be used.

The only difference between the normal sign up screen and this screen is that the user has to enter in an email address.

The username / password is displayed to the customer after sign up is complete.

If the customer signs up again with the same email address, the application looks up the password that was originaly created and uses that again.



Meaning of Manually created flag in manage user display
-------------------------------------------------------


Manually created		Date created				Date sub due				Date expire
----------------		------------				------------				-----------

Yes						Date						Will never have 			Will have a date for non-
													a date for 					recurring subs but not for 
													manual created				subs that recure for ever
													items

No						Date						Will have a date of 		Will have a date 
													next sub due or				for non-recurring subs but not
													blank when 					for subs that recure for ever
													subscription end of
													term has been reached


If you want the CRON job to control the manual users, you should set the subscription definition to non-recuring.  If you set it to
recurring, then the CRON job will not disable it and it will last for ever.


Meaning of Subscription State and Password state in manage user display
-----------------------------------------------------------------------

Subscription state : Will be either Activated or Disabled. When a customer purchases a subscription this will be 
Activated for the period of the subscription, and will then change to Disabled when the subscription has expired. 
If the user has been created manually then the state will always be Disabled because the subscription can only 
be created and controlled by purchase of a subscription through PayPal.

Password state : Will be either Activated or Disabled. When activated, the user can login. The password will 
become disabled if the subscription for that customer has expired or if you, the administrator has disabled the 
password.

Note that for a user that has been created manually, you will have to manually disable access to the area as it 
will not be under the control of a PayPal subscription. This can be done using the supplied cron job.

