Solved

Permissions Not Working

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now