Hiya, What's the best and most secure way of structuring a website? I have looked at various forum packages (.e.g phpBB, myBB, and smf), and they each seem to use a switch statement in the index.php file. When you go to a section of the website, a get variable is passed, and the relevant area of the website is loaded through the switch statement. Is this the best and only way? I would appreciate any body's thoughts on this topic. Thanks, FishSword
I'm not completly sure what you want. Having a switch statement to check where the user is at doesn't make it any secure. In my opinion, yes this is the best way, but it's certainly not the only way.
You're talking about a CMS. It depends on specific needs and expectation. You may choose your own way to implement security, don't need to fetch the entire website from a centralized dispatcher (index.php) based on sessions or url parameters. Just make sure you separate your website GUI from the underlying Business Logic layers, with the help of advanced techniques and frameworks.
Most of those scripts are backwards compatible with PHP4 and have some very bad coding standards. I'd recommend you go with some framework.
@r.pointing so far this thread only had two opinions saying the same thing, so you're not really helping.
That just a dispatch/controller file which doesn't neccessarily improve security nor effect coding standards. Aslong as the core code is sanitized sufficiently structure shouldn't be a problem.
The secure structure is based on filtering inputs. The rest is not about the security it is about the performance or the architecture of the alghorithm. As long as you filter all the inputs variables (requests, get, post, server, cookie) you can have security. The rest is your imagination. But as other guys told frameworks are like the culture of a programmer nation. It's the most secure and efficient way of building your application. Because when you write your own code, you only use your own intelligence. But when you use a framework. You use intelligence of many programmer that build, test and fix that framework.