"do it all" page structure and things to watch out for?
Posted
by Andrew Heath
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Heath
Published on 2010-04-09T05:14:13Z
Indexed on
2010/04/09
5:23 UTC
Read the original article
Hit count: 384
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...
© Stack Overflow or respective owner