Help with Client login area, need help with inside functions

I am working on a client login area for a client of mine. I am using PHP and MySQL for the design of this. I will have three tables for the area, well to start with. One will be ?user? (which will be the clients), ?admin? and ?function?. I have setup the user table with your basic info plus a column called ?functionaccess?. I have the sessions working for the users and I will have no problem setting up a login and session for the admin. The capabilities they want once inside the admin area is where I am having a problem. They want to have 10 functions that are possible to show up when a given used logins in, they want to be able to choose which functions a user sees from the admin area. So you would have a page with a pull down menu at the top, choose a user and below would be the 10 functions with a check box next to each one (check for access). The functions can be something as simple as 10 different links to pages that they can click on.

So the function table would (for now) have columns like functionName, functionDescrip and functionLink. So for each function that shows up on the users page would look something like

< a href="$functionLink?>$functionName
$functionDescrip

This is what I was think for the admin page with the list of functions and check boxes. Each check box would have a name of func1, func2, func3 and so on to 10. Each variable would have a value of ?0? or ?1? Then you remember ?functionaccess? from the ?user? table. Well these 10 ?funcX? variables would build the ?permissions? for each users function access.

Something like $functionaccess = ?$func1? . ?$func2? . ?$func3? . ?$func4? and so on. When your done you have a functionaccess variable of 1s and 0s (1001100101) this would determine the access for each user.

Now I think I can do most of that (maybe) . I am having a problem thanking of a why to use the 10 digit number in a useful why when displaying the correct functions for each user. How do I bring that number back into play on the user side when display there functions. Some way to break the number back apart and use it in a switch statement or an array or something that will cause the correct functions to be shown. If anyone can write a script that can do this, that would be great, or point me in the right direction that would be helpful. I can pay some based on the amount of help received if necessary. Or I may be think of this all wrong, that would be good to know as well, I am somewhat new to PHP.

Let me know also if anyone is interested in doing the entire setup for a fee and let me know how much that would be.

Look up str_split() it will help you do what you need.

I looked up str_split(), it seems like it could help a lot. But how do I use something like below to display the different function options?

[code]//one of the examples provide when looking it up

$str = “Hello Friend”;

echo $str{0}; // H
echo $str{8}; // i

//transformed into my needs

//this is the users permissions for functions
$functionaccess = “0101101011”

echo $functionaccess{0}; // 0
echo $functionaccess{1}; // 1
echo $functionaccess{2}; // 0
echo $functionaccess{3}; // 1
echo $functionaccess{4}; // 1
echo $functionaccess{5}; // 0
and so on… [/code]

How do I take that and produce a page that has different functions displayed for each user. They will be login using sessions while viewing this page, so now how do I connect this to the functions table and display the right functions.

Sponsor our Newsletter | Privacy Policy | Terms of Service