<?php
// INCLUDE HEADER IN PAGE
include('other_header.php');
// GET CURRENT DATE AND TIME
$date = date('Y-m-d H:i:s');
if(isset($_POST['success'])) {
	if($_POST['success'] == 'loggedin') {
	?>
	<div style="margin-top: -80px;" class="alert alert-success" role="alert">
		<strong>Well done!</strong> Successfully logged in.
	</div>
	<?php
	}
}

///////////////////////////////////////////////////////////////////
			if($_POST['save_order_footer']) {
				// GET AD ID FROM FORM
				$number = '1';
				while(!empty($_POST["ordernum$number"])) {
					// GET ACTIVE STATUS FROM FORM
					$ordernum = $_POST["ordernum$number"];//////////////////////////////////****
					$ordernum = AntiXSS::setEncoding($ordernum, "UTF-8");
					$ordernum = str_replace('"','',$ordernum);
					$ordernum = str_replace("'","",$ordernum);
					$ordernum = str_replace(">","",$ordernum);
					$ordernum = str_replace("<","",$ordernum);
					$ordernum = str_replace("</","",$ordernum);
					$ordernum = str_replace("&%","",$ordernum);
					$ordernum = str_replace("script","",$ordernum);
					$ordernum = str_replace("(","",$ordernum);
					$ordernum = str_replace(")","",$ordernum);
					$edit = mysql_query("UPDATE Web_Footer_Menu SET ordernum='$ordernum' WHERE id='$number'");
					$number = $number + 1;
				}
				?>
						<div style="margin-top: -80px;" class="alert alert-success" role="alert">
							<strong>Well done!</strong> Menu items edited
						</div>
				<?php
			}// WHEN FORM NOT SUBMITTED
///////////////////////////////////////////////////////////////////
			if($_POST['save_order_header']) {
				// GET AD ID FROM FORM
				$number = 1;
				while(!empty($_POST["ordernum$number"])) {
					// GET ACTIVE STATUS FROM FORM
					$ordernum = $_POST["ordernum$number"];//////////////////////////////////****
					$ordernum = AntiXSS::setEncoding($ordernum, "UTF-8");
					$ordernum = str_replace('"','',$ordernum);
					$ordernum = str_replace("'","",$ordernum);
					$ordernum = str_replace(">","",$ordernum);
					$ordernum = str_replace("<","",$ordernum);
					$ordernum = str_replace("</","",$ordernum);
					$ordernum = str_replace("&%","",$ordernum);
					$ordernum = str_replace("script","",$ordernum);
					$ordernum = str_replace("(","",$ordernum);
					$ordernum = str_replace(")","",$ordernum);
					$edit = mysql_query("UPDATE Web_Header_Menu SET ordernum='$ordernum' WHERE id='$number'");
					$number = $number + 1;
				}
				?>
						<div style="margin-top: -80px;" class="alert alert-success" role="alert">
							<strong>Well done!</strong> Menu items edited
						</div>
				<?php
			}// WHEN FORM NOT SUBMITTED
///////////////////////////////////////////////////////////////////
			if(isset($_POST['edit_all_footer'])) {
				// GET AD ID FROM FORM
				$number = '1';
				while(!empty($_POST["ordernum$number"])) {
					$name = $_POST["name$number"];////////////////////////////////////////****
					$name = AntiXSS::setEncoding($name, "UTF-8");
					$name = str_replace('"','',$name);
					$name = str_replace("'","",$name);
					$name = str_replace(">","",$name);
					$name = str_replace("<","",$name);
					$name = str_replace("</","",$name);
					$name = str_replace("&%","",$name);
					$name = str_replace("script","",$name);
					$name = str_replace("(","",$name);
					$name = str_replace(")","",$name);
					// GET ACTIVE STATUS FROM FORM
					$ordernum = $_POST["ordernum$number"];//////////////////////////////////****
					$ordernum = AntiXSS::setEncoding($ordernum, "UTF-8");
					$ordernum = str_replace('"','',$ordernum);
					$ordernum = str_replace("'","",$ordernum);
					$ordernum = str_replace(">","",$ordernum);
					$ordernum = str_replace("<","",$ordernum);
					$ordernum = str_replace("</","",$ordernum);
					$ordernum = str_replace("&%","",$ordernum);
					$ordernum = str_replace("script","",$ordernum);
					$ordernum = str_replace("(","",$ordernum);
					$ordernum = str_replace(")","",$ordernum);
					// GET ACTIVE STATUS FROM FORM
					$link = $_POST["link$number"];//////////////////////////////////****
					$link = AntiXSS::setEncoding($link, "UTF-8");
					$link = str_replace('"','',$link);
					$link = str_replace("'","",$link);
					$link = str_replace(">","",$link);
					$link = str_replace("<","",$link);
					$link = str_replace("</","",$link);
					$link = str_replace("&%","",$link);
					$link = str_replace("script","",$link);
					$link = str_replace("(","",$link);
					$link = str_replace(")","",$link);
					// GET ACTIVE STATUS FROM FORM
					$parrent = $_POST["parrent$number"];//////////////////////////////////
					$parrent = AntiXSS::setEncoding($parrent, "UTF-8");
					$parrent = str_replace('"','',$parrent);
					$parrent = str_replace("'","",$parrent);
					$parrent = str_replace(">","",$parrent);
					$parrent = str_replace("<","",$parrent);
					$parrent = str_replace("</","",$parrent);
					$parrent = str_replace("&%","",$parrent);
					$parrent = str_replace("script","",$parrent);
					$parrent = str_replace("(","",$parrent);
					$parrent = str_replace(")","",$parrent);
					// GET ACTIVE STATUS FROM FORM
					$texttype = $_POST["local$number"];///////////////////////////////////////////
					$texttype = AntiXSS::setEncoding($texttype, "UTF-8");
					$texttype = str_replace('"','',$texttype);
					$texttype = str_replace("'","",$texttype);
					$texttype = str_replace(">","",$texttype);
					$texttype = str_replace("<","",$texttype);
					$texttype = str_replace("</","",$texttype);
					$texttype = str_replace("&%","",$texttype);
					$texttype = str_replace("script","",$texttype);
					$texttype = str_replace("(","",$texttype);
					$texttype = str_replace(")","",$texttype);
					// GET ACTIVE STATUS FROM FORM
					$modal = $_POST["modal$number"];///////////////////////////////////////****
					$modal = AntiXSS::setEncoding($modal, "UTF-8");
					$modal = str_replace('"','',$modal);
					$modal = str_replace("'","",$modal);
					$modal = str_replace(">","",$modal);
					$modal = str_replace("<","",$modal);
					$modal = str_replace("</","",$modal);
					$modal = str_replace("&%","",$modal);
					$modal = str_replace("script","",$modal);
					$modal = str_replace("(","",$modal);
					$modal = str_replace(")","",$modal);
					// GET ACTIVE STATUS FROM FORM
					$delete = $_POST["delete$number"];///////////////////////////////****
					$delete = AntiXSS::setEncoding($delete, "UTF-8");
					$delete = str_replace('"','',$delete);
					$delete = str_replace("'","",$delete);
					$delete = str_replace(">","",$delete);
					$delete = str_replace("<","",$delete);
					$delete = str_replace("</","",$delete);
					$delete = str_replace("&%","",$delete);
					$delete = str_replace("script","",$delete);
					$delete = str_replace("(","",$delete);
					$delete = str_replace(")","",$delete);
					if($delete == '0') {
						$edit = mysql_query("UPDATE Web_Footer_Menu SET ordernum='$ordernum',modal='$modal',name='$name',link='$link',local='$texttype',up='$parrent' WHERE id='$number'");
					}else {
						$delete = mysql_query("DELETE FROM Web_Footer_Menu WHERE id='$number'");
					}
					$number = $number + 1;
				}
				?>
						<div style="margin-top: -80px;" class="alert alert-success" role="alert">
							<strong>Well done!</strong> Menu items edited
						</div>
				<?php
			}// WHEN FORM NOT SUBMITTED
///////////////////////////////////////////////////////////////////
			if(isset($_POST['edit_all_header'])) {
				// GET AD ID FROM FORM
				$number = '1';
				while(!empty($_POST["ordernum$number"])) {
					$name = $_POST["name$number"];////////////////////////////////////////****
					$name = AntiXSS::setEncoding($name, "UTF-8");
					$name = str_replace('"','',$name);
					$name = str_replace("'","",$name);
					$name = str_replace(">","",$name);
					$name = str_replace("<","",$name);
					$name = str_replace("</","",$name);
					$name = str_replace("&%","",$name);
					$name = str_replace("script","",$name);
					$name = str_replace("(","",$name);
					$name = str_replace(")","",$name);
					// GET ACTIVE STATUS FROM FORM
					$ordernum = $_POST["ordernum$number"];//////////////////////////////////****
					$ordernum = AntiXSS::setEncoding($ordernum, "UTF-8");
					$ordernum = str_replace('"','',$ordernum);
					$ordernum = str_replace("'","",$ordernum);
					$ordernum = str_replace(">","",$ordernum);
					$ordernum = str_replace("<","",$ordernum);
					$ordernum = str_replace("</","",$ordernum);
					$ordernum = str_replace("&%","",$ordernum);
					$ordernum = str_replace("script","",$ordernum);
					$ordernum = str_replace("(","",$ordernum);
					$ordernum = str_replace(")","",$ordernum);
					// GET ACTIVE STATUS FROM FORM
					$link = $_POST["link$number"];//////////////////////////////////****
					$link = AntiXSS::setEncoding($link, "UTF-8");
					$link = str_replace('"','',$link);
					$link = str_replace("'","",$link);
					$link = str_replace(">","",$link);
					$link = str_replace("<","",$link);
					$link = str_replace("</","",$link);
					$link = str_replace("&%","",$link);
					$link = str_replace("script","",$link);
					$link = str_replace("(","",$link);
					$link = str_replace(")","",$link);
					// GET ACTIVE STATUS FROM FORM
					$parrent = $_POST["parrent$number"];//////////////////////////////////
					$parrent = AntiXSS::setEncoding($parrent, "UTF-8");
					$parrent = str_replace('"','',$parrent);
					$parrent = str_replace("'","",$parrent);
					$parrent = str_replace(">","",$parrent);
					$parrent = str_replace("<","",$parrent);
					$parrent = str_replace("</","",$parrent);
					$parrent = str_replace("&%","",$parrent);
					$parrent = str_replace("script","",$parrent);
					$parrent = str_replace("(","",$parrent);
					$parrent = str_replace(")","",$parrent);
					// GET ACTIVE STATUS FROM FORM
					$texttype = $_POST["local$number"];///////////////////////////////////////////
					$texttype = AntiXSS::setEncoding($texttype, "UTF-8");
					$texttype = str_replace('"','',$texttype);
					$texttype = str_replace("'","",$texttype);
					$texttype = str_replace(">","",$texttype);
					$texttype = str_replace("<","",$texttype);
					$texttype = str_replace("</","",$texttype);
					$texttype = str_replace("&%","",$texttype);
					$texttype = str_replace("script","",$texttype);
					$texttype = str_replace("(","",$texttype);
					$texttype = str_replace(")","",$texttype);
					// GET ACTIVE STATUS FROM FORM
					$modal = $_POST["modal$number"];///////////////////////////////////////****
					$modal = AntiXSS::setEncoding($modal, "UTF-8");
					$modal = str_replace('"','',$modal);
					$modal = str_replace("'","",$modal);
					$modal = str_replace(">","",$modal);
					$modal = str_replace("<","",$modal);
					$modal = str_replace("</","",$modal);
					$modal = str_replace("&%","",$modal);
					$modal = str_replace("script","",$modal);
					$modal = str_replace("(","",$modal);
					$modal = str_replace(")","",$modal);
					// GET ACTIVE STATUS FROM FORM
					$delete = $_POST["delete$number"];///////////////////////////////****
					$delete = AntiXSS::setEncoding($delete, "UTF-8");
					$delete = str_replace('"','',$delete);
					$delete = str_replace("'","",$delete);
					$delete = str_replace(">","",$delete);
					$delete = str_replace("<","",$delete);
					$delete = str_replace("</","",$delete);
					$delete = str_replace("&%","",$delete);
					$delete = str_replace("script","",$delete);
					$delete = str_replace("(","",$delete);
					$delete = str_replace(")","",$delete);
					if($delete == '0') {
						$edit = mysql_query("UPDATE Web_Header_Menu SET ordernum='$ordernum',modal='$modal',name='$name',link='$link',local='$texttype',up='$parrent' WHERE id='$number'");
					}else {
						$delete = mysql_query("DELETE FROM Web_Header_Menu WHERE id='$number'");
					}
					$number = $number + 1;
				}
				?>
						<div style="margin-top: -80px;" class="alert alert-success" role="alert">
							<strong>Well done!</strong> Menu items edited
						</div>
				<?php
			}// WHEN FORM NOT SUBMITTED
?>
  <div class="container">
    <div class="text-center">
      <h1><?php echo $title; ?>
      	<small>/Active is: Admin Account
			</small>
		</h1>
 	 </div>
 	 </br>
	<div class="row">
      <div class="col-md-8 col-md-offset-2">
		<div class="well">
			<div class="row">
				<center>
				<form name="csrf_form" id="campaignform" action="" method="POST">
					<div data-original-title="Enter your long URL" data-toggle="tooltip" data-placement="top" title="555" class="input-group">
							<input class="form-control" placeholder="Name" name="name" type="text">
							<span class="input-group-btn">
								<input value="Create" class="btn btn-default" style="width: 150px;" name="addmenuitem" type="submit">
							</span>
					</div>
					<div data-original-title="Enter your long URL" data-toggle="tooltip" data-placement="top" title="555" class="input-group">
							<center>
							<input style="width:50%" class="form-control" placeholder="Order Number" name="ordernum" type="text">
							<input style="width:50%" class="form-control" placeholder="Link" name="link" type="text">
							<select style="width:100%" class="form-control" name='parrent'>
								<option value='0' style="text-align: center;">Parrent</option>
								<option value='0'>TOP ITEM - Without any parent</option>
								<option value='0' style="text-align: right;">HEADER MENU ITEMS</option>
								<?php
									$menulist = mysql_query("SELECT * FROM Web_Header_Menu ORDER BY ordernum ASC");
									while($rowc = mysql_fetch_array($menulist)) 
									{
										if($rowc['local'] == '1') {
											$translationtext = $rowc['name'];
											$translationtext = str_replace("[","",$translationtext);
											$translationtext = str_replace("]","",$translationtext);
											$texttype = $LANG[$translationtext]['definition'];
										}else {
											$texttype = $rowc['name'];
										}
										echo"<option value='{$rowc['id']}'>$texttype</option>";
									}
								?>
								<option value='0' style="text-align: right;">FOOTER MENU ITEMS</option>
								<?php
									$menulist = mysql_query("SELECT * FROM Web_Footer_Menu ORDER BY ordernum ASC");
									while($rowc = mysql_fetch_array($menulist)) 
									{
										if($rowc['local'] == '1') {
											$translationtext = $rowc['name'];
											$translationtext = str_replace("[","",$translationtext);
											$translationtext = str_replace("]","",$translationtext);
											$texttype = $LANG[$translationtext]['definition'];
										}else {
											$texttype = $rowc['name'];
										}
										echo"<option value='{$rowc['id']}'>$texttype</option>";
									}
								?>
							</select>
							</br>
							<input id="translation" class="toggle toggle-left" name="texttype" value="1" type="radio" checked><label style="min-width:20%;width:auto" class="btn btn-default" for="translation" class="btn">Translation</label>
							<input id="basic" class="toggle toggle-right" name="texttype" value="0" type="radio"><label style="min-width:20%;width:auto" class="btn btn-default" for="basic" class="btn">Basic Text</label>
							</br>
							<input id="yes" class="toggle toggle-left" name="modal" value="1" type="radio" checked><label style="min-width:20%;width:auto" class="btn btn-default" for="yes" class="btn">Modal Yes</label>
							<input id="no" class="toggle toggle-right" name="modal" value="0" type="radio"><label style="min-width:20%;width:auto" class="btn btn-default" for="no" class="btn">Modal No</label>
							</br>
							<input id="header" class="toggle toggle-left" name="menutype" value="header" type="radio" checked><label style="min-width:30.2%;width:auto" class="btn btn-default" for="header" class="btn">Header</label>
							<input id="footer" class="toggle toggle-right" name="menutype" value="footer" type="radio"><label style="min-width:30.2%;width:auto" class="btn btn-default" for="footer" class="btn">Footer</label>
							</center>					
					</div>
					<input type="hidden" name="csrf_token" value="<?php echo $token; ?>">
				</form>
				</br>
				</center>
			</div>
        </div>
      </div>
    </div>
	
   <div class="text-center">
      <h1><small>Header Menu</small></h1>
 	</div>
		<div class="col-sm-12">
          <table class="table table-bordered" style="width:100%;max-width:100%"  data-effect="fade">
										<thead>
											<tr>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Order Number</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Name</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Text type</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Link</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Modal</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Parent item</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Delete</th>
											</tr>
										</thead>
											<?php
			$query = "SELECT * FROM Web_Header_Menu ORDER BY ordernum ASC";
			$result = mysql_query($query) or die('Error, query failed');

			// print the random numbers
			
			if(mysql_num_rows($result)<1){
   echo "
						<tr>
							<td>No menu items</td>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
   ";
   }else{
   			?>
   			<form name='actions' action='' method='POST'>
   			<?php
     while($row = mysql_fetch_array($result))
				{
					if($row['local'] == '1') {
						$translationtext = $row['name'];
						$translationtext = str_replace("[","",$translationtext);
						$translationtext = str_replace("]","",$translationtext);
					}
					if($row['modal'] == '0') {
						$modal = 'No';
					}else {
						$modal = 'Yes';
					}
					if($row['up'] == '0') {
						$parrent = '---';
					}else {
						$upperid = $row['up'];
						$q1 = "SELECT `name` FROM `Web_Header_Menu` WHERE `id` = '$upperid'";
						$r1 = mysql_query($q1) or die($q1."<br/><br/>".mysql_error());
						$s1 = mysql_result($r1, 0);
						$upper2 = "SELECT `local` FROM `Web_Header_Menu` WHERE `id` = '$upperid'";
						$upper21 = mysql_query($upper2) or die($upper2."<br/><br/>".mysql_error());
						$upper210 = mysql_result($upper21, 0);
						if($upper210 == '0') {
							$parrent = $s1;
						}else {	
							$s1 = str_replace("[","",$s1);
							$s1 = str_replace("]","",$s1);
							$parrent = $LANG[$s1]['definition'];				
						}				
					}
						?>
						<tr>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['ordernum']; ?>" name='ordernum<?php echo $row['id']; ?>' class='form-control' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['name']; ?>" name='name<?php echo $row['id']; ?>' class='form-control form-success' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='local<?php echo $row['id']; ?>' >
								<?php
									if($row['local'] == '0') {
										?>
											<option value='0'><?php echo 'Basic Text - '.$row['name']; ?></option>
											<option value='1'><?php echo 'Translation - '.$LANG[$translationtext]['definition']; ?></option>
										<?php
									}else {
										?>
											<option value='1'><?php echo 'Translation - '.$LANG[$translationtext]['definition']; ?></option>
											<option value='0'><?php echo 'Basic Text - '.$row['name']; ?></option>
										<?php
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['link']; ?>" name='link<?php echo $row['id']; ?>' class='form-control' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='modal<?php echo $row['id']; ?>' >
								<?php
									if($modal == 'No') {
										?>
											<option value='0'>No</option>
											<option value='1'>Yes</option>
										<?php
									}else {
										?>
											<option value='1'>Yes</option>
											<option value='0'>No</option>
										<?php
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='parrent<?php echo $row['id']; ?>'>
								<option value="<?php echo $row['up'];?>"><?php echo $parrent; ?></option>
								<option value="0">---</option>
								<?php
									$menulist = mysql_query("SELECT * FROM Web_Header_Menu ORDER BY ordernum ASC");
									while($rowc = mysql_fetch_array($menulist)) 
									{
										if($rowc['local'] == '1') {
											$translationtext = $rowc['name'];
											$translationtext = str_replace("[","",$translationtext);
											$translationtext = str_replace("]","",$translationtext);
											$texttype = $LANG[$translationtext]['definition'];
										}else {
											$texttype = $rowc['name'];
										}
										echo"<option value='{$rowc['id']}'>$texttype</option>";
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='delete<?php echo $row['id']; ?>' >
											<option value='0'>No</option>
											<option value='1'>Yes</option>
								</select>
							</td>
						</tr>
						<?php 

				}//END WHILE
				?>
						<tr>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<p>Global actions:</p>
							</td>
							<td colspan="6" style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input style="float:right" name='save_order_header' value="Save order" class='btn btn-default' type='submit'>
								<input style="float:right" name='edit_all_header' value="Edit all" class='btn btn-default' type='submit'>
							</td>
						</tr>
				</form>
				<?php 

       }
	?>
									</table>
        </div>
        
   <div class="text-center">
      <h1><small>Footer Menu</small></h1>
 	</div>
		<div class="col-sm-12">
          <table class="table table-bordered" style="width:100%;max-width:100%"  data-effect="fade">
										<thead>
											<tr>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Order Number</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Name</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Text type</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Link</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Modal</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Parent item</th>
												<th style='color: #DF691A; background-color: #2B3E50;border-collapse: collapse;border: 1px solid #DF691A;'>Delete</th>
											</tr>
										</thead>
											<?php
			$query = "SELECT * FROM Web_Footer_Menu ORDER BY ordernum ASC";
			$result = mysql_query($query) or die('Error, query failed');

			// print the random numbers
			
			if(mysql_num_rows($result)<1){
   echo "
						<tr>
							<td>No menu items</td>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
   ";
   }else{
   			?>
   			<form name='actions' action='' method='POST'>
   			<?php
     while($row = mysql_fetch_array($result))
				{
					if($row['local'] == '1') {
						$translationtext = $row['name'];
						$translationtext = str_replace("[","",$translationtext);
						$translationtext = str_replace("]","",$translationtext);
					}
					if($row['modal'] == '0') {
						$modal = 'No';
					}else {
						$modal = 'Yes';
					}
					if($row['up'] == '0') {
						$parrent = '---';
					}else {
						$upperid = $row['up'];
						$q1 = "SELECT `name` FROM `Web_Footer_Menu` WHERE `id` = '$upperid'";
						$r1 = mysql_query($q1) or die($q1."<br/><br/>".mysql_error());
						$s1 = mysql_result($r1, 0);
						$upper2 = "SELECT `local` FROM `Web_Footer_Menu` WHERE `id` = '$upperid'";
						$upper21 = mysql_query($upper2) or die($upper2."<br/><br/>".mysql_error());
						$upper210 = mysql_result($upper21, 0);
						if($upper210 == '0') {
							$parrent = $s1;
						}else {	
							$s1 = str_replace("[","",$s1);
							$s1 = str_replace("]","",$s1);
							$parrent = $LANG[$s1]['definition'];				
						}				
					}
						?>
						<tr>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['ordernum']; ?>" name='ordernum<?php echo $row['id']; ?>' class='form-control' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['name']; ?>" name='name<?php echo $row['id']; ?>' class='form-control form-success' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='local<?php echo $row['id']; ?>' >
								<?php
									if($row['local'] == '0') {
										?>
											<option value='0'><?php echo 'Basic Text - '.$row['name']; ?></option>
											<option value='1'><?php echo 'Translation - '.$LANG[$translationtext]['definition']; ?></option>
										<?php
									}else {
										?>
											<option value='1'><?php echo 'Translation - '.$LANG[$translationtext]['definition']; ?></option>
											<option value='0'><?php echo 'Basic Text - '.$row['name']; ?></option>
										<?php
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input value="<?php echo $row['link']; ?>" name='link<?php echo $row['id']; ?>' class='form-control' type='text'>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='modal<?php echo $row['id']; ?>' >
								<?php
									if($modal == 'No') {
										?>
											<option value='0'>No</option>
											<option value='1'>Yes</option>
										<?php
									}else {
										?>
											<option value='1'>Yes</option>
											<option value='0'>No</option>
										<?php
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='parrent<?php echo $row['id']; ?>'>
								<option value="<?php echo $row['up'];?>"><?php echo $parrent; ?></option>
								<option value="0">---</option>
								<?php
									$menulist = mysql_query("SELECT * FROM Web_Footer_Menu ORDER BY ordernum ASC");
									while($rowc = mysql_fetch_array($menulist)) 
									{
										if($rowc['local'] == '1') {
											$translationtext = $rowc['name'];
											$translationtext = str_replace("[","",$translationtext);
											$translationtext = str_replace("]","",$translationtext);
											$texttype = $LANG[$translationtext]['definition'];
										}else {
											$texttype = $rowc['name'];
										}
										echo"<option value='{$rowc['id']}'>$texttype</option>";
									}
								?>
								</select>
							</td>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<select style="width:100%" class="form-control" name='delete<?php echo $row['id']; ?>' >
											<option value='0'>No</option>
											<option value='1'>Yes</option>
								</select>
							</td>
						</tr>
						<?php 

				}//END WHILE
				?>
						<tr>
							<td style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<p>Global actions:</p>
							</td>
							<td colspan="6" style='color: #FFF; background-color: #DF691A;border-collapse: collapse;border: 1px solid #2B3E50;'>
								<input style="float:right" name='save_order_footer' value="Save order" class='btn btn-default' type='submit'>
								<input style="float:right" name='edit_all_footer' value="Edit all" class='btn btn-default' type='submit'>
							</td>
						</tr>
				</form>
				<?php 

       }
	?>
									</table>
        </div>
</div>

<?php
include('other_footer.php');
?>
