"do it all" page structure and things to watch out for?
- by Andrew Heath
I'm still getting my feet wet in PHP (my 1st language) and I've reached the competency level where I can code one page that handles all sorts of different related requests. They generally have a structure like this:
(psuedo code)
<?php
include 'include/functions.php';
IF authorized
IF submit (add data)
ELSE IF update (update data)
ELSE IF list (show special data)
ELSE IF tab switch (show new area)
ELSE display vanilla (show default)
ELSE "must be registered/logged-in"
?>
<HTML>
// snip
<?php echo $output; ?>
// snip
</HTML>
and it all works nicely, and quite quickly which is cool. But I'm still sorta feeling my way in the dark... and would like some input from the pros regarding this type of page design...
is it a good long-term structure? (it seems easily expanded...)
are there security risks particular to this design?
are there corners I should avoid painting myself into?
Just curious about what lies ahead, really...