What is the best way to handle processing in PHP from either logins or form posts

XSP

New Member
I am pretty new to PHP and have yet to find really practical book which describes how to best process things in PHP in a real world situation, with security in mind. Even searching google, most articles are just about the basics, and are not real world examples. I just don't see anything good out there on PHP structure and flow for a website as a whole.What I have adopted is for example, if a user fills out a login form in ABC.php, the data is posted to XYZ.php?do=processLogin . In XYZ, I have an "IF ISSET" for the "do" variable and if it's set then it enters a switch statement which handles logins, or logoffs, etc, and then redirects them back to the appropriate page. If the "do" variable is not set, they get dumped back to the login page.I've seen many examples where data is posted to the same script, however just about anytime I am doing any sort of form processing or an action such as a login of logoff or account editing, I am posting to completely seperate PHP file to take care of that work, and then redirecting the user back. Is this way sub-optimal, abnormal, stupid?? Can someone give me some advice on this, or link some good examples related to this topic? I was thinking lately of finding some open source app written in PHP so that I can view how an experienced PHP coder structures their site, so if anyone has an example of one of those to look at, that would be appreciated too.Thanks in advance!
 
Back
Top