Hello,
Great forum!
I have implemented a USER LOG-IN scheme in my site. Below is the code to build my session variable data:
//Create query
$qry="SELECT * FROM volunteers WHERE Username='$login' AND Password='$password'";
$result=mysql_query($qry);
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['id'];
$_SESSION['SESS_FIRST_NAME'] = $member['First_Name'];
$_SESSION['SESS_LAST_NAME'] = $member['Last_Name'];
$_SESSION['SESS_ADMIN'] = $member['ADMIN'];
session_write_close();
header("location: Service_Dates.php");
exit();
}else {
//Login failed
header("location: login-failed.php");
exit();
}
}else {
die("Query failed");
}
Please notice the ADMIN variable.
How would I display a LINK only if ADMIN = ADMIN (True - checkbox)? Here is some code I wan to add that test to:
<div align="center"><img src="/VOH/Images/logo.jpg" width="703" height="144" longdesc="http://www.dwdataconcepts.com/VOH/index.php" />
<br />
<table width="703" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="54%" height="19"><div align="left" class="style3"><a href="Service_Dates.php">Service Dates</a></div></td>
<td width="32%"><div align="right" class="style3"><a href="Admin_Options.php">Admin Options</a><a href="Service_Dates.php"></a></span></div></td>
<td width="14%"><div align="right" class="style3"><a href="/VOH/logout.php">Log Out</a></span></div></td>
</tr>
</table>
</div>
If the SESSION::ADMIN = TRUE, then display this CODE.
Thanks!