PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Dec 14, 2017 7:26 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Dec 01, 2017 11:58 pm 
Offline
Forum Newbie

Joined: Thu Nov 30, 2017 11:18 pm
Posts: 6
Hi,

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?

Thanks!


Top
 Profile  
 
PostPosted: Sat Dec 02, 2017 12:12 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6605
Location: WA, USA
How are you storing the passwords? And please tell me that file is not stored under your web root in a web-accessible location.


Top
 Profile  
 
PostPosted: Sun Dec 03, 2017 5:40 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13459
Location: New York, NY, US
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 (http://php.net/manual/en/book.sqlite3.php) it has file locking that will protect against two users writing at the same time and corrupting the file.

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group