Title: Random folder name
Last modified: August 20, 2016

---

# Random folder name

 *  Resolved [trentb2](https://wordpress.org/support/users/trentb2/)
 * (@trentb2)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/random-folder-name/)
 * 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.
 * [http://wordpress.org/extend/plugins/sell-my-plugin/](http://wordpress.org/extend/plugins/sell-my-plugin/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Rob Landry](https://wordpress.org/support/users/bigrob8181/)
 * (@bigrob8181)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/random-folder-name/#post-3204527)
 * 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.

Viewing 1 replies (of 1 total)

The topic ‘Random folder name’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/sell-my-plugin_1c2b31.svg)
 * [Sell My Plugin](https://wordpress.org/plugins/sell-my-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sell-my-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sell-my-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/sell-my-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sell-my-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sell-my-plugin/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Rob Landry](https://wordpress.org/support/users/bigrob8181/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/random-folder-name/#post-3204527)
 * Status: resolved