htaccess doesnt work with spaces in usernames

Discussion in 'Setting-up protection' started by bennyuk1, Jul 5, 2013.

  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    using 4.2.14, I've noticed that htaccess folder protection doesnt work with usernames that have spaces in them.
    .htgroup file has this:-
    FOLDER_2: user1 Fred Bloggs User with spaces

    for 3 users
    user1
    Fred Bloggs
    User with spaces

    when it should be

    FOLDER_2: "user1" "Fred Bloggs" "User with spaces"

    Is there a fix to the htgroup generating code available?
  2. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Fixed it myself
    htpasswd.php
    changed line 68
    from
    fputs($fn, "FOLDER_$folder_id: " . implode(" ", $logins). PHP_EOL);
    to
    fputs($fn, "FOLDER_$folder_id: " . "'" . implode("' '", $logins). "'". PHP_EOL);

    seems to work
  3. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    sorry, double post

Share This Page