Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Permissions Not Working

Posted on 2011-03-24
3
Medium Priority
?
269 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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 i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …
Suggested Courses

886 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