How password protect a website

In order to prevent everyone on the internet have access to specific pages of your website, you can password protect them. Using RocketCake as editor, this is quite easy.



Password Protecting a Web Page


In order to password protect a web page, just select the "Password Protection" element in the right toolbar in RocketCake and add it somewhere onto the page:



You can place it anywhere on the page, wherever you like, it is only visible in the editor and won't appear in the final website:






After you placed that element, RocketCake will likely tell you that it changed the extension of the website's name to .php (from for example .html) and that it created a login page for you.


When you select that "Password Protection" element, you will see that you can enter a number of users and passwords to be used. Do this now:



Now when you upload your website to a server, a user will need to enter the correct user name and password in order to see that page. You can put that password protection element onto any page you like. Passwords and user names are shared between these pages, so you don't need to enter the users/passwords mutiple times.


That's it, now you know how to protect your website!




Useful things to know about Password Protection


These are some useful things to know about the password protection:




How to log out a user


If you want a way to log a user out again, do this: Create a new page, and add a PHP Code element into that. As code, paste the following in there:


       ini_set('session.use_trans_sid', false);

       ini_set('url_rewriter.tags','');

       session_name('rocketcakelogin');

       session_start();

       session_unset();

       session_destroy();


Now, if this page is loaded, the user will be logged out again. You can just link the page from a hyperlink with the text "log out" or similar, and place a nice text onto that page, like for example "you are now logged out". That's it.





Copyright © by Ambiera e.U.