Restrict access to your forum's HTML pages |
OverviewDescriptionThis trick allows you to restrict access to one (or more ) HTML page(s) of your forum. This trick can be useful if you want to restrict the use of internal tools that you have developed such as forms, for example.On the other hand, you can use this trick to protect HTML pages which require the execution of a Javascript function because if a member deactivates this option to see the protected page, he will not be able to use said function. For example, if you decide to protect the delete all messages from a member page , by disabling Javascript to access it, the member will not be able to execute said script (because it requires Javascript to be enabled). DemonstrationSince you have guest status, you will get this message: For my part, since my ID has been authorized, I get the following message: I just have to click on the OK button and I access the HTML page! InstallationIntroductionWarning : we draw your attention to the fact that this trick is not infallible and can be easily circumvented. Indeed, if a member deactivates Javascript from his browser, he will be able to access the protected page thanks to this trick. In other words, do not protect an HTML page that contains, for example, passwords, e-mails or any other sensitive information.Javascript & jQueryFor the next step you need to go towards Administration Control Panel (ACP) Modules HTML & Javascript Javascript codes management and create a new code - upon verifying that Javascript codes management is enabled.
Javascript CustomizationThree customizations are possible:
Protecting an HTML pageTo protect access to an HTML page, it is necessary to place this code between the tags
You need to reply to the topic in order to see the code resources Management of users authorized to view the pageThe management of users authorized to display the HTML page is managed by this line:
All you have to do is replace the
Which give :
To add a second user authorized to display the HTML page, just put a , and proceed in the same way. For example, if the second user has ID 32, I just need to complete the code as follows:
Replacement of the access management scriptIn the previous points, you installed a JS script to manage access. It is therefore necessary to retrieve the script link and replace it with yours, instead of:
Notes
|
This resource belong to this community unless differently stated. No reproduction possible without our agreement, in accordance with article L122-1 of the CPI. |