<?php $action=$_REQUEST['action'];?>

<script>







function duplicate_domain_check2(jn_member_id)















{ 















xmlHttp=GetXmlHttpObject()















if (xmlHttp==null)















 {















 alert ("Browser does not support HTTP Request")















 return















 }































 	















		var url="record2.php";















		url=url+"?jn_member_id="+jn_member_id















		url=url+"&sid="+Math.random()















		xmlHttp.onreadystatechange=stateChanged_answer2 















		xmlHttp.open("GET",url,true)















		xmlHttp.send(null)















		















}































function stateChanged_answer2() 















{ 















  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")















  { 















  















	document.getElementById("msg2").innerHTML='<font size=1>'+xmlHttp.responseText+'</font>';















  }















  else















  {















       document.getElementById("msg2").innerHTML="<img src='images/loadingAnimation.gif' border=0  height=5 width=20 >";















  }















}







function GetXmlHttpObject()















{















var xmlHttp=null;















try















 {















 // Firefox, Opera 8.0+, Safari















 xmlHttp=new XMLHttpRequest();















 }















catch (e)















 {















 //Internet Explorer















 try















  {















  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");















  }















 catch (e)















  {















  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");















  }















 }















return xmlHttp;















}















function test()











{















alert('as');















}











</script>



<script language="javascript">





function checkiffilled()





{





   if(document.myform.pack_id.value == "2")





   {





        





        document.myform.month.disabled = true





		





		





	}





	else





	{





	 document.myform.branch.disabled = false





	





	 





	}





}



</script>

</nav>

                </div>

                <!--  END TOPBAR  -->



            </ul>









            <ul class="navbar-item flex-row ml-auto">

                <li class="nav-item align-self-center search-animated">

                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search toggle-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>

                    <form class="form-inline search-full form-inline search" role="search">

                        <div class="search-bar">

                            <input type="text" class="form-control search-form-control  ml-lg-auto" placeholder="Search...">

                        </div>

                    </form>

                </li>

            </ul>



            <ul class="navbar-item flex-row nav-dropdowns">

               



               



                <li class="nav-item dropdown notification-dropdown">

                    <a href="javascript:void(0);" class="nav-link dropdown-toggle" id="notificationDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg><span class="badge badge-success"></span>

                    </a>

                    <div class="dropdown-menu position-absolute" aria-labelledby="notificationDropdown">

                        <div class="notification-scroll">

						  <?

		   





							 $query_not = $mysqli->prepare("select heading, content from notice");



													$query_not->execute();



													$query_not->bind_result($heading, $content);

		   

		   ?>

		   <?

		                                 while ($query_not->fetch()){

		                                  ?>



                            <div class="dropdown-item">

                                <div class="media server-log">

                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-server"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6" y2="6"></line><line x1="6" y1="18" x2="6" y2="18"></line></svg>

                                    <div class="media-body">

                                        <div class="data-info">

                                            <h6 class=""><? echo $heading;?></h6>

                                            <p class=""><? echo $content;?></p>

                                        </div>



                                        <div class="icon-status">

                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>

                                        </div>

                                    </div>

                                </div>

                            </div>

							<? } ?>



                            



                            

                        </div>

                    </div>

                </li>

				

											<?

$member_id=$_SESSION['member_id'];

$qry2=$mysqli->prepare("select name,ewallet  from member where member_id=?");



$qry2->bind_param("s", $member_id);



  $qry2->execute();



$qry2->bind_result($name,$ewallet); 



	while($qry2->fetch())



	{



	

	$name=$name;

	$ewallet=$ewallet;



	}

?>



                <li class="nav-item dropdown user-profile-dropdown order-lg-0 order-1">

                    <a href="javascript:void(0);" class="nav-link dropdown-toggle user" id="user-profile-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                        <div class="media">

                            <img src="assets/img/90x90.jpg" class="img-fluid" alt="admin-profile">

                        </div>

                    </a>

                    <div class="dropdown-menu position-absolute" aria-labelledby="userProfileDropdown">

                        <div class="user-profile-section">

                            <div class="media mx-auto">

                                <div class="media-body">

                                    <h5>Name : <? echo $name;?></h5>

                                    <p>User Name : <? echo $member_id;?></p>

                                </div>

                            </div>

                        </div>

                        <div class="dropdown-item">

                            <a href="update_profile.php">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg> <span>Profile</span>

                            </a>

                        </div>

                       

                        <div class="dropdown-item">

                            <a href="logout.php">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg> <span>Log Out</span>

                            </a>

                        </div>

                    </div>



                </li>

            </ul>

        </header>

    </div>

    <!--  END NAVBAR  -->



    <!--  BEGIN MAIN CONTAINER  -->

    <div class="main-container" id="container">



        <div class="overlay"></div>

        <div class="search-overlay"></div>

        

        <!--  BEGIN CONTENT PART  -->

        <div id="content" class="main-content">

            <div class="layout-px-spacing">



                <div class="page-header">

                    <div class="page-title">

                        <h3><? echo $name;?>(<? echo $member_id;?>)</h3>

                    </div>

                    

                    <div class="toggle-switch">

                        <label class="switch s-icons s-outline  s-outline-secondary">

                            <input type="checkbox" checked="" class="theme-shifter">

                            <span class="slider round">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>



                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>

                            </span>

                        </label>

                    </div>

                </div>

				<?















$member_id=$_SESSION['member_id'];







	$query=$mysqli->prepare("select cwallet from member where member_id=?");
   $query->bind_param("s", $member_id);
$query->execute();
$query->bind_result($cwallet);
while($query->fetch())
{
$cwallet=$cwallet;
}
$up_drt2=$mysqli->prepare("update member set cwallet_in=? where member_id=?");
$up_drt2->bind_param('ss', $cwallet,$member_id);
$up_drt2->execute();									

 ?>





                <div class="row layout-top-spacing">



          

     <div id="basic" class="col-lg-12 col-sm-12 col-12 layout-spacing">

                            <div class="statbox widget box box-shadow">

                                <div class="widget-header">                                

                                    <div class="row">

                                        <div class="col-xl-12 col-md-12 col-sm-12 col-12">

                                            <h4>T-Wallet is $ <? echo $cwallet;?> </h4>

                                        </div>

                                    </div>

                                </div>

								<?php







						  if($_SESSION['msg_box']!="")







						  {?>

                                <div class="alert alert-light-success border-0 mb-4" role="alert"> <font color="#FF3300"><? echo $_SESSION['msg_box'];?> </font></div>

								<?	} 







						 unset($_SESSION['msg_box']);











						?>

						<? if($action==""){?>

						 <form class="form-horizontal" action="twallet_tran.php?action=process" method="post" enctype="multipart/form-data"  name="myform" onSubmit="return formcheck();">

                                <div class="widget-content widget-content-area">

                                    



                                  <div class="input-group mb-4">

                                                  <div class="input-group-prepend">

                                                    <span class="input-group-text" id="basic-addon5">User Name</span>

                                                  </div>

                                                 <input type="text" class="form-control" placeholder="Please Enter User Name" name="jn_member_id" onblur=duplicate_domain_check2(this.value) />

                                                </div>

												

												   <div class="input-group mb-4">

                                                  

                                                <span class=red id=msg2></span>

                                                </div>

												

												<div class="input-group mb-4">

                                                  <div class="input-group-prepend">

                                                    <span class="input-group-text" id="basic-addon5">Amount</span>

                                                  </div>

												 <input type="text"  class="form-control" placeholder="Amount in USDT" name="amount" onKeyUp="JavaScript:if(this.value.substring(0,1)=='0' || this.value.substring(0,1)=='+') this.value = ''; if(parseInt(this.value)!=this.value) this.value = this.value.substring(0,this.value.length-1);" >
                                                </div>

												

												

												

												

												

												

												<div class="input-group mb-4">

                                                  <div class="input-group-prepend">

                                                    <span class="input-group-text" id="basic-addon5">T-Password</span>

                                                  </div>

                                               <input type="password" class="form-control" placeholder="Enter T-Password" name="tpassword">

                                                </div>

                                                <div class="row">

                                                    <div class="col text-sm-left text-center">

                                                        <button class="btn btn-primary mt-4">Submit</button>

                                                    </div>

                                                </div>



                                   

                                </div>

								</form>

								

								<? } ?>

                            </div>

                        </div>



                    

                



                    



                    



                </div>

				

<?php











	 



if($action=="process")
{


$member_id=$_SESSION['member_id'];
$amount=$_REQUEST['amount'];
$tpassword=$_REQUEST['tpassword'];				  
$jn_member_id=$_REQUEST['jn_member_id'];
$extra=	$amount*3/100;	  

$qury=$mysqli->prepare("select intro_id,position,active  from member where member_id=?");

$qury->bind_param("s", $jn_member_id);

$qury->execute();



								  $qury->bind_result($intro_id,$position,$wactive);



								  while($qury->fetch())

									{

									$intro_id=$intro_id;



									$position=$position;

									

									$wactive=$wactive;



									}







									$stmt2 = $mysqli->prepare('SELECT * FROM member where member_id=?');

                                   $stmt2->bind_param('s', $jn_member_id);



$stmt2->execute();





$stmt2->store_result();



$num=$stmt2->num_rows;



if($num==0)



{



	$_SESSION['msg_box']="No Such ID Found.Try Again..";	





header("location:twallet_tran.php?tab_id=tab1&default=twallet_tran");		

}

else

{



$sts="y";



$quryin=$mysqli->prepare("select cwallet,cwallet_in  from member where member_id=?");

$quryin->bind_param("s", $member_id);

$quryin->execute();

 $quryin->bind_result($cwallet,$cwallet_in);

while($quryin->fetch())
{
$cwallet=$cwallet;
$cwallet_in=$cwallet_in;
}



$ded_amount=$extra+$amount;

if($ded_amount>$cwallet_in)

{

$_SESSION['msg_box']="Insufficient T-Wallet Balance!You be charged 3% Extra as Tran Charge";	

header("location:twallet_tran.php?tab_id=tab1&default=twallet_tran");

}

else

{

$stmt3 = $mysqli->prepare('SELECT * FROM member where member_id=? and login_otp=?');



$stmt3->bind_param('ss', $member_id,$tpassword);

$stmt3->execute();

$stmt3->store_result();

$tnum=$stmt3->num_rows;

if($tnum==0)

{

$_SESSION['msg_box']="Invalid Login PIN.Try Again..";	

header("location:twallet_tran.php?tab_id=tab1&default=twallet_tran"); 		

}



else

{

if($wactive=="n")

{

$_SESSION['msg_box']="This Member is Not Active.Try Again..";	

header("location:twallet_tran.php?tab_id=tab1&default=twallet_tran"); 		

}



else

{



if($amount<5)

{

$_SESSION['msg_box']="Minimum Transfer Amount is $ 5 .Try Again.";	

header("location:twallet_tran.php"); 		

}



else

{
$jn_member_id=$_REQUEST['jn_member_id'];
$remark="Transfer To ".$jn_member_id;
$type="Debit";
$wallet_type="C-Wallet";
$sts="y";
$date=date("d-m-Y");
$date_val=date("Ymd");
$insert=$mysqli->prepare("insert into walet (member_id, amount, type, remark, wallet_type, status, date, date_val) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("ssssssss", $member_id, $ded_amount, $type, $remark, $wallet_type, $sts, $date, $date_val);
$insert->execute();
$quryin=$mysqli->prepare("select cwallet,cwallet_in  from member where member_id=?");
$quryin->bind_param("s", $member_id);
$quryin->execute();
$quryin->bind_result($cwallet,$cwallet_in);
while($quryin->fetch())
{
$cwallet=$cwallet;
$cwallet_in=$cwallet_in;
}

$now_cwallet=$cwallet-$ded_amount;
$now_cwallet_in=$cwallet_in-$ded_amount;
$up_ewt=$mysqli->prepare("update member set cwallet=?,cwallet_in=? where member_id=?");
$up_ewt->bind_param('sss', $now_cwallet,$now_cwallet_in,$member_id);
$up_ewt->execute();			



$jn_member_id=$_REQUEST['jn_member_id'];
$remark="Transfer by ".$member_id;
$type="Credit";
$wallet_type="C-Wallet";
$sts="y";
$date=date("d-m-Y");
$date_val=date("Ymd");
//$deduction=$amount*3/100;
$add_amount=$amount;
$insert=$mysqli->prepare("insert into walet (member_id, amount, type, remark, wallet_type, status, date, date_val) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("ssssssss", $jn_member_id, $amount, $type, $remark, $wallet_type, $sts, $date, $date_val);
$insert->execute();
$quryin=$mysqli->prepare("select cwallet,cwallet_in  from member where member_id=?");
$quryin->bind_param("s", $jn_member_id);
$quryin->execute();
$quryin->bind_result($cwallet,$cwallet_in);
while($quryin->fetch())
{
$cwallet=$cwallet;
$cwallet_in=$cwallet_in;
}

$now_cwallet=$cwallet+$amount;
$now_cwallet_in=$cwallet_in+$amount;
$up_ewt=$mysqli->prepare("update member set cwallet=?,cwallet_in=? where member_id=?");
$up_ewt->bind_param('sss', $now_cwallet,$now_cwallet_in,$jn_member_id);
$up_ewt->execute();


$_SESSION['msg_box']="<font color='#009900'>T-Wallet Transfered Successfully.</font>";	

header("location:twallet_tran.php");























						















}

}



}











}















//}					































}







}



?> 