Sell My Plugin
[resolved] Random folder name (2 posts)

  1. trentb2
    Posted 2 years ago #

    I tried your plugin, looks great but had a hard time getting it to even install. Turned out the random folder name had a slash in it which of course could not be in name of a folder. Perhaps need to create random name but exclude characters not allowed in directory names. thanks.


  2. Rob Landry
    Plugin Author

    Posted 2 years ago #

    Replace the function with this one. I am just looking for a way to make it as secure as possible without the ability to guess the name.

    I have never run into this issue but with a bit of digging, i see that php crypt() does include these characters.

    in sell-my-plugin.php replace with this.

    function gen_secret_dir() {
    	//set the random id length
    	$random_id_length = 10; 
    	//generate a random id encrypt it and store it in $rnd_id
    	$rnd_id = crypt(uniqid(rand(),1)); 
    	//to remove any slashes that might have come
    	$rnd_id = strip_tags(stripslashes($rnd_id)); 
    	//Removing any . or / and reversing the string
    	$rnd_id = str_replace(".","",$rnd_id);
    	$rnd_id = strrev(str_replace("/","",$rnd_id)); 
    	//finally I take the first 10 characters from the $rnd_id
    	$rnd_id = substr($rnd_id,0,$random_id_length); 
    	return $rnd_id;
    } # End Secret Dir

    Let me know if there are any other issues.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.