Login Script with hidden buttons
I have been using
PHP
and Javascript
for building my dads website. He wants to incorporate a login system into his website. I have the design for the login system using PHP, my problem is how do I show buttons if the person is logged in.
For Example - You have Home, Products, About Us, and Contact. Well I want to have buttons for Dealer, Distributor, and maybe other information if the user is logged in. So I will have Home, Products, About Us, Contacts, Dealer (if dealer login), Distributor (if distributor login), and so forth.
Would
Javascript
be a good way to do this or would php, maybe even both. Using Javascript to show and hide buttons, and php to check to see which buttons to show.Solution:
Regarding security, you cannot trust what comes from the client:
- The visitor can see all your code (HTML and Javascript, not PHP) and try stuff
- The visitor may not even use a browser; it's trivially easy to send a request with a script
This means hiding the buttons is good User Interface design (because you can't use them if you are not logged in). But it's not a security feature. The security feature is checking, on the server, that the visitor is logged in before each action that requires it.
If you don't intend to show the buttons, it's not useful to send the HTML and images to the browser and then hide them with Javascript. I would check with PHP.
source : http://stackoverflow.com/questions/7031/login-script-with-hidden-buttons
COMMENTS