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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.