<?php
session_start();
include "../config.php";
include "../header.php";
include "../style.php";
if( isset($_SESSION["alogin"]) ) {

$index = $_POST['index'];
$name = $_POST['name'];
$url = $_POST['url'];
$seq = $_POST['seq'];
$memtypes = $_POST['memtypes'];

$memtypes_all_sql = "SELECT SUM(level) AS AllValue FROM memtypes;";
$memtypes_all_result = mysql_query($memtypes_all_sql);
$memtypes_all_row = mysql_fetch_array($memtypes_all_result);
$memtypes_all_value = $memtypes_all_row['AllValue'];
if (is_null($memtypes_all_value)) { $memtypes_all_value = 7; }

if ($memtypes==0) { $memtypes = $memtypes_all_value; }



?>
<table>
<tr>
<td width="15%" valign=top><br>
<? include("adminnavigation.php"); ?>
</td>
<td valign="top" align="center"><br><br>
<?
echo "<font size=2 face='$fonttype' color='$fontcolour'><p><b><center>";
?>
<p>Edit members area navigation (<? echo $name; ?>):</p>
<form method="POST" action="editnavigationnow.php">
<input type="hidden" name="index" value=<? echo $index; ?>>
<table>
<tr>
<td>Button Name:</td>
<td colspan="3"><input type="text" name="name" value="<? echo $name; ?>"></td>
</tr>
<tr>
<td>URL:</td>
<td colspan="3"><input type="text" name="url" value=<? echo $url; ?>></td>
</tr>
<tr>
<td>Display Order:</td>
<td colspan="3"><input type="text" name="seq" value=<? echo $seq; ?>></td>
</tr>
<tr>
<td>Membership Types Allowed:</td>
<td colspan="2">
<input type="radio" name="memtypes_option" value="0"<? if(intval($memtypes)==intval($memtypes_all_value)) echo " CHECKED"; ?>> All Member Types
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<input type="radio" name="memtypes_option" value="1"<? if(intval($memtypes)!=intval($memtypes_all_value)) echo " CHECKED"; ?>> Selected Member Types:&nbsp;
</td>
</tr>
<tr>
<td  colspan="2">&nbsp;</td>
<td>
<input style="margin-left:25px;" type="checkbox" name="memtypes[]" value="1"<? if((intval($memtypes) & 1) AND (intval($memtypes)!=intval($memtypes_all_value))) echo " CHECKED"; ?>> Pro
</td>
</tr>
<tr>
<td  colspan="2">&nbsp;</td>
<td>
<input style="margin-left:25px;" type="checkbox" name="memtypes[]" value="2"<? if((intval($memtypes) & 2) AND (intval($memtypes)!=intval($memtypes_all_value))) echo " CHECKED"; ?>> JV Member
</td>
</tr>
<tr>
<td  colspan="2">&nbsp;</td>
<td>
<input style="margin-left:25px;" type="checkbox" name="memtypes[]" value="4"<? if((intval($memtypes) & 4) AND (intval($memtypes)!=intval($memtypes_all_value))) echo " CHECKED"; ?>> Super JV
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="4" align="center">
    
<input type="submit" value="Save"></td>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</font>
</td>
</tr>
</table>
<?
} else {
echo "Unauthorised Access!";
}

include "../footer.php";
mysql_close($dblink);
?>