PHP: Need Help In Creating Access Groups For Site

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

PHP: Need Help In Creating Access Groups For Site

vicky99
Dear Friends
I need a PHP script which can verify users. There should be a system which set access level of users. I mean admin, power user and the regular user. Admin will have all the rights like block user change password etc. and power user can have rights more than regular user. I want to build a Content Management System. For which I need your help. Bye.

Reply

ruben
Hello and welcome!
First of all: Do you know any PHP? Because if you don't it can be quite hard (*changes voice* I would even say impossible) to construct a content management system in PHP on your own.
If you do know and you want to build it up with our help, you should start somewhere, because a CMS is a big thing and it's kind of difficult to give assistance to a not-existing project.
If you want to start from scratch I would recommend you though to use a PHP-database (Astahost has PostGreSQL and MySQL) combination, because everything else would make it a lot more work.
But my real recommendation to you would be: Take one of the field-tested, professional ones and fit it to your needs. If you get hosted with Astahost, then you can easily establish a CMS with the pre-installed Fantastico, so most of the work you need to do, is done already. The configuration is a lot of work too, but definitively easier than writing your own CMS.
If you don't need a whole giant CMS (I mean you talked about a user database first, but I don't know what you're going to do with it later on), then I can happily help you with forming some strategy and writing it later on, but you're so vague (qotsa reference) right now.

Greetings,
Ruben

 

 

 


Reply

seec77
I agree with Ruben. You really shouldn't go about trying to build your own CMS with basic knowledge of PHP. Heck, even with extremely proficient PHP skills it's really annoying to create your own user system, or whatever, but I would suggest using Drupal.

It has the user system (including all the privilege and access level features) and template system worked out for you along with a few other things, and if you need anything special that isn't included in it, you can just very easily develop an addon for it. Actually, most things you would ever need can probably be found in the Drupal's module section (along with a variety of excellent themes in the appropriate section). Oh, and if you don't want to use any of Drupal's built in features, you should just think again. Template engines are a good thing, a very good thing, even if it seems as if it's easier to code the HTML into the PHP page, and Drupal's nodes can be configured to perform whatever it is you want them to perform (and you can give them different names so instead of /node/xxx, you'll see /about/ or whatever address you choose).

Anyways, it would really help if you told us what you're trying to do with that user system you're trying to build. And sorry for sounding like a Drupal zealot, but I am a Drupal fan, and quite a proud one!

Reply

vicky99
Thanks Friends,
I know a little bit of both PHP and MySQL data base. Basically I want to buils a Job Portal like Monster.com.
I have found out that there are three types of user. First: Administrator, who run the portL. second:The Employer,The power user. Lastly : The Job Seeker, The general user.
I need your help to build this three type of user system. I know it can be done but I need a openning.
I wish you may help me in doing so.
With Regards...


Reply

vujsa
Well, I'm not sure if you wanted actual code or just an overview so I'll give an overview for now.

For each user file, you'll need to specify the user type: Admin, Employer, User
You will need to save their password information here as well along with any other data you wish to collect like an email address.

The password data saved should really be a hash of the actual password so that if someone manages to gain access to your database, they can't read the actual passwords.
To create a hash of the password, you simply modify the password with a hashing function or functions like MD5. Then when a user logs in, you run the same hash on the submitted password prior to comparing it to the stored password data.

Once the user logs in, your session data should be modified as such. It would be helpful to save the user type in the session data but not required.

For any page that is displayed, there are 4 diferent user types that might be able to view it or not. guest, user, Employer, and Admin.

All pages should be viewable by the Admin. You will need to check the users group type prior to displaying any page and prior to displaying any internal links on a page. You don't want to show the link to the admin control panel to guests do you?

So at the beginning of your page generation script, you should check the status of the users session and then their user type.

You'll assign their user type to a variable:
$usertype

then you'll check to see if that usertype is allow to view the information requested to be displayed.

For user only content:
CODE

if ($usertype == 'Admin' || $usertype == 'user') {
    // Show content or link
}


For fully public content:
CODE

if ($usertype == 'Admin' || $usertype == 'user' || $usertype == 'Employer' || $usertype == 'guest') {
    // Show content or link
}
Of course, you could skip the check altogether on this one! or just check to see if $usertype is assigned before displaying like this:
CODE

if ($usertype) {
    // Show content or link
}


For logged in only content:
CODE

if ($usertype != 'guest') {
    // Show content or link
}
This would be good for a log out link.

For guest only content:
CODE

if ($usertype == 'guest') {
    // Show content or link
}
This would be good for a log in link.


If you use a database to store all of the information about what to display in which situation, then you can have each content item have it's own allowed user settings. But for the most part, you simply need to check for the usertype then determine if the content will be displayed or not as a result.

Since there are so many ways that this could be written, I don't want to get into much more detail without direct questions since my technic may differ from yours and my confuse you as a result.

Hope this helps. cool.gif

vujsa

Reply

vhortex
QUOTE(vujsa @ Jun 4 2006, 10:39 AM) *


...........

For guest only content:
CODE

if ($usertype == 'guest') {
    // Show content or link
}
This would be good for a log in link.



here is a muh better way to code that..
first create a user database and put an exta column called level.

i normall use two database tables for this

[table users]
ID -[unique key]
Username
Password
Level

[table LevelMap]
ID [unique level key]
Level Name


table levelMap contains records like this
1, Admin
2, Power User
3, User

and the user tables contains data like this
00001, user01, user01password, 1
00002, user03, user01password, 3
00003, user03, user01password, 1

for having 2 admins and 1 user account.

on top of each page I have this check

switch level
case 1: //do admin stuff
case 2: //do power user stuff
case 3: //do normal user stuff


--
PS: i cant seem to use the forum functions with firefox modified.. must recompile this browser later..

Reply

vicky99
Thank you friends for your suggestions. It would be very helpful for me if you could provide a working example. I just need a login system which can discriminate user by their ID and PASSWORD. It would be very nice if the example is commented.
I dont know whether I am asking for too much. I so please forgive me. Bye..

Reply

ruben
Just take a look at a working ContentManagementSystem as we have told you before. You can take a look at drupal for example. The code in these ready-to-use CMS is normally commented quite well. Why do you need just the user-part? I mean just users aren't that useful.
The examples you saw above are working, you just need to implement them into a website, which shouldn't be that hard, if you think, you can build a CMS on your own.
It seems very difficult to help you, because you ask for a quite comprehensive and versatile thing and don't seem to use the answers you get.

Reply

vujsa
Well, maybe a CMS isn't what is really needed here. It is true that most CMS scripts offer a lot of useful tools but some of the extras can get in the way. This could make it hard to add a component to the CMS or use the CMS code as an example to write your own code.

Have you been to a PHP scripts download site? You should be able to find an authorization script ready made there. Even if you don't like the script, you can modify it or use it as a roadmap to your own script.

http://php.resourceindex.com/
http://www.hotscripts.com/

These are the two most common places to find PHP scripts. I use them to find scripts to either use as is or for learning purposes. I think that you can find a small enough script there to learn from. If that doesn't work out, they may have some authorization classes or code bits that you can use like a module.
If you use a class or code bit, there may or not be instructions on how to use it.

Hope this helps cool.gif

vujsa

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. myphp change usertype - 496.87 hr back. (1)
Similar Topics

Keywords : php creating access groups site

  1. Creating A Template Engine - General Advice? (1)
  2. Connecting Ms Access To Php Using Odbc - (5)
    Dear Friends I have been trying to connect Ms Access using PHP for couples of days. Finally I have
    done it. It was dome using Open DataBase Connectivity, popularly known as ODBC (pronounced as
    separate letters). With an ODBC connection, you can connect to any database, on any computer in your
    network, as long as an ODBC connection is available. Here is how to create an ODBC connection to a
    MS Access Database: Open the Administrative Tools icon in your Control Panel. Double-click on the
    Data Sources (ODBC) icon inside. Choose the System DSN tab. Click on Add in the...
  3. Php Script To Download File From Another Site - (9)
    hi i need a php or java script code for downloading files from other sites to my site for example:
    http://download.com/file.zip to http://mysite.com/file.zip thanks...
  4. Permission Denied In Creating A Directory - mkdir() (6)
    QUOTE Warning: mkdir(/home/whistle/public_html/see/seeto): Permission denied in
    /home/whistle/public_html/see/config.php on line 56 My web hosting is on the astahost. The
    absolute path of my php script is "(/home/whistle/public_html/see". When I try to create a directory
    named "seeto", the error message about permission denied is displayed. The same script I tried on
    another web hosting server "Lycos", it works perfectly. Can anyone tell me what is wrong with it?
    Or anything I should notice more? Thanks. CODE if (mkdir("/home/whistle/public_html/see/seeto"...
  5. How Do I Create And Write To Files? - creating, writing, deleting files (4)
    Hi, Can someone please tell me how to create files and write to them in PHP. I just want to create
    a simple file containing text, and then be able to read it or update it. Thanks Alfie...
  6. How Do U Make Members Only Web-site - (7)
    how do u make it that only a member of that site can view that page?...
  7. Login Script - PHP Help #3 - Need help creating one (5)
    It turns out that the authentication script that I copied from
    http://www.php-mysql-tutorial.com/user-aut...on/database.php doesn't work even when it is left
    unchanged. What a crappy piece of code. Now I am trying to build by own login script from scratch.
    I already have a little knowledge on how to do this (connecting, echoing, retrieving) but I need
    some more examples and/or tips. I know what I need and maybe this could help you out: Note: Green
    items are fixed. No duplicate username in MySQL Database Authorized users only. I have to
    authorize each...
  8. Should This Great Site Offer Imagemagick ? - May be the admin of this site think over it. (3)
    Hi As we all know that this website is very good and offering good services. I just wanna know if
    other people also want ImageMagick to be installed on this server with free accounts... so please
    let me know and lets check if the Admin of this site can isntall it..... Fun...
  9. Xgrid With Php - Creating a script to post a blender file to Xgrid using PHP (0)
    I am doing pre planning for the blenderxgrid.com script. I was originally going to do this with
    PERL, but elected against it. Eventually I'll be moving the site off astahost and replacing it
    with a website hosted on the same machine as the xgrid controller. I am setting up a test version
    on my latop using OSX's apache server, MySQL, and PHP on a localhost config. Here is my step
    list for the script: ------------------------------------- Form: (within Xoops CMS, so user will
    have to be logged in) Username Password (where they can upload the .blend file...
  10. Help: Php + GD - Creating A Progress Bar - Creating A Progress Bar (5)
    I've recently been trying to read up on using PHP and GD to create PNG's on the fly.
    I've been doing so in hopes that I will be able to learn how to compile a script that will
    output an image of a progress bar with certain attributes based on the url that called it (which
    will be accessed predominately from a forum, so it must be able to be coded as standard BBC). These
    attributes would include the bar's title (based on the event mentioned in the url) printed
    centered and right above the meter, a background image (to hold the meter), the meter (the ...
  11. Multilingual Site: Send The User To Page Of Choice - (6)
    If you have one site in diferent laanguages, this simple script can redirect the user to the correct
    page acording to his/her language: CODE // Enslish EUA elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-us"){ header("Location: index_eng.html"); } // Inglês UK elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-gb"){ header("Location: ingles_enuk.html"); } // Portuguese if ($HTTP_ACCEPT_LANGUAGE ==
    "pt-br"){ header("Location: index_ptbr.html"); } //German elseif ($HTTP_ACCEPT_LANGUAGE ==
    "de-de"){ header("Location: index_ger.html"); } // Swedish elseif ($HTTP_ACCEPT...
  12. PHP Based Site Access Authentication - Help - How to block parts of your web-site ?? (4)
    How can i program my web page using php that when the value of the login box is equal to some string
    then go to my success.html otherwise on my fail.html????help me guys!
    ------------------------------------ It would help the readers far better to understand what your
    problem is - if you state the nature of it in short in your topic title, instead of just "Php help".
    It'll also get you a lot more responses. Am changing your topic title to give you an example.
    All the best /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> m^e...
  13. Dynamic Site Design - Where Do I Start ? - (7)
    I am new to php. I have some programing background in html, javascript, and c++ but have never done
    anything in php Can someone reccomend some good sites or books etc that can help someone who is
    completely new? My ultimate goal is to make a game like/similar to ponyisland.net...
  14. Need Help Is Adding A PHP Based News Module To My Site - (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE        require ('mysql.php');       
    $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";        $result=mysql_query($query);
               $num=mysql_num_rows($result); mysql_close(); echo " Outras Other News "; $i=...
  15. How To Do POP Access In PHP + Need AJAX Info - (4)
    I'm writing a mail checker in PHP. I need to access the POP server. In PHP, I can send mail. But
    I didn't know how to receive mail yet. So, please help me. I also need some document about
    AJAX. This topic really interests me. But I don't know where to start....
  16. Using Bitflags To Restrict Site/page Permissions - (1)
    My professor is designing a website that uses bit-flag checking to allow access to certain pages.
    You login, validate login, and store their allowed bit flag into a session variable. Then you
    compare to see if they have access or not. It's fairly new to me, but it's apparently very
    common with linux users. Sounds interesting to me, just wondering if any one has used this, or is
    it a little too much for simple pages. His site however is going to be more of "software" for
    several users. Is it very secure and does it work well?...
  17. How To Use Cookie In Your Web Site ? - this semple code to use and get cookie (1)
    what is the cookie ? the cookis it is some info sent and save in user computer whare i can use the
    cookies? becouse the cookies it like the header you can not send it after any output wes sent so
    you must send the cookies before any output like as ,echo and any other code i well make an E.X.
    to use the cookies you must have 2 file index.php update.php ---------- in the index.php add this
    code CODE    // This section must go at the top of the page that will display    // the
    users favorites.  These are the 'default' URLs that the user    // will se...
  18. Do You Want A Mail Form In Your Site - (2)
    Repeat post. Credits reduced by 5 days. Learn to USE THE SEARCH BUTTON before you make such posts.
    did you want to have in your web site mail form that allow the user to send mails to anther mail
    from his mail e.g. the compose in yahoo CODE from to
    cc bcc subject
    function param($Name)         {         global $HTTP_POST_VARS;        
    if(isset($HTTP_POST_VARS ))            return($HTTP_POST_VARS );         return("");       ...
  19. Php Access Log In Reverse Order - Request For Help. (8)
    So I need help getting data entered into my log correctly. I want the newest entry to be at the
    beginning (top) of the log instead of at the end (bottom). Here's what I have: CODE
    function access_log(){  // Enter data in usage log. $filename = "access.log"; $entry = gmdate("M
    d, Y H:i:s T").": ". getenv("REMOTE_ADDR").": ". getenv("HTTP_USER_AGENT")." \n";
    fwrite(fopen($filename, "a"), $entry); fclose(fopen($filename, "a")); }  //  End function
    access_log() ?> And it outputs: Mar 29, 2005 07:57:16 GMT Standard Time: 192.168.1.1:
    Mozilla/5.0 (Window...
  20. Site Counters - Help Needed - (13)
    I want a good Site counter(to keep track of visitors) for my site..... can nebody temme.....
    where will i get free stuff on this... (dont ask me to google..and try out..i am doing that..just in
    case u know someplace) OR Can how do i design my own (which seems quite....difficult for me) Plz
    help!! Satya...
  21. Own Links On Site - (6)
    I'm thinking of having some kind of system so the users can register and then put up their
    links. Everything should be saved in some kind of database. Anyone now any tutorial or guide or
    something like that of how to do that?...
  22. Free software for creating PHP sites - (17)
    This is good for those who doesnt have knowledge bout PHP they are totally free here are my 2 know
    free web portal system Postnuke -> www.postnuke.com and PHPnuke -> www.phpnuke.org /tongue.gif'
    border='0' style='vertical-align:middle' alt='tongue.gif' /> ...



Looking for php






*SIMILAR VIDEOS*
Searching Video's for php
advertisement




PHP: Need Help In Creating Access Groups For Site