Skip navigation
Currently Being Moderated

Copy and paste Java script for password protecting a page?

Nov 14, 2012 10:55 AM

Tags: #web #a #password #page #protect

I need to password protect one page which I want to call my LOGIN page on a site I'm making in Dreamweaver CS5.5.  Unfortunately I know that the hosting company I'm using does not have the ability to allow me password a single directory on the server end to accomplish this (I know STRANGE)   .... SO

 

I found some code online - java script that I can just copy and paste into the <head> section of my page.  This might be a silly question but is this a 'safe' way to do this?    (I don't need anything fancy and the people whom will be accessing this page will all have the SAME password, so I don't need a registration form or anything fancier...)

 

Any thoughts?

 
Replies
  • Currently Being Moderated
    Nov 14, 2012 11:09 AM   in reply to fourwhitesocks

    I found some code online - java script that I can just copy and paste into the <head> section of my page.  This might be a silly question but is this a 'safe' way to do this?

     

    No. It's not a safe way to do it.

     

    The better way would be to use some server scripting to authenticate the login, and then to redirect to the landing page.  Are you by chance hosted on a *nix server that is running PHP?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 11:14 AM   in reply to fourwhitesocks

    No, this is not secure. Javascript solutions put all of the code in the client, where everyone can see it. You need a server side scripting solution. If everyone will have the same password, then it's pretty simple and you don't need a database.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 11:49 AM   in reply to fourwhitesocks

    This would be a good time to find out!

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 11:53 AM   in reply to fourwhitesocks

    fourwhitesocks wrote:

     

    Help, what do you think I should do?

    Move to a different hosting company that will give you the option to password protect an individual page or offer a server-side language such as PHP.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 11:54 AM   in reply to fourwhitesocks

    Help, what do you think I should do?

     

    Change hosts.  Period.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 12:01 PM   in reply to fourwhitesocks

    fourwhitesocks wrote:

    Help, what do you think I should do?

    Change hosts.

     

    Your current host is not serving your needs and you should not allow yourself to be restricted by what they cannot offer when server side password protection and PHP+database solutions are so easily and cheaply obtained elsewhere.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 12:04 PM   in reply to John Waller

    >Change hosts.

     

    Or upgrade to a plan that supports server side scripting / directory password protecting. I'm guessing you are using their free hosting?? If you are paying anything and not receiving those basic services, you are paying too much.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 12:07 PM   in reply to bregent

    bregent wrote:

     

    >Or upgrade to a plan that supports server side scripting / directory password protecting.

    If that's possible then yes although I would have thought that the current host would have already offered that option when the OP enquired about password protection.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 12:19 PM   in reply to bregent

    I agree with bregent.

    With Free Hosting, you get what you pay for.

     

    LunarPages Basic Hosting:  $5/month

    • Managed shared hosting on Linux server.
    • PHP & MySql
    • Unlimited Email accounts
    • Unlimited bandwidth
    • 24/7 tech support
    • Control Panel with 100's of scripts you can use.
    • and more...

    http://www.lpwebhosting.com/hosting/web/compare

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 4:42 AM   in reply to fourwhitesocks

    Anyway I guess if I don't want to switch hosting I still have the same problem.  Is it really that difficult to make something that has just one use ID and password which would be the same thing for every person?  Might be a great learning experience for me?

     

    Your only option here on the current host is to use javascript for your login authentication, and if you choose that approach, there is little security in it. So, really, why bother?

     

    To create a single password login authentication script in PHP is pretty simple - no database required.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 5:46 AM   in reply to fourwhitesocks

    HTML alone has no capacity for processing form data. That's why, even with a simple form, you need to use some additional processing script to send an email or to save the data. You can use a mailto: link for the form to send the email, but not only does that approach leave your email address exposed for spammers to pick up, but also such links render your form non-functional on public computers like libraries or internet cafes.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 7:56 AM   in reply to fourwhitesocks

    > That is why I think they are limited to what

    >they offer, at least that is my take on it. 

     

    What is the name of your host and which plan are you on. It seems very unlikely that a host you are paying for does not support server side scripting these days.

     

    Virtually all hosts offer solutions (often serveral different ones) for non coders to easily create sites.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 10:32 AM   in reply to fourwhitesocks

    Ah, that's too bad. From a site review for Intuit:

     

    "The trade-off for the heavy focus on easy setup for beginners is that Intuit completely lacks a number of very important advanced features, including access to MySQL databases, the ability to host more than one domain, support for scripting ...."

     

    So it appears your only option is to change hosts.  What type of content are you trying to secure?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 11:28 AM   in reply to fourwhitesocks

    The current page is password protected? So it must be using javascript as well, no?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 12:25 PM   in reply to fourwhitesocks

    It is possible to password a page on an Intuit site:

    http://community.intuit.com/posts/topquestion-how-do-i-password-protec t-a-page#

     

    but probably only on pages that you create with their site design tool.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 12:58 PM   in reply to fourwhitesocks

    >BUT I'm redoing it with Dreamweaver...that's the problem...

     

    Yeah, I see the full picture now.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points