FlyingIsFun1217 Posted July 10, 2008 Share Posted July 10, 2008 Hey, me again I'm trying to keep the html of an html file protected, so that someone can't just go to the url. I figured at first that I'd just do echo's around each line, but this would involve quite a bit of typing (theres lots of html). But if I want to just do an include('myfile.html'), then I'm exposing the file as said for anybody to use. Is there a way of having an include to html that can't just be opened by the user? FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/ Share on other sites More sharing options...
lvtrii Posted July 10, 2008 Share Posted July 10, 2008 Unfortunately, there isn't. You can however do this: <?php // Check if logged in if (($userDate['user'] == $user) && ($userData['password'] == $pass)){ ?> HTML HERE, Without echo etc. <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587017 Share on other sites More sharing options...
pocobueno1388 Posted July 10, 2008 Share Posted July 10, 2008 You could use external CSS files...otherwise I'm not sure there is a way around it. Why is it so important to hide the HTML? Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587018 Share on other sites More sharing options...
FlyingIsFun1217 Posted July 10, 2008 Author Share Posted July 10, 2008 You could use external CSS files...otherwise I'm not sure there is a way around it. Why is it so important to hide the HTML? It gives functions that should not be allowed to be used by 'guests'. I'll use the method posted right after mine. Seems like what I'd be looking for. FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587021 Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 You could stop Apache from allowing requests to that folder with a .htaccess file... >_> Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587025 Share on other sites More sharing options...
FlyingIsFun1217 Posted July 10, 2008 Author Share Posted July 10, 2008 You could stop Apache from allowing requests to that folder with a .htaccess file... >_> Guess that would be a possibility. Would php have access to it (sorry if that sounds like a stupid question, but I've never bothered to go into that aspect of servers before)? FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587031 Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 Yes, it would, as long as you don't try to access it with the HTTP wrapper... Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587032 Share on other sites More sharing options...
FlyingIsFun1217 Posted July 10, 2008 Author Share Posted July 10, 2008 Yes, it would, as long as you don't try to access it with the HTTP wrapper... Nope, just an include. I'll try that, that's just what I was looking for FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/114167-how-to-protect-html/#findComment-587033 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.