Solved

Read password from file

Posted on 2000-03-28
6
189 Views
Last Modified: 2008-02-01
Hello.

I have a PHP3 script that ask the user to type in username and password by sending an 'HTTP/1.0 401 Unauthorized' heading.
This is then stored in the $PHP_AUTH_USER and $PHP_AUTH_PW variables.

How can I validate the passwords against a file on the server?

I use a free web host so I can't change anything on the server.

I found the script on http://hotwired.lycos.com/webmonkey/. There is an example on how to validate agains a text file, but it won't work, only the last password in the file works properly.

Thanks

Endre
0
Comment
Question by:esolem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
gravity earned 100 total points
ID: 2664609
Where it uses
$line = explode("\r", $file_contents);

 have you tried using instead :

$line = explode("\n", $file_contents);

0
 
LVL 8

Expert Comment

by:us111
ID: 2668131
if your file looks:
joe:e487edf
dav:gt878e5

you can try $line = explode(":", $file_contents);

0
 

Expert Comment

by:mrvithan
ID: 2668715
I think it isn't a big deal how you can read... But it is how you can secure your file....

PS. ... i just know "\n" is a new line on WinNT and "\r" is a new line on Unix..., isn't it?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 8

Expert Comment

by:us111
ID: 2668907
\n for newline
\r for carriage
0
 
LVL 2

Expert Comment

by:maxkir
ID: 2693330
Hello ? Did you get what you want ? It whould be nice if you give some points ;-)))
0
 

Author Comment

by:esolem
ID: 2808926
Hello all.

Thanks all. Rigth now I have put my project on ice and don't know when I can take it up again.

I give the points to gravity for beeing the first to answer, and I think that was my problem.

Endre
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How would I construct this INSERT statement in PDO? 6 33
php subtract from date 2 30
MySQL-Design Help 12 44
[form-control] Retain values after a POST action 21 37
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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