<?php

session_start();

include "../config.php";
include "../header.php";
include "../style.php";

if( isset($_SESSION["ulogin"]) )
   	{  // members only stuff!

		include("navigation.php");
        include("../banners2.php");
		
		
		//////////////////////////////////////////////////////////
		//////////// Pre-Deleting the member, the ifs ////////////
		/////////// Part of the Deleted members script ///////////
		//////////////////////////////////////////////////////////
		
		//Get the options of Leaves
		$options = mysql_query ("select * from leaves_options where id='1'");
        $array = mysql_fetch_array($options);
		$scriptactive = $array["leave_active"];
		$email = $array["leave_email"];
		$logleaved = $array["log_leaved"];
		
		if($scriptactive == 1)
		{
			if($email == 1 OR $logleaved == 1)
			{
			?>
		
				<!--* Part of the e-mailing script -->
				<center>
				<br><br>
				<p align="center"><img src="images/deleteaccount.png"><br>We are sorry to see you wanting to leave.<br><br> If you can, please elaborate on why you're leaving in the text box below. We'd be very grateful and it would help us improve our services.</p>
				<p>Once your account is deleted, you will not beable to join again!</p>

				<form method="post" action="deletenow.php"><div class="form"><div class="formlist"></div>

					  <div class="formfield">
						<table width="331" border="0" align="center" cellpadding="0" cellspacing="0">
						  <tr>
							<td width="186"><div align="center">
							  <textarea rows="4" cols="40" name="remarks" value=""></textarea>
							</div></td>
						  </tr>
						</table>
					  </div>

					<div class="form"><div class="formlist">
						<div align="center">
						  <input name="submit" value="Submit & Delete Account" type="submit">
						</div>
					</div>
				</form>
				</center>
				<!--* End of necessary part for the e-mail script -->
		
		
			<?
			}
			else
			{
				?>
				<!--* The original message -->
				<center>
				<br><br>
				Are you sure you want to cancel your <? echo $sitename; ?> account?  If you continue you will no longer have access to your account "<? echo $userid; ?>",<br> you will lose your downline, and will lose all commissions. 
				
				<br><br>
				
				<form method="post" action="deletenow.php"><div class="form"><div class="formlist"></div>

					  <div class="formfield">
						<table width="331" border="0" align="center" cellpadding="0" cellspacing="0">
						  <tr>
							<td width="186"><div align="center">
							</div></td>
						  </tr>
						</table>
					  </div>

					<div class="form"><div class="formlist">
						<div align="center">
						  <input name="submit" value="Delete Account" type="submit">
						</div>
					</div>
				</form>
				</center>
				<!--* End of the original message -->
				<?
			}
		}
		else
		{
			?>
			<!--* The original message -->
			<center>
			<br><br>
			Are you sure you want to cancel your <? echo $sitename; ?> account?  If you continue you will no longer have access to your account "<? echo $userid; ?>",<br> you will lose your downline, and will lose all commissions. 
			
			<br><br>
			
			<form method="post" action="deletenow.php"><div class="form"><div class="formlist"></div>

				  <div class="formfield">
					<table width="331" border="0" align="center" cellpadding="0" cellspacing="0">
					  <tr>
						<td width="186"><div align="center">
						</div></td>
					  </tr>
					</table>
				  </div>

				<div class="form"><div class="formlist">
					<div align="center">
					  <input name="submit" value="Delete Account" type="submit">
					</div>
				</div>
			</form>
			</center>
			<!--* End of the original message -->
			<?
		}
        echo "</td></tr></table>";

	}
	else
	{ ?>
  <p>You must be logged in to access this site. Please <a href="../memberlogin.php">click here</a> to login.</p>
  <?}

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