I'm trying to setup different sections for a backend on my website. I want a section for general users and super users for right now. I might add different users later on.Right now, i have this general auth code:
<?session_start();if(!session_is_registered(myusername)){header("location:main_login.php");}?>
3/2/2009 8:25:54 AM
i'm not sure what your question isbut i will suggest that you consider using cakephp or some other framework for authentication/authorization
3/2/2009 8:32:23 AM
I pretty much want to control each page based on what type of user is logged in. I'll check out cakephp.
3/2/2009 9:12:32 AM
you can set a session variable that you pull from the database at login - then do you if/then on the session variable on each page.
3/2/2009 9:29:33 AM
yeahno need for cakephpjust read up on the php man page that explains how sessions workthen read the page on how the mysql libraries workthen do a switch case to go through all the user possibilities and do whatever you want to do differently inside of those, but try and keep the content the same on the page - if you ever need to edit it, you don't want to edit it for every user class. just set vars or something and do it that way in the switch case.]
3/2/2009 12:59:14 PM
if you want to use a framework which would make your life a hell of a lot easier I would recommend Code Igniter.
3/2/2009 1:01:52 PM
yes, if you add a 3rd column to the database for the type of user, that would work. try it. it's pretty hard to irrevocably fuck something up.you sound new to this and adding a feature like this is horribly basic, but everyone starts somewhere right? honestly, you should be able to program this with just PHP. if you can't, then you have NO business messing with frameworks.to make a flimsy analogy, imagine programming as like carpentry, the language as a handsaw, and a framework as like a miter box. you're trying to cut wood at exact right angles, but you barely understand how to operate saw. yes, the miter box will help a lot, but one thing at a time. figure out how to saw first before things get complicated and you end up with 9 fingers. ]
3/2/2009 7:17:27 PM