Solved

Permissions Not Working

Posted on 2011-03-24
3
262 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 78
paypal ipn to mysql 3 38
Can't find PHP files on account that has WordPress 3 27
does post require a form or curl to be post 4 33
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…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

778 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