php - Password protecting site -


how password protect site? have been throwing around ideas, far site stuck similar this:

<script>    function password() { var password = prompt("enter password:"); if (password.tostring().tolowercase() == "pass") {     location.href = "siteurl";     return true; } else {        alert ("incorrect code");     return false; } } </script> 

however not hard around.

i looking going onto main site, redirected password page. if entered correctly return current page, if not unable enter. have "password page" sorted. wondering if there way redirect there , back. also, such thing require cookies see whether user has correctly imputed password?

if direct me useful information on this, appreciated.

i've added both php , javascript in tags unsure if server side scripting or not.

using php can done using session_start() , checking if user has authenticated via login page. there many many tutorials on web.

http://www.phpeasystep.com/phptu/6.html


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -