Hope that someone out there can help.
I have the code below that I want to get working but no matter what I try it ALWAYS shows the code.
Basically when a user logs into the administraton area on my site, a session is logged with their username. I want the code below to work so that when this session equals a specific value the html code is shown, however if the specific session value is something else then some other HTML code is shown.
i.e. if user A logs in then can see section A and B on a page. However, if user B logs in they can only see section B.
The code that I have seems to either always show the code or always hide it.
here is the code:
Code: Select all
<h1>Administrator Account</h1>
<?php
include 'dbc.php';
$result = mysql_query("SELECT id,user_name,user_email FROM admin WHERE user_name = '$_SESSION[user_name]'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
if ($row[1]='Webmaster')
{ echo 'not webmaster'; }
else
{
?>
HTML CODE TO BE SHOWN
<?php } ?>