TomBullock Posted September 30, 2007 Share Posted September 30, 2007 Hello I have a php script which basically is a FTP script allowing me to upload, download, delete etc. but i you can only perform these actions in the directory that the php script is in. I want to put it in my main directory where my index etc. is. To access it i would put http://mydomain.co.uk/admin.php. In doing this though it would allow anyone who goes to http://mydomain.co.uk/admin.php would be able to perform the actions i mentioned above which could result in them deleting my whole site. Could anyone tell me how i can password protect that php file. Thank you Tom Bullock Note: I cannot password protect the main directory because people would be asked for a password when they go to http://my domain.co.uk Quote Link to comment https://forums.phpfreaks.com/topic/71262-password-protection/ Share on other sites More sharing options...
BlueSkyIS Posted September 30, 2007 Share Posted September 30, 2007 SESSIONS. http://www.tizag.com/phpT/phpsessions.php On the page, use a session variable to see if the user is logged in. If not, present a login form. On POST, if the login credentials are correct, set a session variable saying "user is logged in" and display the protected info. Quote Link to comment https://forums.phpfreaks.com/topic/71262-password-protection/#findComment-358446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.