Password protect a .php File

imported_KuJaX

Platinum Member
May 29, 2004
2,428
0
0
I want to protect a specific .php file from being accessed and ran unless someone has the appropriate username and password.

What is the easiest way to accomplish this? The username and password will be changed daily. There is going to be a link to this specific page on my website, but when people click it, it will ask for username and password. Of course, if they have the username and password from me, they can access this specific .php file and the coding and everything will run properly, as if there wasn't a password.

I don't want some piece of software that requires 10 pages to be uploaded and configured, with mysql database, etc. I just want something simple. I am not sure if .htaccess can do this.

Any help is greatly appreciated!
 

superjohnyo

Senior member
May 6, 2005
257
0
0
you can use the code attached below in a .htaccess file, and a .htpasswd file to protect one file. to generate the code for .htpasswd, go here