L
L
LiveHuman2015-10-21 00:26:57
PHP
LiveHuman, 2015-10-21 00:26:57

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

3 answer(s)
V
Vladislav Startsev, 2015-10-21
@esvlad

<?php
if(user_oplatil==1)
{
  if(date('d-m-Y')<='22-10-2015') //Срок до какого времени может читать контент
    {
      echo 'Платный контент';
    }
}
else
{
  echo 'Сначала деньги, потом контент';
}
?>

I
Ilyusha Prokopiev, 2015-10-21
@iliapro

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.

D
Dimonchik, 2015-10-21
@dimonchik2013

an example of a code is five))
guys who don’t understand anything in the code - stupidly install wordpress and screw
https://wordpress.org/plugins/simple-membership/
and payment modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question