UrbanDweller Posted February 1, 2012 Share Posted February 1, 2012 Hey, What i mean by this is if i have a form that needs information before form pages is requested i dont want people to be able to access form by directly accessing page from its url. If after form is sent that a error will pop up if user clicks back in browser etc? I just want form page to be accessed only by page1. do i need to create a annon id for each user? or just a function that checks previous page url somehow? "page1->Form>page3" Thanks Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/ Share on other sites More sharing options...
UrbanDweller Posted February 1, 2012 Author Share Posted February 1, 2012 Php is far more secure and I can easily disable the page if post variables arent valid that are required for the form. Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313169 Share on other sites More sharing options...
lonewolf217 Posted February 1, 2012 Share Posted February 1, 2012 javascript is the wrong way to do this since they can just disable javascript in the browser. use php or even better would be filesystem/webserver level security to restrict access Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313173 Share on other sites More sharing options...
UrbanDweller Posted February 1, 2012 Author Share Posted February 1, 2012 Why dont they build javascript into browsers cause i keep thinking about disabling javascript while using a form could disrupt js validation. Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313198 Share on other sites More sharing options...
lonewolf217 Posted February 1, 2012 Share Posted February 1, 2012 that is why javascript validation is a "nice to do" feature but you must always revalidate in the backend to make sure the data is correct. Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313274 Share on other sites More sharing options...
Adam Posted February 1, 2012 Share Posted February 1, 2012 You could just keep a small stack of the pages last viewed by the user in their PHP session. If they didn't come from 'page1 > form page', then just redirect them to page1 or display an error. Why dont they build javascript into browsers cause i keep thinking about disabling javascript while using a form could disrupt js validation. Even if it was impossible to disable JS in the browser settings, it's still code ran on the client's machine and is therefore not trustworthy. Anything from the client can be manipulated. Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313293 Share on other sites More sharing options...
UrbanDweller Posted February 1, 2012 Author Share Posted February 1, 2012 Yeah thats just what i was thinking of doing too. Even if it was impossible to disable JS in the browser settings, it's still code ran on the client's machine and is therefore not trustworthy. Anything from the client can be manipulated. I know that its more for functionality, as so many web developers are using js in there sites these day for forms etc you would hope for the users sake that they had it automaticlly when browsing as to not inhibit their browsing experience Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313297 Share on other sites More sharing options...
Adam Posted February 1, 2012 Share Posted February 1, 2012 you would hope for the users sake that they had it automaticlly when browsing as to not inhibit their browsing JavaScript can also inhibit the browsing experience though, which is why there's the option to turn it off. That said, JS should only enrich the the user's experience; if it's disabled the site should still be usable. Of course 9/10 that's probably not the case. HTML5 is actually introducing built-in browser validation, to try and tackle the problem: http://blog.mozilla.com/webdev/2011/03/14/html5-form-validation-on-sumo/ Given that IE9 and Safari don't support it at all yet though, JS solutions are going to be around for a while -- especially considering IE6 is still a major headache for those of us unlucky enough to have to support it still. Quote Link to comment https://forums.phpfreaks.com/topic/256154-how-to-restrict-access-to-html-pages/#findComment-1313298 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.