Closed MassInsanity closed 1 year ago
Hey, thanks for the PR! I appreciate the functionality: I assume the intended use case for this is to easily allow (or revoke) others access to it with their own password?
Theoretically, I do not believe foreach
is the most appropriate implementation for such a thing. I would rather suggest to simply replace the original line where the password is checked,
if ( htmlspecialchars($password) == htmlspecialchars( $_POST['password'] ) ) {
with the following which checks if the given password is to be found in the array rather than looping through it:
if ( in_array( htmlspecialchars( $_POST['password'] ), array_map( 'htmlspecialchars', $passwords ), true ) ) {
Note I would then also change the array name to plural $passwords
, i.e.:
# whether or not to ask for a password, and if yes, the array of allowed passwords to access directory/playlist contents
$usepassword = true;
$passwords = array('123', '234');
agreed. And yes- this allows you the ability to provide different people different passwords and add/delete access as such.
Thanks! Sounds good. Would you like to update the PR or shall I make the changes directly in the master branch?
If you wouldn't mind committing it to the master, that'd be great. I'm still new to Github, trying to learn how this all works. :)
Done now -- thanks again!
Update Index.php - Password Array / Multiple Password Support changes made for version 0.7.3 of Noctifer-Music