Jump to content

Protect PHP renaming with a pin number


Badchip

Recommended Posts

I'm trying to protect a php file to prevent it from being used frequently outside of my web. My idea is to rename it with a 4-digit pin using the code: $pin = mt_rand (1000, 9999);
... but I don't know how to rename the old file/pin with the new one: rename ("old", "new"); ???

Any help will be welcome.

Link to comment
Share on other sites

Yeah, security by obscurity is not security.  The solution is to make that file harmless if someone unauthorized accesses it, not try to hide an insecure file that someone can exploit if they find it.

Link to comment
Share on other sites

That's security by obscurity, and it doesn't work.  You should be able to post the URL of that file online and not worry about what will happen when people access it, because the code in the file will stop people from abusing it.  If you don't have any security in your actual code, and you're counting on people just not knowing the URL of the file, that's a problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...