achaljalan
asked on
Password protection
hey..
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 www.my.com/index and when entered correctly takes the users to www.my.com/index1... is there any way that when the user types www.my.com/index1 manually in the address bar it will ask him for the password...
thnks for all the help in advance..
AJ
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 www.my.com/index and when entered correctly takes the users to www.my.com/index1... is there any way that when the user types www.my.com/index1 manually in the address bar it will ask him for the password...
thnks for all the help in advance..
AJ
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The server i am using is the websphere application server and have full access to it...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no objections... author gave no more comments so think it is solved.
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)
$_SESSION['username'] = $username
header("Location: index1.php");
} else {
die("Sorry, no login details found");
}
?>
the on top of every page:
<?
if(!isset($_SESSION['usern
header("Location: loginform.php");
}
elseif(empty($_SESSION['us
header("Location: loginform.php");
}
?>
something like this??...