User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » php login help Page [1]  
Novicane
All American
15413 Posts
user info
edit post

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");
}
?>


I want to add IF statements and else statements to determine the type of user. I'll probably have to add a 3rd column to my users database specifying the type of user as well? not sure. any advice is greatly appreciated.

3/2/2009 8:25:54 AM

qntmfred
retired
40552 Posts
user info
edit post

i'm not sure what your question is

but i will suggest that you consider using cakephp or some other framework for authentication/authorization

3/2/2009 8:32:23 AM

Novicane
All American
15413 Posts
user info
edit post

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

bous
All American
11215 Posts
user info
edit post

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

evan
All American
27701 Posts
user info
edit post

yeah

no need for cakephp

just read up on the php man page that explains how sessions work

then read the page on how the mysql libraries work

then 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

RSXTypeS
Suspended
12280 Posts
user info
edit post

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

philihp
All American
8349 Posts
user info
edit post

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

 Message Boards » Tech Talk » php login help Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.