Jump to content

Remotely add a deny line to .htaccess with Apache thru a php code?


Recommended Posts

Hello, first of all, sorry if i chose the wrong forum to post this, i'm new here.

 

Ok, so, in a short story, i'm not a pro at programming anything, but i have a little game server (open to public) i use to play with friends, and i use an apache website for it aswell. The thing is, the server itself doesn't have an IP ban option on the SQL, but it does use one of the files in my website to load the game files. So, i thought about using .htaccess to IP ban the people i don't want it the server (which would block their access to that file, and open the game), and it worked perfectly.

 

The thing is: manually adding every line from everyone that gets banned would take alot of time (open sql, check ip, open .htaccess, add a line). I already have a php tool for administrators to access and edit a few things, so, what i'd like to know is:

 

Is there any php code that could access (thru that adm managing page, of course) that could add a line to the .htaccess like: 'deny from x.x.x.x', or something similar?

 

This way me, or any other adm would have access to that specific .htaccess and block access from an specific IP.

 

If not, would any of you guys know a solution to my problem?

 

Thanks in advance.

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.