I was wondering if there was a way to only display a page if a button from a previous page was clicked? For instance, I want users to pay to view articles on my site, but they could bypass everything by simply entering the url of the article they wanted to read
My question was, is 开发者_如何学Pythonthere an ifset in place that would require a button to be clicked prior to being opened? (If you have a better solution for a payment method that would display certain pages I would be open to those too...justsaying)
You will have to think (and study) how secure sites are implemented. This is more complicated than just differentiating between a button click and a page load. The way this can be done (in very rough terms) in web development is by having the user be redirected to a secure URL first where they are identified as a user who is allowed to have access, and if so, they are then redirected to your protected content.
Edit:
After seeing your comment that you are handling payment with PayPal, not much of what I said changes, but I think you should focus your study on PayPal integration. There are a lot of good resources online for that for people with little to no experience developing websites.
You can't really solve this in the browser, it needs to be solved through login or similar action on the web server. There are several CMSes (Content Management Systems, web server software for serving content) with available plugins for commercial access. I would recommend wordpress.org, joomla.org or drupal.org
Or, if you are less technically inclined, take a look at hosted solutions like squarespace.com and equivalent.
You could set a form that does a POST
to the page containing the document, setting a variable. In the page serving the document, you check if $_POST['var_name']
is set and serve the page acordingly.
Or, you could use sessions and only let authenticated users to see the documents they paid for
精彩评论