p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Creating Rolls-Scripts for logging in PHP or JAVA


Message #1 on Wed, 8 May 2002 10:47:33
Hello,


I am designing a small community, and I have three different rolls defined 
in my MySQL database.

I would to make a script that simply checks which user is logged on and 
displays a proper user meny pre-defined for that user.

I have already defined meny .inc files. so only thing I need is, to write 
a script that will check for user roll in database and then call a 
specific menu file.

I do not know if this should be done in Javascript or PHP, as well. If you 
have any sample, I would appreciate it.

Thanx

-
Message #2 on Wed, 8 May 2002 17:21:14 -0700
> I have already defined meny .inc files. so only thing I need is, to write
> a script that will check for user roll in database and then call a
> specific menu file.
>
> I do not know if this should be done in Javascript or PHP, as
> well. If you have any sample, I would appreciate it.


Hello,

I'm not sure I understand fully where the problem is.  If you've already
created php files to handle the menus, and you've already defined your roles
in the database, then it should be easy enough to do something like this:

$result = mysql_query("select role from users where id='$userId'");
$row    = mysql_fetch_array($result);

switch($row['role'])
{
    case 1:
    {
        include('role 1 inc file');
        break;
    }
    case 2:
    {
        include('role 2 inc file');
        break;
    }
    case 3:
    {
        include('role 3 inc file');
        break;
    }
}


take care,

nik

Message #3 on Sun, 12 May 2002 19:19:04
Thanx!


Thankyou & thank you on your fast reply.


  Return to Index