Dear all
exec()
is new to me and i am trying to learn on how to use it to edit and update usernames and passwords of visitors, if there is a tutorial website or someone can teach me on how to use it
Dear all
exec()
is new to me and i am trying to learn on how to use it to edit and update usernames and passwords of visitors, if there is a tutorial website or someone can teach me on how to use it
Why are you using exec()
? It'd be far simpler to use PHP's normal file I/O functions to read and write the file.
I discourage using htaccess/htpasswd for complex password management. Instead, I recommend you build your own password management/login system. However, if you still want to use htpasswd, follow these directions:
First, make sure that you have the htpasswd.exe file in the path/current directory.
Then, modify and add this line to your program where you need it.
exec('htpasswd.exe -b passwordFile myUserame myPassword');
where passwordFile is the name of the password file
myUsername is the username you want to change and
myPassword is the new password
If you want to use dynamic input, MAKE SURE you clean the content first. Otherwise, you could open up security holes to malicious attackers.