How to change passwords using PHP

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
Forum Newbie
Posts: 6
Joined: Thu Nov 30, 2017 10:18 pm

How to change passwords using PHP

Post by Joeldcruz »


I want to allow users to change their password and their password is stored in a file called user_data.txt. How can I allow them to edit their password using solely php?

User avatar
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to change passwords using PHP

Post by requinix »

How are you storing the passwords? And please tell me that file is not stored under your web root in a web-accessible location.
User avatar
Site Administrator
Posts: 13592
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How to change passwords using PHP

Post by Christopher »

It really depends on the file format. If delimited, you'll have to write from the point of the change to the end of file. If fixed width, then you could just seek, read, seek write.

I'd recommend SQLite if you really need a file based database ( it has file locking that will protect against two users writing at the same time and corrupting the file.
Post Reply