473,443 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

General Web Prgrming. - Where is this password stored?

I'm working on a site that has been left to die for a few years. There is a login to access a certain part of the site. I can't figure out where this password is stored.

When the private html page is accessed the box pops up asking for credentials. It says 'A username and password are being requested by http://www..com. The site says: "Restricted Area"'

If incorrect credentials are supplied it gives a 401 error. Suggestions?

If it helps, its running on a centos linux box. (I think).

Thanks!
May 29 '09 #1
8 2684
Markus
6,050 Expert 4TB
@DevInCode
Could be a .htaccess restriction (look for an .htaccess file - it will be hidden, usually) or it may be happening on the server (apache, whatever).
May 29 '09 #2
I see, I can see the user name, but obviously the password is blanked out. That isn't the issue though. I really don't want the popup box on the webpage, its just a poor way of asking for information. Is it possible I could get this information from the user then authenticate with PHP?
May 29 '09 #3
Markus
6,050 Expert 4TB
@DevInCode
You could do it all with PHP, sure.

Store the username and a hash of the password in some sort of database (can be flat-file, or in a database such as MySQL).

On pages that need a level of restriction, require the user to enter a username and password, compare these to the stored values. If they match, awesome, let the in. If not, refuse them access.
May 29 '09 #4
I can do it with a database, yes. But is there any way to to it with the passwd file?
May 29 '09 #5
Markus
6,050 Expert 4TB
@DevInCode
The passwd file? If the password is stored inside it, then yes.
May 29 '09 #6
The user seems to match without a problem, but when I enter the password it never finds a match. When I print out the hashed password the user entered and the password from the passwd file, they look identical. Why aren't they matching?

ideas?

Expand|Select|Wrap|Line Numbers
  1.  
  2. foreach ($data as $line)
  3.     {
  4.   $arr = explode(":", $line);
  5.  
  6.  
  7.  
  8.   // if username matches
  9.   // test password 
  10.  
  11.       if ($arr[0] === $user)
  12.       {
  13.         $temp .= $user;
  14.         $temp .= "|";
  15.         $temp .= $arr[0];
  16.           // get salt and crypt()
  17.           $salt = substr($arr[1], 0, 2);
  18.           echo "user found";
  19.           // if match, user/pass combination is correct
  20.           // return 1
  21.           $temp .= "<br>" . $arr[1] . "<br>" . crypt($pass, $salt);  
  22.           if ($arr[1] === crypt($pass, $salt))
  23.           {
  24.           $result = 1;
  25.           $temp .= "user pass good";
  26.           break;
  27.           }
  28.           // otherwise return 0
  29.           else
  30.           {
  31.         $result = 0;
  32.         break;
  33.           }
  34.       }
  35.  
  36.     }
May 29 '09 #7
stupid trim. Fixed it :)
May 29 '09 #8
Markus
6,050 Expert 4TB
Glad we could be of help ;)
May 29 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Todd Johnson | last post by:
I am creating a dialog in wxPython for log in purposes. Basically when the user clicks the ok button, the dialog box saves the user name and password as class attributes. Then as long as the...
10
by: Max | last post by:
Hello all, I am trying to protect a page within my site with a JS password scheme. Now I know JS can be quite easily "circumvented", but I came by a code below. My question is: 1. Is there...
7
by: jrefactors | last post by:
I want to ask how password is stored and how to check the authentication? I have heard password is never encrypted and decrypted, but it is hashed. For example, consider a simple email logon...
15
by: M P | last post by:
Hi! Im planning to encrypt the password that was stored on msaccess database and also the text inputed from a password textbox. Also, if I want to get the password from the database, I need to...
2
by: Elroyskimms | last post by:
The form has two text fields... one called txtEmail and one called txtPassword. The username is the email address (txtEmail) and the password is txtPassword. Storing cookie using the following...
7
by: Dino M. Buljubasic | last post by:
I am storing encrypted password in registry and using it then to log on my application. However, my objConn.Open(str_connecton_string) crashes the application if I use the encrypted password. ...
26
by: David Garamond | last post by:
I read that the password hash in pg_shadow is salted with username. Is this still the case? If so, since probably 99% of all PostgreSQL has "postgres" as the superuser name, wouldn't it be better...
4
by: tony | last post by:
I'm designing a survey form page that will be fairly complex and am becoming confident enough with PHP now to tackle most things. (Thanks to everyone here who has helped) Before I go too far...
4
by: custommx3 | last post by:
I have designed a site that requires users to login. Me being new to php, I hired a guy to help me setup the database. He set it up and it works flawlessly. Well.. instead of helping me finish the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.