Having a werid issue with a plugin...HELP

1 replies
guys, I'm having this weird issue with a wordpress plugin
it's a cool little app but I can't get a hold of creator for
some reason I was wonder if you guys can help me out here...

The plugin works like this:

With the "User Access Manager"-plugin you can manage the access to your posts, pages and files. You only create a user group, put registered users to this and set up the rights for this group. From now on the post/page is only accessible for the specified group. This plugin is useful if you need a member area or a private section at your blog.
Feature list
  • User groups
  • User-defined post/page title (if no access)
  • User-defined post/page text (if no access)
  • Hide complete post/page
  • Hide pages in navigation
  • Redirecting users to other pages (if no access)
  • Recursive locking of posts/pages
  • Limited access to uploaded files
The problem I'm getting is for some reason the plugin creates an .htaccess
and a .htpasswd in my upload folder. Now even if I give a subscriber access to the site an add them to the group I want when they try to login
the protected upload folder is forcing the subscriber to submit a password
but even if you add you login details it won't let you in.

And I think because of the plugin creating the .htaccess & .htpasswd files
it is screwing up my post and drafts.

I have a feeling this is an easy fix but you never know, anyone want to have a quick look for I'd really appreciate.

I'm not sure if I should post the code here or not...

PHP Code:
// Make .htaccess file to protect data

            // get url
            
$wud wp_upload_dir();
            
$url $DOCUMENT_ROOT.$wud['basedir']."/";

            if(!
file_exists($url.".htaccess"))
            {
                
$areaname "uploads";
                
$user "admin";


                
# create password
                
$array = array();

                
$length 10;
                
$capitals true;

                if(
$length 8)
                     
$length mt_rand(8,20);

                
# numbers
                
for($i=48;$i<58;$i++)
                      
$array[] = chr($i);

                
# small
                
for($i=97;$i<122;$i++)
                      
$array[] = chr($i);

                
# capitals
                
if($capitals)
                  for(
$i=65;$i<90;$i++)
                    
$array[] = chr($i);

                
# specialchar:
                
if($specialSigns)
                {
                    for(
$i=33;$i<47;$i++)
                          
$array[] = chr($i);
                      for(
$i=59;$i<64;$i++)
                        
$array[] = chr($i);
                      for(
$i=91;$i<96;$i++)
                        
$array[] = chr($i);
                      for(
$i=123;$i<126;$i++)
                        
$array[] = chr($i);
                }

                
mt_srand((double)microtime()*1000000);
                
$password '';

                for (
$i=1$i<=$length$i++)
                {
                      
$rnd mt_rand0count($array)-);
                      
$password .= $array[$rnd];
                }

                
// make .htaccess and .htpasswd
                
$htaccess_txt "AuthType Basic"."\n";
                
$htaccess_txt .= "AuthName \"".$areaname."\""."\n";
                
$htaccess_txt .= "AuthUserFile ".$url.".htpasswd"."\n";
                
$htaccess_txt .= "require valid-user"."\n";
                
$htpasswd_txt .= "$user:".md5($passwort)."\n";

                
// save files
                
$htaccessfopen($url.".htaccess""w");
                
$htpasswdfopen($url.".htpasswd""w");
                
fputs($htaccess$htaccess_txt);
                
fputs($htpasswd$htpasswd_txt);
                
fclose($htaccess);
                
fclose($htpasswd); 
--David
#issue #pluginhelp #werid
  • Profile picture of the author Tommo2007
    Hi,

    One thing I noticed is that on the last line of the "// make .htaccess and .htpasswd" section there is a reference to $passwort and I think it should be $password

    Currently:

    $htpasswd_txt .= "$user:".md5($passwort)."\n";

    I think it should be:

    $htpasswd_txt .= "$user:".md5($password)."\n";

    However, if you think it is the case that the .htaccess and .htpasswd files shouldn't be created then you could always remove the code. But maybe check option one out first.

    Hope this helps,
    Tom
    {{ DiscussionBoard.errors[342929].message }}

Trending Topics