[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Password protection

Posted on 2004-11-03
7
Medium Priority
?
200 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:achaljalan
  • 3
5 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 252 total points
ID: 12487331
You have to do security on the server side. What do you have access to on the server?

Cd&
0
 
LVL 5

Expert Comment

by:php-webdesign
ID: 12490754
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:

<?
if(!isset($_SESSION['username'])){
   header("Location: loginform.php");
}
elseif(empty($_SESSION['username'])){
   header("Location: loginform.php");
}
?>

something like this??...
0
 

Author Comment

by:achaljalan
ID: 12491562

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

Assisted Solution

by:php-webdesign
php-webdesign earned 248 total points
ID: 12491985
then you can maybe work with .htaccess if the webserver app is apache...

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

Expert Comment

by:php-webdesign
ID: 12781389
no objections... author gave no more comments so think it is solved.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

872 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