Hi All,
A bit of a strange one here. I have created the below function and it works for the most part however I noticed that I was still getting access denied. I checked the httpd log and saw this error:
[Tue Oct 01 10:12:46 2013] [error] [client 127.0.0.1] PHP Notice: Undefined index: $access in /var/www/xxxx/public_html/dev/v2.0/inc/functions.php on line 652
I then took a look at the MySQL log to see if there was an issue with the query that the function submits:
SELECT grp.Can_View_Users, grp.group_id, group_name, group_enabled, grp.created, grp.updated FROM groups grp LEFT JOIN members AS users USING(group_id) WHERE users.id =27 GROUP BY grp.group_id
as you can see here it is setting the parameter correctly but when setting it for the PHP code on line 652 it doesnt work :S confused.
function GroupAccess($access){
$db = new DbConnector();
$db->connect();
$sql='SELECT grp.'.$access.', grp.group_id, group_name, group_enabled, grp.created, grp.updated '
.'FROM '.GROUP_TBL.' grp '
.'LEFT JOIN '.USER_TBL.' AS users USING(group_id) '
.'WHERE users.id ='.$_SESSION['uid'].' GROUP BY grp.group_id';
$result = $db->query($sql);
$rows = $db->fetchArray($result);
if($rows['$access'] == 1 && $rows['group_enabled'] == 1)
return true;
}
the above starts at line 643
any assistance would be appreciated as im pulling my hair out here!!