Password protection

Posted on 2004-11-03
Last Modified: 2010-04-06

I am developing a web application and need it to protected by passwords. I was wondering if there was any way in which the users could create and save their own passwords ?

The other problem that i am thinking about it is... if the password protects and when entered correctly takes the users to is there any way that when the user types manually in the address bar it will ask him for the password...

thnks for all the help in advance..
Question by:achaljalan
    LVL 53

    Accepted Solution

    You have to do security on the server side. What do you have access to on the server?

    LVL 5

    Expert Comment

    yes this is possible.

    you can use .htaccess and .htpassword, but this is harder to let the users create their own password. (don't know what the effect is of a password protected area when users can create their own pass...)

    or you can use a PHP script for this

    short explanation of the PHP script:

    create a login form, and call this script: (be sure the username and password fields are called: username / password)


    $username = $_POST['username'];
    $password = $_POST['password'];

    //build query
    $query = "SELECT * FROM users
       WHERE username='{$username}'
       AND password='{$password}'";
    //execute query
    $result = mysql_query($query);

    //check if there are results
    if(mysql_num_rows($result) > 0){
       $_SESSION['username'] = $username
       header("Location: index1.php");
    } else {
       die("Sorry, no login details found");

    the on top of every page:

       header("Location: loginform.php");
       header("Location: loginform.php");

    something like this??...

    Author Comment


    The server i am using is the websphere application server and have full access to it...
    LVL 5

    Assisted Solution

    then you can maybe work with .htaccess if the webserver app is apache...

    otherwise you will have to use a server side scripting language
    LVL 5

    Expert Comment

    no objections... author gave no more comments so think it is solved.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now