Solved

Permissions Not Working

Posted on 2011-03-24
3
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

624 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