making an administrator's account

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

making an administrator's account

Post by James M. »

Hi, I am trying to make an administrator's acount for a site i'm making that allows me to delete user accounts(delete mysql entries), add news content ( amend .inc file), etc.

Since im pretty new to php, i just want to know how would i get started in making a administrators account? Thanks for any help ahead of time.
Last edited by James M. on Fri May 14, 2004 10:12 pm, edited 1 time in total.
fnleong
Forum Newbie
Posts: 18
Joined: Wed May 12, 2004 5:49 am

Post by fnleong »

hav u create a admin table?u should create this first
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

well i don't know what the rows should be or what i'd even do with them?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

This is a pretty broad and vague question, but I'll do my best:

- When you make user accounts in your database, put in an extra field that delineates if a user is an admin or not.
- For the administrative functionality, you will have to add pages that allow users to do that, for example deleting entries. In those pages, have a security check that makes sure the user logged in is an admin. If not, display an error, boot them out or something, just don't let them use the page.

Does this make sense?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

makes sense, i think i have a way of making an administrators account for my site, i'm not use to thinking in php much. If i need anymore help, i know where to go, thanks.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

to add-on to pickles post

what I did, was combined sessions and cookies to a MySQL database

I made an extra field (I called it admin) and set it to default 0 (not a admin) and when I change the field value to 1 (a admin) then all you need to do is run sql queries against the table to compare n contrast the session_usernames or usernames to the value in the db

hope that may shed some light or be a better approach for you
Post Reply