Hi PHP coders,
I've got a little problem here that I hope you'll be able to help me with:
The code displays two buttons depending on a users status. If a user has accessrow[20] enabled they can view one and if they have accessrow[21] enabled they can view the other.
However as well as the above criteria there is a further restriction where users with accessrow[5] equal to the EXACT value "CENTRAL" can view all buttons however users can only view the button where accessrow[5] equals row[5] which is taken from a different table.
Are my statements correct.
From my testing if a user is assigned to CENTRAL the script works, however if a user is assigned to (for example) Cayley - and row[5] = Cayley then the script doesn't display the button.
Here is a copy of some of the code, let me know if you need more code.
echo "<tr>
<td bgcolor='#FFFFFF'><span class='style19'>$row[0]</span></td>
<td bgcolor='#FFFFFF'><span class='style19'>$row[1]</span></td>
<td bgcolor='#FFFFFF'><span class='style19'>$row[2]</span></td>
<td bgcolor='#FFFFFF'><span class='style19'><center>$row[3]</center></span></td>
<td>";
if($accessrow[20]=="on" && $row[5]=="$accessrow[5]")
echo "<a href='edithallnews.php?id=$row[0]'><img border='0' src='images/admin/editicon.jpg'></a> ";
if($accessrow[20]=="on" && $accessrow[5]=="CENTRAL")
echo "<a href='edithallnews.php?id=$row[0]'><img border='0' src="images/admin/editicon.jpg'></a> ";
if($accessrow[21]=="on" && $row[5]==$accessrow[5])
echo "<a href='deletehallnews.php?id=$row[0]'><img border='0' src='images/admin/deleteicon.jpg'></a></td>";
if($accessrow[21]=="on" && $accessrow[5]=="CENTRAL")
echo "<a href='deletehallnews.php?id=$row[0]'><img border='0' src='images/admin/deleteicon.jpg'></a></td>";
echo "</tr>";
$row = mysql_fetch_row($result);
echo "<tr>
<td background=images/tables/background2.jpg'><span class='style19'>$row[0]</span></td>
<td background='images/tables/background2.jpg'><span class='style19'>$row[1]</span></td>
<td background='images/tables/background2.jpg'><span class='style19'>$row[2]</span></td>
<td background='images/tables/background2.jpg'><span class='style19'><center>$row[3]</center></span></td>
<td>";
if($accessrow[20]=="on" && $row[5]=='$accessrow[5]')
echo "<a href='edithallnews.php?id=$row[0]'><img border='0' src='images/admin/editicon.jpg'></a> ";
if($accessrow[20]=="on" && $accessrow[5]=="CENTRAL")
echo "<a href='edithallnews.php?id=$row[0]'><img border='0' src='images/admin/editicon.jpg'></a> ";
if($accessrow[21]=="on" && $row[5]=='$accessrow[5]')
echo "<a href='deletehallnews.php?id=$row[0]'><img border='0' src='images/admin/deleteicon.jpg'></a></td>";
if($accessrow[21]=="on" && $accessrow[5]=="CENTRAL")
echo "<a href='deletehallnews.php?id=$row[0]'><img border='0' src='images/admin/deleteicon.jpg'></a></td>";
echo "</tr>";
}
}
}
?>
</body>
</html>
Many thanks in advance.