473,385 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2683
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.