fran1942 Posted April 3, 2009 Share Posted April 3, 2009 sorry, a newbie question. I have a file upoad php file on my server. I dont want any random client to be able to access it. Do I protect it by adding session code to it ? Thanks for any advice. Quote Link to comment https://forums.phpfreaks.com/topic/152320-protecting-php-files/ Share on other sites More sharing options...
premiso Posted April 3, 2009 Share Posted April 3, 2009 You can put it outside the www directory then use a file reading script to dish it out, they would have to have the right hash or something of that store. You would need to store the file path/hash in a DB with the associated username if you want. Quote Link to comment https://forums.phpfreaks.com/topic/152320-protecting-php-files/#findComment-799947 Share on other sites More sharing options...
FaT3oYCG Posted April 3, 2009 Share Posted April 3, 2009 if you dont mind having one password then simply add a password to the script and a password protecy feild to the form and check it, but if you want people to register to your site and have their own passwords then you need user registration Quote Link to comment https://forums.phpfreaks.com/topic/152320-protecting-php-files/#findComment-799996 Share on other sites More sharing options...
fran1942 Posted April 3, 2009 Author Share Posted April 3, 2009 thanks, but what about using a session ie. I have a login page, that establishes the page, and creates a session. The phpUpload.php will only be served if the session is valid. Is that good enough ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/152320-protecting-php-files/#findComment-800021 Share on other sites More sharing options...
xtopolis Posted April 3, 2009 Share Posted April 3, 2009 Is that good enough ? That's up to you. A session is just a way of tracking data between the server and client for a limited amount of time. If you build a simple login session then your site will be as secure as you decide. ideas: HTTP Authorization header, php/DBO user login, captcha system, limit to ip, javascript authorization(weak), etc.etc Quote Link to comment https://forums.phpfreaks.com/topic/152320-protecting-php-files/#findComment-800041 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.