Advanced PHP Tutorial

So I understand the basic concepts of PHP and MYSQL but I’m having trouble combining the two to make Admin Panels / Website Backends. I was wondering if anyone knew of any good tutorials that covered specifically that: creating admin panels / user backends / website backends.

What does an Admin back end consist of?

  • User Authentication & possibly permissions of that user
  • Forms, validation
  • CRUD - Create, Retrieve, Update, Delete

Google should give you many tutorials for each at this point. You just need to combine each

And this is where I’m having the most trouble is combining the pieces. See right now when a user logs in I am using a javascript redirect to bring them to the internal page, which just doesn’t seem right to me. That’s why I was hoping a tutorial might show me a better way to go about this.

Yeah a website backend just consists of user authentication and content editing ‘simple’ as that, but getting everything to work is not so simple :confused:

I would say google, if you haven’t already, but I only found a few in a quick search:
http://www.vdesignourweb.com/cmsphpsqlb/cms_adminpanel.html (basic)
http://www.phpwebcommerce.com/shopping-cart-admin.php (better)

That’s a start, but further would be thinking about what will the admin look like, user actions, then build a simple panel


Login page - page=login 
 - if valid set session variable
 - redirect to admin page - page=admin
Admin page
 - shows list of admin functions
 -- add page - page=admin?action=add-page
 ---- blank form
 ---- if valid on submit, enter into db
 -- list of current pages to edit/delete - page=admin?action=view-pages
 ---- if edit, go to form populated with db values - page=admin?action=edit-page&id=1
 ---- if valid on submit, update db
 ---- if delete, delete from db  - page=admin?action=delete-page&id=1
 -- user info - page=admin?action=edit-user&id=1
 ----- show form with user infomation
 ----- if valid on submit, update db
 - user logout - page=logout
 ----- destroy session
 ----- redirect to login/home page
 
Admin functions can be called via switch statement based on the url

Here I put possible urls to give you an idea on how this could look - also basic sql for each:

page=admin?action=add-page - on valid submit :

insert into pages values(x,y,z)

page=admin?action=view-pages :

select * from pages

page=admin?action=edit-page&id=1 :

select * from pages where id = 1

page=admin?action=delete-page&id=1 :

delete from pages where id = 1