Originally posted by JB
Some notes:
- You don't need to end your scripts with ?>. This can lead to whitespace being output accidentally and can mess up headers being sent back to the user's browser.
- For the love of god, look into basic code standards - trying to read through your code is difficult, and maintaining it will be even worse. You must login or register to view this content. and You must login or register to view this content. are really good coding standards to follow (as is the entire PSR specification). They make readability and maintainability much easier for all developers included.
- You don't need to reinvent the wheel. Check out You must login or register to view this content. and You must login or register to view this content.. You can use libraries that other people have written to save time building the same thing twice.
- Look into using an MVC framework like Laravel - there's a fair bit of this which is easily achieved out of the box in a new Laravel project, and it certainly doesn't hurt to learn the basics of an MVC framework. Also take the time to look at Symfony and other frameworks, as there are several.
I'm working so haven't had time to download & setup on my local yet, but at a glimpse on github it doesn't look too bad.
Originally posted by Tustin
Some more advice:
You must login or register to view this content.
- Don't do this. You might accidentally spit out some information you don't want people to see.
- Your redirects are vulnerable; you want to die() the script after you do a redirect. If you do a redirect using header(), the client can ignore that response code and still view whatever they're not allowed to see. I used to have fun abusing poorly made mod menu sites with this.
Tustin, My friend( you may Know him Lachie), Taught me to do this. but i never added it, will fix these things, and thank you this will surely help me in the future.
.
JB, I have not fully understood MVC Frameworks yet, but i have watched many videos explaining them. for now im going to stick with non framework ways (if you could call it that)
Thanks for your feedback