Comments on my code Design...
| From: | Matthew M. Boulter | Date: | Wed, 21 Jun 2000 15:39:35 +0000 |
| Subject: | Comments on my code Design... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2500@lists.php.net to get a copy of this message | ||
** bear with the length thanx **
G'day all,
I'm new to PHP (2wks now) coming in from C++. My department has given me the
specs to
a website that I have till July 10 to do, *fun!*. So I was wanting your
input on the
design plan behind the modules, please expliot my 'newbie-ness' to PHP and
flame the logic ;)
Essentially the site is for student to come in and check their personal
details, and the information for subjects (desc, class list, timetable (this
is static)...).
We have several types of users:
students (check/change their details, link to subject pgs, ...)
teachers (primarily just edit their class list)
graduates (restricted browsing to certain pages that students can access)
administrator (add/edit/delete above 3 user types)
* The student information is stored as a MySQL database.
Okay so this is all straight-forward, however I don't have the time to get
this wrong, and therefore my logic can't be flawed from the beginning.
Here's my plan:
Classes -
cStudent, cTeacher, cAlumni, cAdmin :parent: cUserBaseObj
Classes for each user type, all derived from a common parent class.
dbMySQL
Database connectivity wrapper.
cSession
Session Management wrapper.
Operation -
- User attempts to access any page (in case of bookmarking).
- Display Authenticate dialog box
- Instantiate the Dbase Object, and check user
- Return validity, and if valid what type of user (Student, Teacher...)
- Check that they're allowed to access requested page, if not redirect
them
- Query the dbase as the page requires
- Display requested page, filled with lovely database-derived content,
*sweeet*
My questions are -
* Since the user object is required on every page they jump around to
(they'll be
moving between pages a fair bit), should I use Session stuff here, or
default to
global variables to maintain the data?
This same question for the dbMySQL object.
* General design thoughts - any comments/suggestions would be great.
---
Thanx in advance for any help guys,
Cheers,
--------------------------------------------------------------------------
Matthew M. Boulter email: mboulter@uq.net.au
Conceptua Media Developments mobile: 0414-912-501
(for the University of Queensland)
--------------------------------------------------------------------------