✏️ 正在编辑: recharge_home.php
路径:
/home/llpreacharge/public_html/Project/user/recharge_home.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php session_start(); if($_SESSION['rid']) { $userid= $_SESSION['rid']; } else { header('location:../login.php'); } ?> <?php include'connection.php'; $query8="select * from wallet where Userid='$userid' order by Id desc"; $result8=mysqli_query($con,$query8); $data8=mysqli_fetch_array($result8); $currentbal= $data8['Balance']; $query2="select * from retailer where Userid='$userid'"; $result2=mysqli_query($con,$query2); $databal=mysqli_fetch_array($result2); $username=$databal['Name']; $parentid=$databal['Parentid']; $ApiActive=$databal['ApiActive']; // Get Diffrance Value // $quAdminBal="select * from wallet where Userid='1111' order by Id desc"; $reAdminBal=mysqli_query($con,$quAdminBal); $dataAdminBal=mysqli_fetch_array($reAdminBal); $currentAdminbal= $dataAdminBal['Balance']; $TotalIdeaBal=0; $TotalJioBal=0; $TotalVodaBal=0; $TotalAirtelBal=0; $quMyAPI="select * from myapi where Operator='Idea'"; $reMyAPI=mysqli_query($con,$quMyAPI); while($dataMyAPI=mysqli_fetch_array($reMyAPI)) { $LapuIdeaBal=$dataMyAPI['LapuBal']; $TotalIdeaBal=$TotalIdeaBal+$LapuIdeaBal; } $quMyApiJio="select * from myapi where Operator='JIO'"; $reMyApiJio=mysqli_query($con,$quMyApiJio); while($dataMyApiJio=mysqli_fetch_array($reMyApiJio)) { $LapuJioBal=$dataMyApiJio['LapuBal']; $TotalJioBal=$TotalJioBal+$LapuJioBal; } $quMyApiVoda1="select * from myapi where Operator='Voda'"; $reMyApiVoda1=mysqli_query($con,$quMyApiVoda1); while($dataMyApiVoda1=mysqli_fetch_array($reMyApiVoda1)) { $LapuVoda1Bal=$dataMyApiVoda1['LapuBal']; $TotalVodaBal=$TotalVodaBal+$LapuVoda1Bal; } $quMyApiAirtel="select * from myapi where Operator='Airtel'"; $reMyApiAirtel=mysqli_query($con,$quMyApiAirtel); while($dataMyApiAirtel=mysqli_fetch_array($reMyApiAirtel)) { $LapuAirtelBal=$dataMyApiAirtel['LapuBal']; $TotalAirtelBal=$TotalAirtelBal+$LapuAirtelBal; } $ActualIdeaBal=$TotalIdeaBal*96.34/100; $ActualJioBal=$TotalJioBal*92.96/100; $ActualVodaBal=$TotalVodaBal*96.34/100; $ActualAirtelBal=$TotalAirtelBal*96.63/100; $quUniqueAPI="select * from myapi where LapuName='Unique_API'"; $reUniqueAPI=mysqli_query($con,$quUniqueAPI); $dataUniqueAPI=mysqli_fetch_array($reUniqueAPI); $UniqueAPIBal=$dataUniqueAPI['LapuBal']; $url="http://api.rechapi.com/bal.php?format=xml&token=4x9tiI9Zz7Sxmi3G8qvhpczsijBLBt"; $request_timeout = 60; // 60 seconds timeout $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); $curl_error = curl_errno($ch); $getserver= curl_getinfo($ch); curl_close($ch); if($getserver["http_code"]==200) { $xml = simplexml_load_string($output); $rechApiBal=$xml->bal; } $curl = curl_init(); //KWIK_API BALANCE CODE// $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.kwikapi.com/api/v2/balance.php?api_key=8tyeubd-prieyeiw-854125-75yhr-8454adz", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $data2=json_decode($response); $KwikApiBal = $data2->response->balance;; } $queryMd="select * from masterdis"; $resultMd=mysqli_query($con,$queryMd); $rowMd=mysqli_num_rows($resultMd); $sumMdBal=0; while($mdData=mysqli_fetch_array($resultMd)) { $totalMdBal=$mdData['Balance']; $sumMdBal=$sumMdBal+$totalMdBal; } $querydis="select * from distributer"; $resultdis=mysqli_query($con,$querydis); $rowdis=mysqli_num_rows($resultdis); $sumDisBal=0; while($disData=mysqli_fetch_array($resultdis)) { $totalDisBal=$disData['Balance']; $sumDisBal=$sumDisBal+$totalDisBal; } $query1="select * from retailer"; $result1=mysqli_query($con,$query1); $row1=mysqli_num_rows($result1); $sumRet=0; while($row11=mysqli_fetch_array($result1)) { $retalrBal=$row11['Balance']; $sumRet=$sumRet+$retalrBal; } $query4="select * from commwallet where Active='0'"; $result4=mysqli_query($con,$query4); $sum4=0; while($row4=mysqli_fetch_array($result4)) { $data4=$row4['Balance']; $sum4=$sum4+$data4; } $TotUsrBal=$sumMdBal+$sumDisBal+$sumRet+$sum4; $totalWalletBal=$currentAdminbal+$TotUsrBal; $TotalApiBal=$ActualIdeaBal+$ActualJioBal+$ActualVodaBal+$ActualAirtelBal+$rechApiBal+$KwikApiBal+$UniqueAPIBal; $Managebal=$totalWalletBal-$TotalApiBal; $BenefitBal=1000000-$Managebal; ?> <html> <title>LLP Recharge</title> <head> <script type='text/javascript' src='//platform-api.sharethis.com/js/sharethis.js#property=5c01770ef30c5a001138cb08&product=social-ab' async='async'></script> <style> body{background:url('bg.jpg'); background-size:cover; width:100%; margin:0px;} .head{background:; width:1500px; height:80px; margin:0px;} #p1{font-size:34px; float:left; Margin:10 0 0 45px; color:#996420; font-weight:bold;} #p2{font-size:20px; float:left; margin:28 0 0 -8px; color:#eaa040; font-family:Courier;} #p3{font-size:15px; font-family:Comic Sans MS; float:left; color:#996420; margin-top:48px; margin-left:-153px;} .h2{background:white; width:400px; height:70px; margin:10 200px;} #link1{float:right; margin:10 30 0 0px; font-size:20px; text-decoration:none; color:white; background:red; padding:5px; border-radius:4px;} #link2{float:right; margin:10 30 0 0px; font-size:20px; background:white;color:Green; padding:5px; border-radius:4px;} #linkApi{float:right; margin:5 140 0 0px; font-size:20px; background:#191970;color:white; padding:5 20px; border-radius:4px; text-decoration:none;} #linkApi:hover{background:#556b2f;} #link3{float:right; margin:25 40 0 0px;} #link1:hover{ padding:5px; border-radius:4px; color:black;} .menu{background:#996420; height:50px; width:1400px; margin-left:10px; padding:0; line-height:40px;} .menu ul{padding:0; margin:0; position:relative; display:inline-block;} .menu ul li{list-style:none; float:left; width:220px; line-height:50px; text-align:center; font-size:20px; margin:0px; padding:0; color:white;} .menu ul li ul {display:none;} .menu ul li:hover{background:#d1994a; cursor:pointer;} .menu ul li:hover ul {display:block; z-index:2;} .menu ul li:hover ul li{background:#d1994a; border-top:solid white 0.1px;} .menu ul li ul li:hover{background:#996420; color:white;} .menu ul li ul li:hover a{ color:white;} .menu ul li a{ text-decoration:none; color:white;} #a1{border:none; color:white;} .menu{letter-spacing:1px;} #bal:hover{background:#996420; cursor:text;} .dmorq{background:#565450; color:white; width:1200px; margin:10 0 0 50px; line-height:40px; z-index:0; border-radius:18px; font-size:24px; font-family:sans-serif;} .rech{width:550px; margin:10 0 0 80px;} table{width:550px; font-size:20px;} #tdfl{float:right; margin-right:15px;} #greenbal{background:; color:white; font-size:22px; border-radius:5px; text-align:center; height:30px; width:180px; line-height:30px; border:2px solid white;} #redbal{background:red; color:white; font-size:22px; border-radius:5px; text-align:center; height:30px; width:180px; line-height:30px; border:2px solid white;} #inpset{width:180px; border-radius:2px; border:1px solid #996420; padding:4px; font-size:20px;} #inpset1{width:180px; border-radius:2px; border:1px solid #996420; padding:4px; font-size:16px;} ::-webkit-input-placeholder{font-size:15px; padding-left:5px; } #rechbtn{background:green; border:none; color:white; font-size:20px; border-radius:5px; cursor:pointer; padding:6px 10px; border:2px solid white; width:180px;} #rechbtn:focus{outline:none;} #rechbtn:hover{ background:#c7fac8; color:black; border:2px solid black; width:180px;} .trarepo{height:30px; background:#996420; width:1450px; margin:0 0 0 20px; padding:0px; line-height:30px;} .trarepo p{font-size:20px; margin-left:20px; color:white;} #dnldLink{text-decoration:none; font-size:22px;} .addiv1{background:; width:400px; height:200px; float:left; position:absolute; top:320px; left:800px; text-align:center; border-radius:20px;} #addmsg{font-size:22px;} #rechreport{width:1450px; margin:0 0 0 20px; padding:0px;} #t1{ width:1450px; text-align:center; border-collapse:collapse; border-color:black; } #t1 th{font-family:calibri; background:#94928f; color:white; } #t1 td{font-family:calibri;} #t1 tr:nth-child(odd){background:#f6f0e8;} #t1 tr:nth-child(even){background:white; } #RechIdColor{color:blue; font-size:22px;} #green{background:green; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;} #red{background:red; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;} #blue{background:blue; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;} #disId{display:none;} #disDiv{position:absolute; width:500px; height:250px; margin:100 0 0 700px; z-index:3; display:none;} #radiobutton{width:20px; height:20px;} #tbl{ margin:0px; border-collapse:collapse; z-index:4;} #tbl th{background:#687388; color:white; font-size:20px; font-family:sans-serif;} #tbl td{background:#f3f4f5; color:black; font-size:20px; font-family:sans-serif;} </style> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-8510562507020545", enable_page_level_ads: true }); </script> <script> function GetDisDetail() { var DisId = document.getElementById("disId").value; var xmlhttpDis = new XMLHttpRequest(); xmlhttpDis.open("GET","my_distributer.php?disId="+DisId, false) xmlhttpDis.send(null); document.getElementById("disDiv").innerHTML = xmlhttpDis.responseText; document.getElementById("disDiv").style.display="block"; document.getElementById("addiv").style.display="none"; } function GetBal() { var usrid = document.getElementById("user").value; var xmlhttp2 = new XMLHttpRequest(); xmlhttp2.open("GET", "get_bal_ajax.php?usr="+usrid, false); xmlhttp2.send(null); var bal = xmlhttp2.responseText; var txtClr = document.getElementById("greenbal"); if(bal>500) { txtClr.style.background = "green"; } else { txtClr.style.background ="red"; } document.getElementById("greenbal").innerHTML = xmlhttp2.responseText; setTimeout("GetBal()",10000) } </script> </head> <body onload="GetRechReport(), GetBal(), MyBlink()"> <div class="head"> <p id="p1">LLP</p> <p id="p2">Recharge</p> <p id="p3">The Complete Solution</p> <a id="link1" href="logout.php">Log Out</a> <p id="link2"><?php echo "Welcome Dear- ".$username." [ ".$userid." ]"; ?></p> <p id="link3"> <iframe src="http://free.timeanddate.com/clock/i6g7kcjv/n44/fs24/fc077104/tct/pct/ftbi/tt0/th2" frameborder="0" width="568" height="30" allowTransparency="true"></iframe> </p> </div> <input type="text" id="disId" value="<?php echo $parentid ;?>"> <div class="menu"> <ul> <li><a href="recharge_home.php" id="a1">Home</a></li> <li>Reports <ul> <li><a href="recharge_history.php">Recharge History</a></li> <li><a href="account_reports.php">Account Reports</a></li> <li><a href="check_status.php">Check Status</a></li> </ul> </li> <li>Documents <ul> <li><a href="api_documents.php" target="_blank">API Documents</a></li> <li><a href="my_commission.php">My Commission</a></li> <li><a href="commision.php">Get Commission</a></li> <li><a href="complain.php">Complain</a></li> <li><a href="Download_GST_Invoice.php">GST Invoice</a></li> <li><a href="../LlpRecharge.apk" download="LlpRecharge" id="dnldLink">Download App</a></li> </ul> </li> <li>Profile <ul> <li><a href="change_profile.php">Change Profile</a></li> <li><a href="change_pwd.php">Change Password</a></li> </ul> </li> <li>Payment Request <ul> <li><a href="payment_request.php">Update Payment</a></li> <li><a href="TopUpReport.php">TopUp Report</a></li> <li><a href="bank_list.php">Bank List</a></li> </ul> </li> <?php if($ApiActive==0){ echo "<li onclick='GetDisDetail()' >My Distributer</li>"; } ?> </ul> </div > <div class="dmorq"> <marquee scrollamount="4" onmouseover="stop()" onmouseout="start()"> <?php $dateformat = Date("d/M/Y"); $querymsg="select * from messege where Users='ALL' or Users='RET' order by Id desc"; $resultmsg=mysqli_query($con,$querymsg); while($datamsg=mysqli_fetch_array($resultmsg)) { echo $datamsg['Messege']." "; } ?> </marquee> </div> <div id="disDiv"> </div> <?php include'connection.php'; if($_SESSION['rid']) { $query2="select * from distributer where Userid='$parentid'"; $result2=mysqli_query($con,$query2); $datad=mysqli_fetch_array($result2); $username=$datad['Name']; $grandparentid=$datad['Parentid']; $ReferId=$datad['ReferId']; $quGetAutoFailedStatus="select * from Auto_Failed where Id='1'"; $reGetAutoFailedStatus=mysqli_query($con,$quGetAutoFailedStatus); $dataGetAutoFailedStatus=mysqli_fetch_array($reGetAutoFailedStatus); $AutoFailedStatus=$dataGetAutoFailedStatus['Status']; date_default_timezone_set("asia/Kolkata"); $datetime= Date("Y-m-d - h:i:s A"); $time= Date("h:i:s A"); $date= Date("Y-m-d"); $date1 = date("Y-m-d h:i:s A"); $time1 = strtotime($date1); $time2 = $time1 - (30 * 60); $date2 = date("h:i:s A", $time2); if(isset($_POST['submit'])) { $service=$_POST['gen']; $operator=$_POST['operator']; $mnum=$_POST['mnum']; $cmnum=$_POST['cmnum']; $amount=$_POST['amount']; $postpaidOperator=substr($operator, -8); $opcodequery="select * from operator where Operator='$operator'"; $opcoderesult=mysqli_query($con,$opcodequery); $opcodedata=mysqli_fetch_array($opcoderesult); $opcode=$opcodedata['Value']; $myApiOpCode=$opcodedata['MyApiValue']; $MyApi2OpCode=$opcodedata['My_API2']; $KwikApiOpCode=$opcodedata['KwikAPI']; $UniqueApiOpCode=$opcodedata['UniqueAPI']; $DiziPayOpCode=$opcodedata['DiziPayApi']; $columName=$opcodedata['Commision_Column']; $querygetcom="select * from commision where Userid='$userid'"; $rsultgetcom=mysqli_query($con,$querygetcom); $data=mysqli_fetch_array($rsultgetcom); $usercommvalue=$data[$columName]; $parentq="select * from commision where Userid='$parentid'"; $parentcomm=mysqli_query($con,$parentq); $dataparcomm=mysqli_fetch_array($parentcomm); $parcommvalue=$dataparcomm[$columName]; $parbalcomm= $parcommvalue-$usercommvalue; $gparentq="select * from commision where Userid='$grandparentid'"; $gparentcomm=mysqli_query($con,$gparentq); $gdataparcomm=mysqli_fetch_array($gparentcomm); $gparcommvalue=$gdataparcomm[$columName]; $gparbalcomm= $gparcommvalue-$parcommvalue; if($operator=="--Select Operator--") { echo "<h1 align='center'><font color='#ff0000'> ✖ You Did Not Select Any Operator !</font></h1>"; } elseif($usercommvalue>$parcommvalue || $parcommvalue>$gparcommvalue) { echo "<h1 align='center'><font color='#ff0000'> ✖ Invalid Commission Value !</font></h1>"; } elseif($amount<6) { echo "<h1 align='center'><font color='#ff0000'> ✖ Amount Is Less Than 6 !</font></h1>"; } else { if(empty($operator) || empty($mnum) || empty($cmnum) || empty($amount)) { echo "<h1 align='center'><font color='#ff0000'> ✖ Please Fill All Field !</font></h1>"; } else { if($mnum==$cmnum) { $numLength = strlen($mnum); $startNum = substr($mnum,0,1); if($service=="Mobile" || $service=="Postpaid") { if($numLength!==10) { $passNum = 0; $msgPass = "MOBILE NUMBER MUST BE 10 DIGIT ONLY !"; } else { $passNum = 1; } } elseif($operator=="TATA SKY DTH") { if($numLength==10) { $passNum = 1; } else { $passNum = 0; $msgPass = "TATA SKY DTH NUMBER MUST BE 10 DIGIT ONLY !"; } } elseif($operator=="DISH TV DTH") { if($numLength==11 && $startNum==0) { $passNum = 1; } else { $passNum = 0; $msgPass = "DISH TV DTH NUMBER MUST BE 11 DIGIT AND START FROM 0 ONLY !"; } } elseif($operator=="AIRTEL DTH") { if($numLength==10 && $startNum==3) { $passNum = 1; } else { $passNum = 0; $msgPass = "AIRTEL DTH NUMBER MUST BE 10 DIGIT AND START FROM 3 ONLY !"; } } else { $passNum = 1; } if($passNum==1) { if($amount<=$currentbal) { $quGetSameRech="select * from recharge where Companyname='$operator' and Mobile='$mnum' and Amount='$amount' and Status='PENDING' and Rechargedate='$date'"; $reGetsameRech=mysqli_query($con,$quGetSameRech); $dataGetSameRech=mysqli_num_rows($reGetsameRech); $quGetSameRech1="select * from recharge where Companyname='$operator' and Mobile='$mnum' and Amount='$amount' and Status='SUCCESS' and Rechargedate='$date'"; $reGetsameRech1=mysqli_query($con,$quGetSameRech1); $dataGetSameRech1=mysqli_num_rows($reGetsameRech1); $quGetSameRech2="select * from recharge where Companyname='$operator' and Mobile='$mnum' and Amount='$amount' and Status='' and Rechargedate='$date'"; $reGetsameRech2=mysqli_query($con,$quGetSameRech2); $dataGetSameRech2=mysqli_num_rows($reGetsameRech2); if($dataGetSameRech>=1 || $dataGetSameRech1>=1 || $dataGetSameRech2>=1) { echo "<h1 align='center'><font color='#ff0000'> ✖ Same Recharge Not Allowed At Same Day !</font></h1>"; } else { $commision=$amount*$usercommvalue/100; $actual=$amount-$commision; $insertq="insert into recharge(Userid,Parentid,Grandparentid,ReferalId,Rechargedate,Time,Agentname,Companyname,Mobile,Amount,Debitamount,Status,AdminDiffValue) values('$userid','$parentid','$grandparentid','$ReferId','$date','$time','$username','$operator','$mnum','$amount','$actual','PENDING','$BenefitBal')"; if(mysqli_query($con,$insertq)) { $newrechid=mysqli_insert_id($con); $TotalApiBal=$TotalAirtelBal+$TotalIdeaBal+$TotalJioBal+$TotalVodaBal+$rechApiBal+$UniqueAPIBal+$KwikApiBal; $insrtDiff="insert into Diff(Rechid,Date,Time,AdminBal,MdBal,DisBal,RetBal,CommBal,TotUsrBal,AirtelBal,IdeaBal,VodaBal,JioBal,UniqBal,KwikBal,RechBal,TotApiBal,Diff) values('$newrechid','$date','$time','$currentAdminbal','$sumMdBal','$sumDisBal','$sumRet','$sum4','$TotUsrBal','$ActualAirtelBal','$ActualIdeaBal','$ActualVodaBal','$ActualJioBal','$UniqueAPIBal','$KwikApiBal','$rechApiBal','$TotalApiBal','$BenefitBal')"; mysqli_query($con,$insrtDiff); mysqli_query($con,"LOCK TABLE wallet WRITE"); $query4="select * from wallet where Userid='$userid' order by Id desc"; $result4=mysqli_query($con,$query4); $data4=mysqli_fetch_array($result4); $oldbalance= $data4['Balance']; $newbal=$oldbalance-$actual; $query5="insert into wallet(Userid,Openingbalance,Debit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount) values('$userid','$oldbalance','$actual','Recharge','$newbal','$date','$time','Recharge','$newrechid','$operator','$mnum','$amount')"; if(mysqli_query($con,$query5)) { mysqli_query($con,"UNLOCK TABLES"); $query9="update retailer set Balance='$newbal' where Userid='$userid'"; mysqli_query($con,$query9); $parcommbal=$amount*$parbalcomm/100; $gparcommbal=$amount*$gparbalcomm/100; $insertparcomm="insert into commwallet(Userid,Balance,Date,Time,Rechargeid,Mobile,Amount,Operator,Retailer,Retailername) values('$parentid','$parcommbal','$date','$time','$newrechid','$mnum','$amount','$operator','$userid','$username')"; mysqli_query($con,$insertparcomm); $insertgparcomm="insert into commwallet(Userid,Balance,Date,Time,Rechargeid,Mobile,Amount,Operator,Retailer,Retailername) values('$grandparentid','$gparcommbal','$date','$time','$newrechid','$mnum','$amount','$operator','$userid','$username')"; mysqli_query($con,$insertgparcomm); $query6="select * from wallet where Userid='$userid' order by Id desc"; $result6=mysqli_query($con,$query6); $data6=mysqli_fetch_array($result6); $ewalletid=$data6['Id']; $query7="update recharge set Balance='$newbal',Ewalletid='$ewalletid' where Id='$newrechid'"; mysqli_query($con,$query7); $query10="update retailer set Lastrechdate='$date' where Userid='$userid'"; mysqli_query($con,$query10); $query8="select * from wallet where Userid='$userid' order by Id desc"; $result8=mysqli_query($con,$query8); $data8=mysqli_fetch_array($result8); $currentbal= $data8['Balance']; $quGetUseApi="select * from operator where Operator='$operator'"; $reGetUseApi=mysqli_query($con,$quGetUseApi); $dataGetUseApi=mysqli_fetch_array($reGetUseApi); $UseApi=$dataGetUseApi['UseAPI']; if($UseApi=="My_API" && $operator=="Airtel" && $amount=="35" || $UseApi=="My_API" && $operator=="Airtel" && $amount=="65") { $quGetTopupapi="select * from topupapi where Id='1'"; $reGetTopupApu=mysqli_query($con,$quGetTopupapi); $dataGetTopupApi=mysqli_fetch_array($reGetTopupApu); $TopupApi=$dataGetTopupApi['TopupApi']; $UseApi2=$TopupApi; } else { $UseApi2=$UseApi; } if($UseApi2=="My_API") { $UpdateRechApibal="update recharge set API='My_API1' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $token="01dc7e7d-ec4d-42db-99b4-cdf62a80a72a"; $url="https://www.vastwebindia.com/API/API/Recharge?Mobile=$mnum&OptCode=$myApiOpCode&Amount=$amount&Token=$token&Userid=sameermansuri111@gmail.com&rch_id=$newrechid"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.vastwebindia.com/API/API/Recharge?Mobile=$mnum&OptCode=$myApiOpCode&Amount=$amount&Token=$token&Userid=sameermansuri111@gmail.com&rch_id=$newrechid", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => array( "Postman-Token: 7d11312d-5948-4352-be19-b636152e59fd", "cache-control: no-cache" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $response; $data2=json_decode($response); $queryUpadateOrderId="update recharge set API='My_API1' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfully !</font></h1><br>"; } } elseif($UseApi2=="My_API2") { $UpdateRechApibal="update recharge set API='My_API2' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $ch = curl_init(); if (!$ch) { die("Couldn't initialize a cURL handle"); } curl_setopt($ch, CURLOPT_URL,'https://mrobotics.in/api/recharge?'); // Target URL curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"api_token=37a1e7bd-3d24-4d73-8c17-ecd76d5a847e&mobile_no=$mnum&amount=$amount&company_id=$MyApi2OpCode&order_id=$newrechid&is_stv=false"); $result = curl_exec ($ch); $result = (array)json_decode($result); // print_r($result); // echo "<br>"; $status1 = $result['status']; $errorMsg = $result['errorMessage']; $msg = $result['response']; $txnId = $result['tnx_id']; $LapuNo = $result['lapu_no']; $LapuBal = $result['balance']; $updateLapu="update recharge set LapuNo='$LapuNo', ApiBal='$LapuBal' where Id='$newrechid'"; mysqli_query($con,$updateLapu); if($status1=="SUCCESS" || $status1=="success") { $GetLapuOldBal="select * from recharge where LapuNo='$LapuNo' and status='SUCCESS' order by Id desc"; $reGetLapuOldBal=mysqli_query($con,$GetLapuOldBal); $dataGetLapuOldBal=mysqli_fetch_array($reGetLapuOldBal); $LapuOldBal=$dataGetLapuOldBal['ApiBal']; $remaiBal=$LapuOldBal-$amount; $LapuDiff = $LapuBal-$remaiBal; $queryUpadateOrderId="update recharge set Transactionid='$orderId', Status='SUCCESS', Operatorid='$txnId', LapuOldBal='$LapuOldBal', Diff='$LapuDiff', API='My_API2', LapuNo='$LapuNo', ApiBal='$LapuBal' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); $quUpdatebal="update myapi set LapuBal='$LapuBal' where LapuNumber='$LapuNo'"; mysqli_query($con,$quUpdatebal); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfully !</font></h1><br>"; } elseif($status1=="FAILED" || $status1=="failure") { if($msg=="No records found" || $msg=="IN Bad MSISDN" || $msg=="Subscriber Not Found") { $Printmsg ="Invalid Number Or Operator !"; } elseif($msg=="No Plans Found with this Amount " || $msg=="Transaction Failed" || $msg=="Card gorup set ID not found.") { $Printmsg ="Invalid Amount !"; } else { $Printmsg =$msg; } if($msg=="No Plans Found with this Amount " || $msg=="You can only select other than prime plan for recharge. " || $msg=="No records found" || $msg=="You can only select other than prime plan for recharge." || $msg=="IN Bad MSISDN" || $msg=="Transaction Failed" || $msg=="Subscriber Not Found" || $msg=="Card gorup set ID not found.") { mysqli_query($con,"LOCK TABLE wallet WRITE"); $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $refundewalletid=mysqli_insert_id($con); mysqli_query($con,"UNLOCK TABLES"); $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$Printmsg', Responsetxt='$resText', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } elseif($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$msg', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$errorMsg, $msg', Responsetxt='$resText', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } } elseif($UseApi2=="Kwik_API") { $UpdateRechApibal="update recharge set API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $apikey="8tyeubd-prieyeiw-854125-75yhr-8454adz"; if($postpaidOperator=="Postpaid") { $url="https://www.kwikapi.com/api/v2/bills/recharge.php?api_key=$apikey&number=$mnum&amount=$amount&opid=$KwikApiOpCode&state_code=0&order_id=$newrechid"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; $errData=json_decode($err); $status1 = $errData->status; $resText = $errData->message; if($status1=="FAILED") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$resText', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } } else { $data2=json_decode($response); $status1 = $data2->status; $resText = $data2->message; $txnId = $data2->opr_id; $kwikApiBal = $data2->balance; if($status1=="PENDING" || $status1=="SUCCESS") { $queryUpadateOrderId="update recharge set Transactionid='$orderId', Status='$status1', Operatorid='$txnId', API='Kwik_API', ApiBal='$kwikApiBal' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfull !</font></h1><br>"; } elseif($postpaidOperator=="Postpaid") { } elseif($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$resText', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='$status1', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } } else { $url="https://www.kwikapi.com/api/v2/recharge.php?api_key=$apikey&number=$mnum&amount=$amount&opid=$KwikApiOpCode&state_code=0&order_id=$newrechid"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $data2=json_decode($response); $status1 = $data2->status; $resText = $data2->message; $txnId = $data2->opr_id; $kwikApiBal = $data2->balance; if($status1=="PENDING") { $queryUpadateOrderId="update recharge set Transactionid='$orderId', Status='$status1', Operatorid='$txnId', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfull !</font></h1><br>"; } elseif($status1=="SUCCESS") { $GetLapuOldBal="select * from recharge where LapuNo='Kwik_Api' and status='SUCCESS' order by Id desc"; $reGetLapuOldBal=mysqli_query($con,$GetLapuOldBal); $dataGetLapuOldBal=mysqli_fetch_array($reGetLapuOldBal); $LapuOldBal=$dataGetLapuOldBal['ApiBal']; $remaiBal=$LapuOldBal-$amount; $queryUpadateOrderId="update recharge set Transactionid='$orderId', Status='$status1', Operatorid='$txnId', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.kwikapi.com/api/v2/balance.php?api_key=8tyeubd-prieyeiw-854125-75yhr-8454adz", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $data2=json_decode($response); $KwikApiBal = $data2->response->balance;; } $LapuDiff=$KwikApiBal-$remaiBal; $UpdateRechApibal="update recharge set ApiBal='$KwikApiBal', LapuNo='Kwik_Api', Diff='$LapuDiff' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfull !</font></h1><br>"; } elseif($postpaidOperator=="Postpaid") { } elseif($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$resText', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='$status1', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText', API='Kwik_API' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } } } elseif($UseApi2=="Unique_API") { $UpdateRechApibal="update recharge set API='Unique_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $apiUserId="9897095971"; $apiPwd="123456"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://uniqueebazaar.store/index.php/RechargeWebService/apitransaction?userid=9897095971&password=123456&mobile=$mnum&opt=$UniqueApiOpCode&amount=$amount&agentid=$newrechid&fmt=json", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => array( "Postman-Token: 12172b3e-8111-46ff-a491-71ca0f581b7e", "cache-control: no-cache" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $data2=json_decode($response); $TxnId = $data2->userDATA->RBID; $status1 = $data2->userDATA->Status; $resText = $data2->userDATA->MSG; $opId = $data2->userDATA->OPID; $UniqApiBal = $data2->userDATA->BAL; if($status1=="Error") { if($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', API='Unique_API1', AdminOpId='$resText' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','FAILED')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText', API='Unique_API2$status1' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } elseif($status1=="SUCCESS" || $status1=="Success") { $GetLapuOldBal="select * from recharge where LapuNo='Unique_Api' and status='SUCCESS' order by Id desc"; $reGetLapuOldBal=mysqli_query($con,$GetLapuOldBal); $dataGetLapuOldBal=mysqli_fetch_array($reGetLapuOldBal); $LapuOldBal=$dataGetLapuOldBal['ApiBal']; $remaiBal=$LapuOldBal-$amount; if(empty($UniqApiBal) || $UniqApiBal==0) { $UniqApiBal2=$LapuOldBal-$amount; } else { $UniqApiBal2=$UniqApiBal; } $LapuDiff=$UniqApiBal2-$remaiBal; $quUpdatebal="update myapi set LapuBal='$UniqApiBal2' where LapuName='Unique_API'"; mysqli_query($con,$quUpdatebal); $updateLapuNo="update recharge set LapuNo='Unique_Api', LapuOldBal='$LapuOldBal', Diff='$LapuDiff' where Id='$newrechid'"; mysqli_query($con,$updateLapuNo); $queryUpadateOrderId="update recharge set API='Unique_API2', Operatorid='$opId', ApiBal='$UniqApiBal2', AdminOpId='S', Status='$status1' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfull !</font></h1><br>"; } elseif($status1=="FAILED" || $status1=="Failed") { if($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', API='Unique_API3', AdminOpId='$status1' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','FAILED')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText', API='Unique_API2$status1' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } } } elseif($UseApi2=="DiziPay_Api") { $UpdateRechApibal="update recharge set API='DiziPay_Api' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $ApiKey="qYpom1zuu0%2bJMfK1iuYr%2fITnSZFQPeFEAE%2fdl%2fo69mY%3d"; $ApiPwd="123456"; $url="http://login.dizi-pay.com/retailer/api/do_recharge_transaction.aspx?key=$ApiKey&password=$ApiPwd&mobile=$mnum&amount=$amount&opcode=$DiziPayOpCode&requestid=$newrechid"; $request_timeout = 60; // 60 seconds timeout $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); $curl_error = curl_errno($ch); $getserver= curl_getinfo($ch); curl_close($ch); $xml = simplexml_load_string(preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $output)); $DiziPayApiBal=$xml->Balance; $status1 = $xml->Status; $errorMsg = $xml->Balance; $msg = $xml->MSG; $txnId = $xml->TransID; $OrderID = $xml->OrderID; if($status1=="SUCCESS") { $GetLapuOldBal="select * from recharge where LapuNo='DiziPay_Api' and status='SUCCESS' order by Id desc"; $reGetLapuOldBal=mysqli_query($con,$GetLapuOldBal); $dataGetLapuOldBal=mysqli_fetch_array($reGetLapuOldBal); $LapuOldBal=$dataGetLapuOldBal['ApiBal']; $remaiBal=$LapuOldBal-$amount; $LapuDiff = $DiziPayApiBal-$remaiBal; $queryUpadateOrderId="update recharge set Transactionid='$orderId', Status='SUCCESS', Operatorid='$txnId', LapuOldBal='$LapuOldBal', Diff='$LapuDiff', API='DiziPay_Api', LapuNo='DiziPay_Api', ApiBal='$DiziPayApiBal' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfully !</font></h1><br>"; } elseif($status1=="PROCESSED") { $queryUpadateOrderId="update recharge set Transactionid='$OrderID', Status='PENDING', Operatorid='$txnId', LapuOldBal='$LapuOldBal', Diff='$LapuDiff', API='My_API2', LapuNo='$LapuNo', ApiBal='$LapuBal' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfully !</font></h1><br>"; } elseif($status1=="FAILED" || $status1=="FAILURE") { if($msg=="No records found" || $msg=="IN Bad MSISDN" || $msg=="Subscriber Not Found") { $Printmsg ="Invalid Number Or Operator !"; } elseif($msg=="No Plans Found with this Amount " || $msg=="Transaction Failed" || $msg=="Card gorup set ID not found.") { $Printmsg ="Invalid Amount !"; } else { $Printmsg =$msg; } if($msg=="No Plans Found with this Amount " || $msg=="You can only select other than prime plan for recharge. " || $msg=="No records found" || $msg=="You can only select other than prime plan for recharge." || $msg=="IN Bad MSISDN" || $msg=="Transaction Failed" || $msg=="Subscriber Not Found" || $msg=="Card gorup set ID not found.") { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$Printmsg', Responsetxt='$resText', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } elseif($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$msg', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='FAILED', Transactionid='$orderId', Operatorid='$errorMsg, $msg', Responsetxt='$resText', API='My_API2' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } } elseif($UseApi2=="Rech_API") { $UpdateRechApibal="update recharge set API='Rech_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); $token="4x9tiI9Zz7Sxmi3G8qvhpczsijBLBt"; $url="http://api.rechapi.com/recharge.php?format=xml&token=$token&mobile=$mnum&amount=$amount&opid=$opcode&urid=$newrechid"; $request_timeout = 60; // 60 seconds timeout $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $request_timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); $curl_error = curl_errno($ch); $getserver= curl_getinfo($ch); curl_close($ch); if($getserver["http_code"]==200) { $xml = simplexml_load_string($output); $orderId=$xml->orderId; $status1=$xml->status; $mobile=$xml->mobile; $amount=$xml->amount; $operatorId=$xml->operatorId; $error_code=$xml->error_code; $service=$xml->service; $resText=$xml->resText; if($status1=="PENDING" || $status1=="SUCCESS") { $queryUpadateOrderId="update recharge set Transactionid='$orderId', API='Rech_API' where Id='$newrechid'"; mysqli_query($con,$queryUpadateOrderId); echo "<h1 align='center'><font color='#008000'> ✔ Your Request Submit Successfull !</font></h1><br>"; } elseif($AutoFailedStatus=="Deactive") { $UpdateRechApibal="update recharge set ReHit='1', AdminOpId='$resText', API='Rech_API' where Id='$newrechid'"; mysqli_query($con,$UpdateRechApibal); } else { $refundquery="select * from wallet where Userid='$userid' order by Id desc"; $refundresult=mysqli_query($con,$refundquery); $refunddata=mysqli_fetch_array($refundresult); $refundoldbal=$refunddata['Balance']; $refundnewbal=$refundoldbal+$actual; $refundaddbalquery="insert into wallet(Userid,Openingbalance,Credit,Remarks,Balance,Date,Time,Transactiontype,Paynrechid,Operator,Mobile,Amount,Status) values('$userid','$refundoldbal','$actual','Recharge_Refund','$refundnewbal','$date','$time','Recharge_Refund','$newrechid','$operator','$mnum','$amount','$status')"; if(mysqli_query($con,$refundaddbalquery)) { $getrefundewalletid="select * from wallet where Userid='$userid' order by Id desc"; $resultrefundewalletid=mysqli_query($con,$getrefundewalletid); $datarefundewalletid=mysqli_fetch_array($resultrefundewalletid); $refundewalletid=$datarefundewalletid['Id']; $failedquery="update recharge set Creditewalletid='$refundewalletid', Status='$status1', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText', API='Rech_API' where Id='$newrechid'"; mysqli_query($con,$failedquery); $deletecomm="delete from commwallet where Rechargeid='$newrechid'"; mysqli_query($con,$deletecomm); $query9="update retailer set Balance='$refundnewbal' where Userid='$userid'"; mysqli_query($con,$query9); echo "<h1 align='center'><font color='#ff0000'> ✖ Your Recharge Request Has Been Failed Now !</font></h1>"; } } } elseif($curl_error=="28"){ $pendingquery="update recharge set Status='$status1', Transactionid='$orderId', Operatorid='$resText', Responsetxt='$resText' where Id='$newrechid'"; mysqli_query($con,$pendingquery); echo "<h1 align='center'><font color='#3339FF'> » Your Recharge Request Has Been Pending Now !</font></h1><br>"; } } } else { echo "<h1 align='center'><font color='#ff0000'> ✖ Error 5 !</font></h1>"; } } else { echo "<h1 align='center'><font color='#ff0000'> ✖ Error For Insert Data !</font></h1>"; } } } else { echo "<h1 align='center'><font color='#ff0000'> ✖ Your Balance Is Low !</font></h1>"; } } else { echo "<h1 align='center'><font color='#ff0000'> ✖ ".$msgPass."</font></h1>"; } } else { echo "<h1 align='center'><font color='#ff0000'> ✖ Mobile Number And Confirm Number Does Not Match !</font></h1>"; } } } echo "<meta http-equiv='refresh' content='5' />"; } } else { header('location:../login.php'); } ?> <div class="rech"> <input type="number" id="user" value="<?php echo $userid; ?>" style="display:none;"> <form method='post'> <table border="0" cellpadding="10"> <tr> <td id="tdfl">Balance : </td> <?php if($currentbal>=500) { $colorBal="greenbal"; } else { $colorBal="redbal"; } ?> <td ><p id="greenbal"></p></td> </tr> <tr> <td id="tdfl">Recharge: </td> <td > <?php include'connection.php'; $querygetservic="select * from service"; $resultgetservic=mysqli_query($con,$querygetservic); ?> <script> function onchange_event(arg) { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET","ajax.php?sid="+arg,false); xmlhttp.send(null); document.getElementById("divop").innerHTML=xmlhttp.responseText; } </script> <input type='radio' id="radiobutton" name='gen' value='Mobile' onchange='onchange_event(1)' required/>Mobile <input type='radio' id="radiobutton" name='gen' value='DTH' onchange='onchange_event(2)' required/>DTH <input type='radio' id="radiobutton" name='gen' value='Postpaid' onchange='onchange_event(3)' required/>Postpaid </td> </tr> <tr> <td id="tdfl">Operator: </td> <td> <div id="divop"> <select name="operator" id="inpset1" required> <option id="opfont">--Select Operator--</option> </select> </div></td> </tr> <tr> <td id="tdfl">DTH / Mobile No:</td> <td><input type="number" name="mnum" placeholder="Enter Number.." id="inpset" required></td> <tr> <td id="tdfl">Confirm No:</td> <td><input type="number" name="cmnum" placeholder="Re-Enter Number.." id="inpset" required></td> </tr> <tr> <td id="tdfl">Amount:</td> <td><input type="number" name="amount" placeholder="Enter Amount.." id="inpset" required></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" id="rechbtn" value="Recharge Now" onclick="show()"></td> </tr> </form> </table> </div> <script> function MyBlink() { var r = document.getElementById("txt"); if(r.style.color=='blue') { r.style.color ='red'; } else { r.style.color ='blue'; } setTimeout('MyBlink()',500) } </script> <div class="addiv1" id="addiv"> <a href="LlpRecharge.apk" download="LlpRecharge" id="dnldLink">Click Hear To Download LLP Recharge Mobile Application</a> </div> <div class="trarepo"> <p>Transaction Reports</p> </div> <input type="text" id="uid" value="<?php echo $userid; ?>" style="display:none;"> <script> function GetRechReport() { var usrid = document.getElementById("uid").value; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET","getrechreport.php?uid="+usrid,false); xmlhttp.send(null); document.getElementById("rechreport").innerHTML = xmlhttp.responseText; setTimeout("GetRechReport()", 10000); } </script> <div id="rechreport"> </div> <div class="foot" > <p >Copyright © 2018 -2019 Long Life Product Pvt. Ltd.</p> </div> </body> </html>
💾 保存文件
← 返回文件管理器