Jump to content

Allow only domain names/ips in text string


yaMz

Recommended Posts

I am trying to implement what I call private uploads. Basically, users can check a box to indicate they want their file "private"

 

If so, the upload location is then (exampled as): _domain_/private-folder/$randomfolder

 

Upon uploading their file, the random folder is created, their file moved to the directory, the upload information stored to the database, .htaccess file is created like so:

 

 

info to add to new .htaccess:

Code: [select]

<files "*.*">

Deny from All

</files>

 

<files "*.*">

Allow from

$domains

</files>

 

the string $domains is the domains they enter each seperated by a new line in a form textarea.

 

The problem - how can I make sure this is safe. i.e. I want the string to be obviously proofed with php so that no matter what they input, only domains will be outputted.

 

I need the perfect regular expression set to ensure .htaccess for their folder will only contain domains and end on that note.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.