Jump to content


Photo

PHP logic required


  • Please log in to reply
5 replies to this topic

#1 abdul_zu

abdul_zu
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 July 2006 - 11:57 AM

Hi all,

I am looking some idea about to create control panel with privileg. and the DB will be MySQL.

Here is the full stracture which i need.

I will have one Admin account who will have full access of all tools. and he will create one reseller and assign some releated tool privileg so the reseller can access what admin giving him permission.

For the example:

Admin have full tools:
tool1    tool2        tool3
tool4    tool5        tool6

He created one reseller and assign assign only tool3 and tool6 from checkbox while he was creating new reseller.

once reseller will login he will see only:
tool3    tool6


I hope this explaination will be sufficient. So please advice me what should be logic to do these setup in PHP with MySQL.

Regards,



#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 10 July 2006 - 12:00 PM

You mean kinda like the cPanel WHM permission system work?

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 10 July 2006 - 12:06 PM

What is all this about are you trying to add a members system.

for example

a member joins the site the member signs for a high end account related to grade 6
so there fore the member has the number 6 in the member deatals.

you select do a select statement that says where member='6'

and on the members pages only allow access to tools relating to a memeber 6 access
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 abdul_zu

abdul_zu
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 July 2006 - 12:18 PM

Hello,

I am doing CallShop application which is going to have multi employee. and each employee will have different privileg to access his area.

for the example

1- Employee
    * Create Phone Booth
    * Add balance to Booth
    * Rollback etc...
    * Modify calling rate

2- Employee
    * Add balance
    * Rollback
    * View Call Logs

What i was making my logic to create function for each action and store it in one table with Employee ID. so when employee will login in his control panel only those fuction will be called which is assigned by admin.

Or is there any better way?

Abdul


#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 10 July 2006 - 12:27 PM

Your way with admin controll is the best way in my option.

Might be a lot more work but worth it.

so basickly you add a number field to the users accounts and then that number relate to provilages.

example

1 basic
2 bronz
3 silver
4 gold

So depending on the value of the number will controll the users previlages
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 10 July 2006 - 07:25 PM

You can add some binary representation of tools
tool1 - 1
tool2 - 2
tool3 - 4
...
tooln - 2^(n-1)
try
<?php
echo "<form  method=\"POST\" action=\"\">";
if ($_POST['submit']) $a=array_sum($_POST['tool']);
for ($i=1;$i<7;$i++) {
	$b=pow(2,$i-1);
	$c= ($a & $b) ? "checked=\"checked\"" :"";
	echo "<input type=\"checkbox\" name=\"tool[]\" value=\"$b\" $c>tool$i</input><br />\n";
}
echo "<input type=\"submit\" name=\"submit\"></form>";

if ($_POST['submit']) {
	$a=array_sum($_POST['tool']);
	echo "<hr />Put in database number $a.<hr />
	When you read this number :<br />";
	for ($i=1;$i<7;$i++){
		$b= pow(2,$i-1);
		$c= ($a & $b) ? true : false;
		echo "tool$i - $c <br />\n";
	}
}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users