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

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...