-2

I am currently redesigning a website and looking for a solution on how to add a paid version of the site.

For example, say I have a <select> drop-down box with 20 elements inside. However, I want 15 of these 20 elements to be disabled unless the user has a paid account. At this time, that is the extent of what I need to differentiate between free/paid versions.

I'm planning on adding the ability to register an account and log in, as well as some type of payment processor (recommendations are appreciated for this! - currently looking at using Django/Python). I just don't know how to best go about managing two different levels of the website, and allowing those additional options to paid members.

I'm working with calculators that are pure Javascript. Using Bootstrap for the page design. As far as anything else goes, I'm open.

Rygh2014
  • 135
  • 1
  • 1
  • 10
  • Probably track paid users in a database or something and then update your logic that populates that drop down, pretty straightforward stuff. – Adam H Jul 24 '18 at 20:54

2 Answers2

1

To do that, you'd have to add a field with a default value of NULL to your database, let's call it "subscription", into your users table. Then, everytime a user login to your website, fetch the subcription value and write it into a session variable. The last thing you have to do to ensure free members aren't allowed to perform any actions the subscribed members can is checking the content of the session variable while :

  1. building your html, or you could check it on the client side with javascript right after the premium element has loaded (this is for user experience only since a client can remove any html attribute whnever they want)

    and

  2. while recieving the data of the premium element on the server side, accept it if the user is premium, reject it if they're free (again, just checking the session variable should do the job).

So as you can see, it's much more about preventing free users to gain access at the paid members options than allowing paid members to browse a completly new version of the website designed specifically for them.

Community
  • 1
  • 1
0

I will try to give you a blunt idea maybe this might help you.

So lets say a user has paid for your service you can flag a token in yours app's backend if a particular user is paid or not. So whenever the user logs in your app next time you can get the status of the logged user. Once you get the status of the logged user you can enable or disable ui elements.

I hope this made some sense.

power-cut
  • 1,310
  • 1
  • 14
  • 30