<?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 Balance 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="re_topup.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>

												 <select name="amount" class="form-control">
                                     <?
                                     for($i=1;$i<=40;$i++)

                                     {
									 $value=50*$i;
									 ?>

                                              <option value="<? echo $value;?>">$ <? echo $value;?></option>
											  
											  <? } ?>
											 




                                            </select>
                                                </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'];

$eligible="No";		  

$qury=$mysqli->prepare("select intro_id,position,active,pay_status,dwallet,dwallet_in,working_status,total_income_in,rwallet  from member where member_id=?");

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

$qury->execute();



								  $qury->bind_result($intro_id,$position,$wactive,$pay_status,$dwallet,$dwallet_in,$working_status,$mtotal_income_in,$mrwallet);



								  while($qury->fetch())

									{

									$intro_id=$intro_id;



									$position=$position;

									

									$wactive=$wactive;
									
									$pay_status=$pay_status;
									$dwallet=$dwallet;
									$dwallet_in=$dwallet_in;
									$working_status=$working_status;
									$mtotal_income_in=$mtotal_income_in;
									$mrwallet=$mrwallet;



									}

if($working_status=="y")
{
$fr_rwallet=$mrwallet*4;
$fr_rwallet2=$fr_rwallet-1;
if($fr_rwallet2<$mtotal_income_in && $pay_status=="n"){$eligible="Yes";}
}
if($working_status=="n")
{
$fr_rwallet=$mrwallet*2;
$fr_rwallet2=$fr_rwallet-1;
if($fr_rwallet2<$mtotal_income_in){$eligible="Yes";}
}





									$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:re_topup.php?tab_id=tab1&default=re_topup");		

}

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;





									}





if($amount>$cwallet_in)

{

$_SESSION['msg_box']="Insufficient Topup Wallet Balance!Try Again";	

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

}

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:re_topup.php?tab_id=tab1&default=re_topup"); 		

}



else

{

if($wactive=="n")

{

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

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

}



else

{



if($amount<50)

{

$_SESSION['msg_box']="Minimum Deposite Amount is $ 50 .Try Again.";	

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

}



else

{

if($eligible=="No")

{

$_SESSION['msg_box']="This Member is not Eligible For Re-Topup";	

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

}



else

{





						$jn_member_id=$_REQUEST['jn_member_id'];



$remark="Topup For".$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, $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;







}















$cwallet=$cwallet-$amount;







$cwallet_in=$cwallet_in-$amount;







$up_ewt=$mysqli->prepare("update member set cwallet=?,cwallet_in=? where member_id=?");







$up_ewt->bind_param('sss', $cwallet,$cwallet_in,$member_id);







$up_ewt->execute();			











						$jn_member_id=$_REQUEST['jn_member_id'];



								$query3=$mysqli->prepare("select direct_join, intro_no,left_direct,right_direct,left_direct1,right_direct1,joining_date,rwallet  from member where member_id=?");



					 $query3->bind_param("s", $intro_id);



                  $query3->execute();



$query3->bind_result($direct_join,$intro_no,$left_direct,$right_direct,$left_direct1,$right_direct1,$joining_date,$in_rwallet);



								  while($query3->fetch())



									{





									$direct_join=$direct_join;



									$intro_no=$intro_no;



									$left_direct=$left_direct;



									$right_direct=$right_direct;

									

									$left_direct1=$left_direct1;

									$right_direct1=$right_direct1;

									$joining_date=$joining_date;

									$in_rwallet=$in_rwallet;





									}

									$int_topup=$in_rwallet-1;

									


if($pay_status=="n"){$four_times=$amount*4;$four_times2=$four_times-1;if($dwallet_in>$four_times2){$add_wallet=$four_times;}else{$add_wallet=$dwallet;}}else{$add_wallet=0;}


									$active="y";



									$date=date("d-m-Y");



$date_val=date("Ymd");

$process_status=1;

$up_drt2=$mysqli->prepare("update member set active=?,pay_status=? where member_id=?");

$up_drt2->bind_param('sss', $active,$active, $jn_member_id);

$up_drt2->execute();

$actjn="n";

$up_drtjn=$mysqli->prepare("update joining_details set active=? where member_id=?");

$up_drtjn->bind_param('ss', $actjn,$jn_member_id);

$up_drtjn->execute();


$quryin_wall=$mysqli->prepare("select ewallet,dwallet  from member where member_id=?");
$quryin_wall->bind_param("s", $jn_member_id);
$quryin_wall->execute();
$quryin_wall->bind_result($ewallet,$dwallet);
while($quryin_wall->fetch())
{
$ewallet=$ewallet;
$dwallet=$dwallet;
}
$now_ewallet=$ewallet+$add_wallet;
$now_dwallet=$dwallet-$add_wallet;

$up_wall=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,dwallet=?,dwallet_in=? where member_id=?");

$up_wall->bind_param('sssss', $now_ewallet,$now_ewallet,$now_dwallet,$now_dwallet,$jn_member_id);

$up_wall->execute();




$working_status="y";
$up_drt=$mysqli->prepare("update member set working_status=? where member_id=?");

$up_drt->bind_param('ss', $working_status, $intro_id);

$up_drt->execute();


			

$insert_drt=$mysqli->prepare("insert into member_package (member_id, amount, date, date_val) VALUES (?, ?, ?, ?)");
$insert_drt->bind_param("ssss", $jn_member_id, $amount, $date,$date_val);
$insert_drt->execute();	



if($amount>49 && $amount<250)
{



$plan_id=1;
$count=$amount/50;
$return_amount=$amount*2;

$insert=$mysqli->prepare("insert into joining_details (member_id, amount, date, date_val, count,return_amount,plan_id) VALUES (?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("sssssss", $jn_member_id, $amount, $date, $date_val, $count,$return_amount,$plan_id);
$insert->execute();


}

if($amount>249 && $amount<500)
{



$plan_id=2;
$count=$amount/50;
$return_amount=$amount*2.4;

$insert=$mysqli->prepare("insert into joining_details (member_id, amount, date, date_val, count,return_amount,plan_id) VALUES (?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("sssssss", $jn_member_id, $amount, $date, $date_val, $count,$return_amount,$plan_id);
$insert->execute();


}

if($amount>499)
{



$plan_id=3;
$count=$amount/50;
$return_amount=$amount*3;

$insert=$mysqli->prepare("insert into joining_details (member_id, amount, date, date_val, count,return_amount,plan_id) VALUES (?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("sssssss", $jn_member_id, $amount, $date, $date_val, $count,$return_amount,$plan_id);
$insert->execute();


}













$quryin2=$mysqli->prepare("select rwallet,mem_count  from member where member_id=?");



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



								 $quryin2->execute();



								  $quryin2->bind_result($rwallet,$mem_count);



								  while($quryin2->fetch())

									{

									

									$rwallet=$rwallet;

									$mem_count=$mem_count;
									
									
									}

	

	

									$now_mem_count=$mem_count+$amount;

									$now_rwallet=$rwallet+$amount;


									$up_ewt=$mysqli->prepare("update member set rwallet=?,mem_count=? where member_id=?");

                                    $up_ewt->bind_param('sss', $now_rwallet,$now_mem_count,$jn_member_id);

                                    $up_ewt->execute();	
					





//------------------------------



									


											





//-----------
									



$quryin_act=$mysqli->prepare("select active,pay_status  from member where member_id=?");

								 $quryin_act->bind_param("s", $intro_id);

								 $quryin_act->execute();

								  $quryin_act->bind_result( $in_active,$pay_status);

								  while($quryin_act->fetch())
									{
									$in_active=$in_active;
									$pay_status=$pay_status;
									}											



$direct_com2=$amount*8/100;

$level_income1=$direct_com2;
$add_direct=$direct_com2/$crate;
if($in_active=="y")
{


$date=date("d-m-Y");
$date_val=date("Ymd");
$p_tp="level";
$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
$inst2->bind_param("sssss", $intro_id, $direct_com2, $p_tp,$date,$date_val);
$inst2->execute();

if($pay_status=="y")
{
$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
$quryin2->bind_param("s", $intro_id);
$quryin2->execute();
$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
while($quryin2->fetch())
{
$ewallet=$ewallet;
$ewallet_in=$ewallet_in;
$total_income=$total_income;
}

$now_ewallet=$ewallet+$direct_com2;
$now_total_income=$total_income+$direct_com2;

$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intro_id);
$up_ewt2->execute();
}

if($pay_status=="n")
{
$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
$quryin2->bind_param("s", $intro_id);
$quryin2->execute();
$quryin2->bind_result($dwallet,$dwallet_in);
while($quryin2->fetch())
{
$dwallet=$dwallet;
$dwallet_in=$dwallet_in;

}

$now_dwallet=$dwallet+$direct_com2;

$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intro_id);
$up_ewt2->execute();
}


}


$quryinIN=$mysqli->prepare("select intro_id  from member where member_id=?");



								 $quryinIN->bind_param("s", $intro_id);



								 $quryinIN->execute();



								  $quryinIN->bind_result( $intro_id);



								  while($quryinIN->fetch())

									{

									$intro_id=$intro_id;

									

									}

$date=date("d-m-Y");

$date_val=date("Ymd");



							$ik=0;

$intro_id=$intro_id;										

 while($ik!=29)

{


										  $ik++;

										   $intr_id=$intro_id;

										  $no_intr=0;

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

											$stmt4->bind_param("s", $intr_id);

											$stmt4->execute();

											$stmt4->store_result();

											$no_intr=$stmt4->num_rows;



										

										  $intt_id="";



										  $qry_intr=$mysqli->prepare("SELECT intro_id,active,direct_join,pay_status FROM member where member_id=?");

                                           $qry_intr->bind_param("s", $intr_id);

											  $qry_intr->execute();

											$qry_intr->bind_result($intro_id,$in_active,$direct_join,$pay_status); 

											while($qry_intr->fetch())

											{

											$intt_id=$intro_id;

											$in_active=$in_active;

											$direct_join=$direct_join;
											$pay_status=$pay_status;

											}

										  if($no_intr!=0)

										  {

										  

									if($ik==1 && $in_active=="y" && $direct_join>0)

									{

			

										$sts="y";

										$roi_amt=$amount*4/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==2 && $in_active=="y" && $direct_join>0)

									{

			

										$sts="y";

										$roi_amt=$amount*3/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==3 && $in_active=="y" && $direct_join>1)

									{

			

										$sts="y";

										$roi_amt=$amount*1/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }


										  

									if($ik==4 && $in_active=="y" && $direct_join>1)

									{

			

										$sts="y";

										$roi_amt=$amount*1/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==5 && $in_active=="y" && $direct_join>1)

									{

			

										$sts="y";

										$roi_amt=$amount*1/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  
                                     if($ik==6 && $in_active=="y" && $direct_join>2)

									{

			

										$sts="y";

										$roi_amt=$amount*1/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  
                                   if($ik==7 && $in_active=="y" && $direct_join>2)

									{

			

										$sts="y";

										$roi_amt=$amount*1/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==8 && $in_active=="y" && $direct_join>2)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==9 && $in_active=="y" && $direct_join>3)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==10 && $in_active=="y" && $direct_join>3)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==11 && $in_active=="y" && $direct_join>3)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }	

										  

									if($ik==12 && $in_active=="y" && $direct_join>4)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");

											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }		  	  	  

                                   if($ik==13 && $in_active=="y" && $direct_join>4)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==14 && $in_active=="y" && $direct_join>4)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==15 && $in_active=="y" && $direct_join>5)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }	  	  	

										  

									if($ik==16 && $in_active=="y" && $direct_join>5)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_ewallet,$now_ewallet,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==17 && $in_active=="y" && $direct_join>5)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==18 && $in_active=="y" && $direct_join>6)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==19 && $in_active=="y" && $direct_join>6)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==20 && $in_active=="y" && $direct_join>6)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==21 && $in_active=="y" && $direct_join>7)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==22 && $in_active=="y" && $direct_join>7)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==23 && $in_active=="y" && $direct_join>7)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==24 && $in_active=="y" && $direct_join>8)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==25 && $in_active=="y" && $direct_join>8)

									{

			

										$sts="y";

										$roi_amt=$amount*0.5/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==26 && $in_active=="y" && $direct_join>8)

									{

			

										$sts="y";

										$roi_amt=$amount*0.25/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==27 && $in_active=="y" && $direct_join>9)

									{

			

										$sts="y";

										$roi_amt=$amount*0.25/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==28 && $in_active=="y" && $direct_join>9)


									{

			

										$sts="y";

										$roi_amt=$amount*0.25/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

										  

									if($ik==29 && $in_active=="y" && $direct_join>9)

									{

			

										$sts="y";

										$roi_amt=$amount*0.25/100;
										
										$p_tp="level";
											$inst2=$mysqli->prepare("insert into payment (member_id, pay_amount, pay_type, date,date_val) VALUES (?, ?, ?, ?, ?)");
											$inst2->bind_param("sssss", $intr_id, $roi_amt, $p_tp,$date,$date_val);
											$inst2->execute();

											if($pay_status=="y")
											{
											$quryin2=$mysqli->prepare("select ewallet,ewallet_in,total_income  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($ewallet,$ewallet_in,$total_income);
											while($quryin2->fetch())
											{
											$ewallet=$ewallet;
											$ewallet_in=$ewallet_in;
											$total_income=$total_income;
											}
											
											$now_ewallet=$ewallet+$roi_amt;
											$now_total_income=$total_income+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set ewallet=?,ewallet_in=?,total_income=?,total_income_in=? where member_id=?");
											$up_ewt2->bind_param('sssss', $now_ewallet,$now_ewallet,$now_total_income,$now_total_income,$intr_id);
											$up_ewt2->execute();
											}
											
											if($pay_status=="n")
											{
											$quryin2=$mysqli->prepare("select dwallet,dwallet_in  from member where member_id=?");
											$quryin2->bind_param("s", $intr_id);
											$quryin2->execute();
											$quryin2->bind_result($dwallet,$dwallet_in);
											while($quryin2->fetch())
											{
											$dwallet=$dwallet;
											$dwallet_in=$dwallet_in;
											
											}
											
											$now_dwallet=$dwallet+$roi_amt;
											
											$up_ewt2=$mysqli->prepare("update member set dwallet=?,dwallet_in=? where member_id=?");
											$up_ewt2->bind_param('sss', $now_dwallet,$now_dwallet,$intr_id);
											$up_ewt2->execute();
											}





                                          }

									
	  	  	  	  		  	  	  	  	  	  	  	  	  	  	  	  	  	  	  		  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  





											 $intro_id=$intt_id;



}















										  















										 }
									
									
									//----------------		



//-------------------------------







												





















$new_bid=$_REQUEST['jn_member_id'];


while($new_bid!="ABCD1234")	



						{









												$prt_id="";

												$pos="";

												$qq=$mysqli->prepare("select intro_id from member where member_id=?");

													$qq->bind_param("s", $new_bid);

													$qq->execute();

													$qq->bind_result($intro_id);

													while($qq->fetch())

													{

													$intro_id=$intro_id;

													

													}

													// $prt_id=$parent_id;

											$qq->close();



												

													$agent_id=$intro_id;

													$qq->close();

													$sys="n";	

 

$mem_count=0;

$total_count=0;



												$q2q=$mysqli->prepare("select mem_count,total_count,new_count from member where member_id=?");

													$q2q->bind_param("s", $agent_id);

													$q2q->execute();

													$q2q->bind_result($mem_count,$total_count,$new_count);

													while($q2q->fetch())

													{

													$mem_count=$mem_count;

													$total_count=$total_count;
													
													$new_count=$new_count;

													}



													$now_mem_count=$mem_count+$amount;

													$now_total_count=$total_count+1;
													
													$now_new_count=$new_count+$amount;

													

													$updat_mem=$mysqli->prepare("update member set mem_count=?,total_count=?,new_count=? where member_id=?");

			                                     $updat_mem->bind_param('ssss', $now_mem_count,$now_total_count,$now_new_count,$agent_id);

			                                     $updat_mem->execute();

			                                     $updat_mem->close();

														

//$member_idd="";



$qq3=$mysqli->prepare("select member_id from member where member_id=?");

													$qq3->bind_param("s", $intro_id);

													$qq3->execute();

													$qq3->bind_result($member_id);

													while($qq3->fetch())

													{

													 $member_idd=$member_id;

													

													}

												

												





										 $new_bid=$member_idd;

										//echo "<br>";



$qq3->close();



										}

















										






										



$member_id=$_REQUEST['jn_member_id'];

$amount=$_REQUEST['amount'];
$query_total = $mysqli->prepare("select * from pioneer_achiever");
//$query_total->bind_param("s",$dist_type);
$query_total->execute();
$query_total->store_result();
$total_mem_pio=$query_total->num_rows;

if($total_mem_pio<200 && $amount>499)	
{
$inst2=$mysqli->prepare("insert into pioneer_achiever (member_id, date) VALUES (?, ?)");
											$inst2->bind_param("ss", $member_id, $date);
											$inst2->execute();

}



$quryinIN=$mysqli->prepare("select intro_id  from member where member_id=?");



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



								 $quryinIN->execute();



								  $quryinIN->bind_result( $intro_id);



								  while($quryinIN->fetch())

									{

									$intro_id=$intro_id;

									

									}
$sts="n";

 $qq_spotd = $mysqli->prepare('SELECT * FROM direct_join where status=? and member_id=?');

  $qq_spotd->bind_param('ss',$sts,$intro_id);

						$qq_spotd->execute();

						$qq_spotd->store_result();

						$no_spotd=$qq_spotd->num_rows;







	if($no_spotd!=0)

		 {

		 

		 $qq_spotd3 = $mysqli->prepare("select direct_pv from direct_join where status=? and member_id=?");

          $qq_spotd3->bind_param('ss',$sts,$intro_id);

          $qq_spotd3->execute();

		   $qq_spotd3->bind_result($direct_pv);

		  while ($qq_spotd3->fetch())

           {

            $direct_pv=$direct_pv;

			

			}



		   $sts="n";

		   $direct_amt=$direct_pv+$amount;

		  

		   

		   $up_spotd2=$mysqli->prepare("update direct_join set direct_pv=? where status=? and member_id=?");



			$up_spotd2->bind_param('sss', $direct_amt, $sts,$intro_id);



			$up_spotd2->execute();

		   

		

		 }

		 else

		 {

		    

		    

			

			$instd2=$mysqli->prepare("insert into direct_join (direct_pv,member_id) VALUES (?, ?)");

	        $instd2->bind_param("ss", $amount,$intro_id);
              $instd2->execute();

		 }

						

				



						



//---------------------------------		 



						$sts="n";

 $qq_spot2 = $mysqli->prepare('SELECT * FROM bv_business where status=?');

  $qq_spot2->bind_param('s',$sts);

						$qq_spot2->execute();

						$qq_spot2->store_result();

						$no_spot2=$qq_spot2->num_rows;







	if($no_spot2!=0)

		 {

		 

		 $qq_spot3 = $mysqli->prepare("select total_bv from bv_business where status=?");

          $qq_spot3->bind_param('s',$sts);

          $qq_spot3->execute();

		   $qq_spot3->bind_result($total_bv);

		  while ($qq_spot3->fetch())

           {

            $total_bv=$total_bv;

			

			}



		   $sts="n";

		   $sp_amt2=$total_bv+$amount;

		  

		   

		   $up_spot2=$mysqli->prepare("update bv_business set total_bv=? where status=?");



			$up_spot2->bind_param('ss', $sp_amt2, $sts);



			$up_spot2->execute();

		   

		

		 }

		 else

		 {

		    

		    

			

			$inst2=$mysqli->prepare("insert into bv_business (total_bv) VALUES (?)");



	$inst2->bind_param("s", $amount);



$inst2->execute();

		 }

		 

		 //---------------

		 		$sts="n";

 $qq_spot2 = $mysqli->prepare('SELECT * FROM bv_business_daily where status=?');

  $qq_spot2->bind_param('s',$sts);

						$qq_spot2->execute();

						$qq_spot2->store_result();

						$no_spot2=$qq_spot2->num_rows;







	if($no_spot2!=0)

		 {

		 

		 $qq_spot3 = $mysqli->prepare("select total_bv from bv_business_daily where status=?");

          $qq_spot3->bind_param('s',$sts);

          $qq_spot3->execute();

		   $qq_spot3->bind_result($total_bv);

		  while ($qq_spot3->fetch())

           {

            $total_bv=$total_bv;

			

			}



		   $sts="n";

		   $sp_amt2=$total_bv+$amount;

		  

		   

		   $up_spot2=$mysqli->prepare("update bv_business_daily set total_bv=? where status=?");



			$up_spot2->bind_param('ss', $sp_amt2, $sts);



			$up_spot2->execute();

		   

		

		 }

		 else

		 {

		    

		    

			

			$inst2=$mysqli->prepare("insert into bv_business_daily (total_bv) VALUES (?)");



	$inst2->bind_param("s", $amount);



$inst2->execute();

		 }	
		 
		 
		 
		 $sts="n";

 $qq_spot2 = $mysqli->prepare('SELECT * FROM bv_business_week where status=?');

  $qq_spot2->bind_param('s',$sts);

						$qq_spot2->execute();

						$qq_spot2->store_result();

						$no_spot2=$qq_spot2->num_rows;







	if($no_spot2!=0)

		 {

		 

		 $qq_spot3 = $mysqli->prepare("select total_bv from bv_business_week where status=?");

          $qq_spot3->bind_param('s',$sts);

          $qq_spot3->execute();

		   $qq_spot3->bind_result($total_bv);

		  while ($qq_spot3->fetch())

           {

            $total_bv=$total_bv;

			

			}



		   $sts="n";

		   $sp_amt2=$total_bv+$amount;

		  

		   

		   $up_spot2=$mysqli->prepare("update bv_business_week set total_bv=? where status=?");



			$up_spot2->bind_param('ss', $sp_amt2, $sts);



			$up_spot2->execute();

		   

		

		 }

		 else

		 {

		    

		    

			

			$inst2=$mysqli->prepare("insert into bv_business_week (total_bv) VALUES (?)");



	$inst2->bind_param("s", $amount);



$inst2->execute();

		 }				







				







	







$member_id=$_REQUEST['jn_member_id'];







							















										































































										 











		$_SESSION['msg_box']="<font color='#009900'>Re-Topup Successfull.</font>";















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























						















}

}
}


}











}















//}					































}







}



?> 