Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Password Protecting Webpages

  • 10-01-2005 9:49pm
    #1
    Registered Users, Registered Users 2 Posts: 884 ✭✭✭


    Lads,

    I want to password protect a page and i am wondering how i should do it.

    Nothing to elaborate .... i am using this at the moment, and could use it with a no-right-click script but want it a bit better than that.
    <script language="javascript">
    <!--//
    /*This Script allows people to enter by using a form that asks for a
    UserID and Password*/
    function pasuser(form) {
    if (form.id.value=="pat") { 
    if (form.pass.value=="home") {              
    location="Students.html" 
    } else {
    alert("Invalid Password")
    }
    } else {  alert("Invalid UserID")
    }
    }
    //-->
    </script>
    
    <center>
    <table bgcolor="white" cellpadding="0" border="0">
    
    <tr><td><h3><i><b>UserID:</b></i></h3></td><td><form name="login">
      <input
    name="id" type="text" size="20"></td></tr>
    <tr><td><h3><i><b>Password:</b></i></h3></td><td>
      <input name="pass"
    type="password" size="20"></td></tr>
    <tr><td><center><input type="button" value="Login"
    onClick="pasuser(this.form)"></center></td><td><center><br><input
    type="Reset"></form></td></tr></table></center> 
    

    Has anyone got any ideas ..... are there any sites that would give some help ??


Comments

  • Moderators, Politics Moderators Posts: 41,239 Mod ✭✭✭✭Seth Brundle


    1. Id put the table inside the form rather than the form inside the table.
    2. Using client side scripting is not going to be secure. You need some kind of server side coding such as PHP/ASP/CGI which will do pretty much the same as the JavaScript you have there but in secret. Then every page you want protected could check to see if a session variable is set to true (or whatever!).
    What kind of server side coding does your host support?
    3. www.php-resources.com / www.aspin.com / www.cgi-resources.com / www.planet-source-code.com / www.google.com


  • Registered Users, Registered Users 2 Posts: 884 ✭✭✭Cork Skate


    To be honest ... it is a college assignment .... we cant do it server side.

    I was thinking of encrypting the script that i need to hide but cant find anything good ... any ideas ??


  • Registered Users, Registered Users 2 Posts: 721 ✭✭✭stakey


    first there is no security in that code whatsoever, granted no right click would be enabled but the fast way around that is to turn off javascript and bang you can right click.

    if you're not allowed to use server side scripting but you are hosting the site on a server then your best bet would be a .htaccess file.

    when your server looks up the page say index.htm in the content directory the first thing it looks for in that content dir is a .htaccess file if that is found it pops up a dialog for password and username otherwise if a .htaccess file isnt found it just moves on to index.htm

    there is loads of guides and tutorials on how to put one of these together, plus its bonus points for doing some research. you can also encrypt the .htaccess file so it adds an extra level of security.

    good luck


  • Registered Users, Registered Users 2 Posts: 1,169 ✭✭✭dangerman


    just on the no right click issue. I'm right in thinking Firefox ignores that right?

    As in, it'll bring up the 'This pornography is copyrighted' ;) message, but the right click menu will still show up?


  • Closed Accounts Posts: 125 ✭✭zepp


    could try doing the site in flash and program a password in there


  • Advertisement
  • Closed Accounts Posts: 2 Paul C


    You should use a .htaccess

    If you go to the website below you can create one then simply upload it to your hosting account.

    htaccess Generator


  • Moderators, Politics Moderators Posts: 41,239 Mod ✭✭✭✭Seth Brundle


    .htaccess presumably would be considered server side!


Advertisement