Jump to content
Sign in to follow this  
Badchip

Protect PHP renaming with a pin number

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.

Share this post


Link to post
Share on other sites

It's to avoid that the PHP path can be used by anyone. What I want to do is change the PHP name often automatically.
I want it to change every time I run PHP.

Edited by Badchip

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Are you saying that you don't want to allow external links to the file? What about bookmarking?

Share this post


Link to post
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
Sign in to follow this  

×