Jump to content

Edit, add to, and delete from a certain file


lore_lanu

Recommended Posts

Hey all!

 

So, I am currently working on the backend of my site and I was wondering how I would be able to do something.

 

I would like to enter a string (in this case, an IP address) into a form and have the form add

deny from xxx.xxx.xxx.xxx

to an htaccess file. (to ban the IP)

 

And, to enter the address into a different form and have it search the .htaccess file and delete the line with the IP address entered. (to unban the IP)

 

How could I accomplish this?

 

I'm pretty sure this is possible to do, but is it the most efficient way to ban an IP Address? Would I better off, storing the banned addresses in a database and then deleting them from the mysql row? That seems a little less efficient to me.

 

Thanks in advance for any help and/or advice!

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.