Solved

Permissions Not Working

Posted on 2011-03-24
3
263 Views
Last Modified: 2013-12-13
I'm not sure why it keeps telling me I'm not a full perm user.

Notice the Image in the picture Respid 3 has 'Superman' privledges, yet the output on the screen keeps giving me the 'idiot response'
<?php

//Permission Extract necessary for every page, included in the header.php

include ("sqlconnect.php");

$respid = '3';

$sql = "SELECT pr_resp.respid, Superman, OfficeAdmin, Management, ITDept, HireDesk, Purchasing, Collections, AccountsReceivable, AccountsPayable, Finance, SalesReps, SalesManagers, Foremen, Logistics, Marketing, HumanResources, GeneralAccess
		FROM allowed_perms
		LEFT JOIN pr_resp ON allowed_perms.respid = pr_resp.respid
		WHERE pr_resp.respid = '$respid'";
		
$res = mysql_query($sql) or die(mysql_error());

echo $sql;

while ($row = mysql_fetch_assoc($res))
	{
	$Superman == $row['Superman'];
	$OfficeAdmin == $row['OfficeAdmin'];
	$Management = $row['Management'];
	$ITDept = $row['ITDept'];
	$HireDesk = $row['HireDesk'];
	$Purchasing = $row['Purchasing'];
	$Collections = $row['Collections'];
	$AccountsReceivable = $row['AccountsReceivable'];
	$AccountsPayable = $row['AccountsPayable'];
	$Finance = $row['Finance'];
	$SalesReps = $row['SalesReps'];
	$SalesManagers = $row['SalesManagers'];
	$Foremen = $row['Foremen'];
	$Logistics = $row['Logistics'];
	$Marketing = $row['Marketing'];
	$HumanResources = $row['HumanResources'];
	$GeneralAccess = $row['GeneralAccess'];
	
	echo "<br /><br />";
	
	if ($Superman == 1 || $HumanResources == 1 || $AccountsReceivable == 1)
		{
		echo "You have access to this page";
		}
		
	else
		{
		echo "Idiot, stop trying to access this page!";
		}
	
	}
	
?>

Open in new window

ClickSend.png
0
Comment
Question by:t3chguy
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 500 total points
ID: 35207558
These lines are wrong

$Superman == $row['Superman'];
$OfficeAdmin == $row['OfficeAdmin']

These are logical comparisons. Change to

$Superman = $row['Superman'];
$OfficeAdmin = $row['OfficeAdmin']

and try your code again
0
 
LVL 1

Author Comment

by:t3chguy
ID: 35207602
Stupid oversight on my part.  Thanks so much!
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 35208011
We all have days like that......

Cheers!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question