Answer the question
In order to leave comments, you need to log in
How to create paid content within a site with access time limits?
Hello! The crux of the matter is this!
I have a website where people can register freely. This site is narrowly targeted.
And inside it there is a certain text content.
How to make this content available only after payment and only for a certain (fixed) period for each individual user? (As you understand, this content is located on the site itself)
An example code with explanations is desirable.
Answer the question
In order to leave comments, you need to log in
<?php
if(user_oplatil==1)
{
if(date('d-m-Y')<='22-10-2015') //Срок до какого времени может читать контент
{
echo 'Платный контент';
}
}
else
{
echo 'Сначала деньги, потом контент';
}
?>
The essence of the idea is extremely simple. Surely, you add each registered user to the database. Create an additional line in the database that will show the end date of the paid subscription. When a person pays for a subscription, add the subscription end date to their record in the database. When a person visits the site, extract the subscription end date from the database, if this date has not yet been, upload the text for which the person has paid for, if this date has already been, then replace the information in the database - for example, with "none" - and instead of text, remind the user that it's time to pay.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question