<?php
	session_start();
	if($_SESSION['rid'])
	{
		$userid=$_SESSION['rid'];
	}
	else
	{
		header('location:../login.php');
	}
?>
        

<?php
	include'connection.php';
	
	$quApiUser="select * from retailer where Userid='$userid'";
	$reApiUser= mysqli_query($con,$quApiUser);
	$dataApiToken=mysqli_fetch_array($reApiUser);
    $ApiToken=$dataApiToken['ApiToken'];
    $CallBackUrl=$dataApiToken['CallBackUrl'];
    $IpAddr=$dataApiToken['IpAddr'];
    
		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");
			
		$query8="select * from wallet where Userid='$userid' order by Id desc";
		$result8=mysqli_query($con,$query8);
		$data8=mysqli_fetch_array($result8);
		$currentbal= $data8['Balance'];
		
?>
<html>
<title>API DOCUMENTS</title>
<head>
<style>
body{background:url('bg.jpg'); background-size:cover; width:1300px; height:; margin:0px;}

.head{background:; width:1350px; height:85px; 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;}
#link1:hover{ padding:5px; border-radius:4px; color:black;}
	
.menu{background:#996420; height:40px; width:1300px; margin:0 0 0 20px; padding:0;}
.menu ul{padding:0; margin:0; position:relative; display:inline-block;}
.menu ul li{list-style:none; float:left; width:170px; line-height:40px;
	text-align:center; font-size:15px; margin:0; 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;}
 
 h1{margin-left:50px;}
 
 .content{background:; width:1350px;}
 h2{margin-left:20px; padding:0;}
 .main{background:#f5f5f5; width:1300px; height:100px; line-height:100px; margin:10px; border-radius:10px;}{}
 .mainRechUrl{background:#f5f5f5; width:1500px; height:100px; line-height:100px; margin:10px; border-radius:10px;}
 #div1{background:; width:400px; height:50px; float:left; margin:25 0 0 0px; line-height:50px; text-align:center; font-weight:bold; font-size:20px; border-radius:5px;}
 #div1 p{padding:0px; margin:0px;}
 #div1 button{font-size:19px; margin:10 0px; width:150px;}
 #token{display:none; padding:0px; margin:10 10px; font-weight:bold; font-size:20px; width:400px;}
 #callBack{display:none; padding:0px; margin:10 10px; font-weight:bold; font-size:20px; width:400px;}
 #IpAddr{display:none; padding:0px; margin:10 10px; font-weight:bold; font-size:20px; width:400px;}
 #div2{background:; width:200px; height:50px; float:right; margin:25 10px; line-height:50px; text-align:center;}
 #subm{ background:pink; padding:5 10px; text-decoration:none; font-size:22px; border-radius:8px; color:white; border-left:3px solid gray; border-bottom:3px solid gray; border-right:none;}
 #subm:hover{background:pink; color:black; cursor:pointer;}
 #divUrl{background:; width:; height:50px; float:left; margin:25 0 0 0px; line-height:50px; text-align:center; font-weight:bold; font-size:18px; border-radius:5px;}
 #divUrl p{margin-left:10px;}
 #divtabl{float:left; background:#f5f5f5; width:1300px; height:; line-height:100px; margin:0 10px; border-radius:10px;}
 #divtabl2{float:left; background:; width:1300px; height:; line-height:100px; margin:0 10px; border-radius:10px;}
 #divopcode{float:left; border:solid black 1px; background:#f5f5f5; margin:10px; text-align:center;}|
 #tbl{margin:10px; border-collapse:collapse;}
 
 
.foot{margin:50px;}
</style>
</head>
<body>
	<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>
	</div>
	<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="my_commission.php">My Commission</a></li>
					<li><a href="commision.php">Get Commission</a></li>
					<li><a href="complain.php">Complain</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="bank_list.php">Bank List</a></li>
				</ul>
			</li>
			<li id="bal">Balance : <?php echo $currentbal; ?></li>
		</ul>
	</div><br>
	<h1>API DOCUMENTS</h1><hr>
	        <h3>Note: Use Request Method = "GET" REQUEST</h3>
	<div class="content">
	    <h2>API Token : </h2>
	    <div class="main">
	        <script>
	            function copyToken()
	            {   
	                var copyText = document.getElementById("token");
	                var pt = document.getElementById("pt");
	                pt.style.display="none";
	                copyText.style.display="block";
	                copyText.select();
	                
	                document.execCommand("copy");
	            }
	        </script>
	        
	        
	        <div id="div1">
	            <p id="pt"><?php echo $ApiToken ; ?></p>
	            <input type="text" value="<?php echo $ApiToken; ?>" id="token">
	        </div>
	        <div id="div1"><button onclick="copyToken()">Copy Token</button></div>
	        <div id="div2"><a href="createToken.php" id="subm">Generate Token</a></div>
	    </div>
	    
	    <h2>Call Back Url : </h2>
	    <div class="main">
	        <script>
	            function callBackUrl()
	            {  
	                var cbu = document.getElementById("cbu");
	                cbu.style.display="none";
	                
	                var inp = document.getElementById("callBack");
	                inp.style.display="block";
	            }
	            
	        </script>
	        
	        <script>
	            function UpdateCallBack()
	            {
	                var Url = document.getElementById("callBack").value;
	                var xmlhttpUrl = new XMLHttpRequest();
	                xmlhttpUrl.open("GET","updateCallBackUrl.php?url="+Url, false)
	                xmlhttpUrl.send(null);
	                var res = xmlhttpUrl.responseText;
	                alert(res);
	                location.reload();
	            }
	        </script>
	        <div id="div1">
	            <p id="cbu"><?php echo $CallBackUrl ; ?></p>
	            <input type="text" value="<?php echo $CallBackUrl ; ?>" id="callBack">
	        </div>
	        <div id="div1"><button onclick="callBackUrl()">Edit</button></div>
	        <div id="div2"><button id="subm" onclick="UpdateCallBack()">Update Call Back</button></div>
	        
	    </div>
	    
	    <h2>IP Address : </h2>
	    <div class="main">
	        <script>
	            function IPAddr()
	            {  
	                var IpA = document.getElementById("IpA");
	                IpA.style.display="none";
	                
	                var inp = document.getElementById("IpAddr");
	                inp.style.display="block";
	            }
	            
	        </script>
	        
	        <script>
	            function UpdateIpAddr()
	            {
	                var Url = document.getElementById("IpAddr").value;
	                var xmlhttpUrl = new XMLHttpRequest();
	                xmlhttpUrl.open("GET","updateIpAddr.php?ip="+Url, false)
	                xmlhttpUrl.send(null);
	                var res = xmlhttpUrl.responseText;
	                alert(res);
	                location.reload();
	            }
	        </script>
	        <div id="div1">
	            <p id="IpA"><?php echo $IpAddr ; ?></p>
	            <input type="text" value="<?php echo $IpAddr ; ?>" id="IpAddr">
	        </div>
	        <div id="div1"><button onclick="IPAddr()">Edit</button></div>
	        <div id="div2"><button id="subm" onclick="UpdateIpAddr()">Update IP</button></div>
	        
	    </div>
	    
	    <h2>Recharge Api Url : </h2>
	    <div class="mainRechUrl">
	        <div id="divUrl">
	            <p id="pt">"http://llprecharge.in/user/API.php?userid=Your_User_Id&token=API_Token&partnerid=Your_Recharge_Id&opcode=Operator_code&mobile=Mobile_No.&amount=Recharge_amount"</p>
	        </div>
	    </div>
	    
	    <h2>Balance Api  Url: </h2>
	    <div class="main">
	        <div id="divUrl">
	            <p id="pt">"http://llprecharge.in/user/api_balance.php?userid=Your_User_Id&token=API_Token"</p>
	        </div>
	    </div>
	    
	    <h2>Status Check Api  Url: </h2>
	    <div class="main">
	        <div id="divUrl">
	            <p id="pt">"http://llprecharge.in/user/api_check_status.php?userid=Your_UserId&token=Api_Token&orderid=Your_Transaction_Id"</p>
	        </div>
	    </div>
	    
	    <div id="divtabl2">
	            <div id="divopcode">
	                <h3>Operator Code :</h3>
	                   <table border="1" cellpadding="10" id="tbl">
	                        <tr>
	                            <th>Operator</th>
	                            <th>Code</th>
	                        </tr>
	                         <?php
	                            $quGetOpCode = "select * from operator";
	                            $reGetOpCode = mysqli_query($con,$quGetOpCode);
	                            while($dataGetOpCode=mysqli_fetch_array($reGetOpCode))
	                            {
	                                echo "<tr>";
	                                echo "<td>".$dataGetOpCode['Operator']."</td>";
	                                echo "<td>".$dataGetOpCode['OwnApiCode']."</td>";
	                                echo "</tr>";
	                            }
	                         ?>
	                    </table>
	            </div>
	                
	             <div id="divopcode">
	                    <h3>Note:- Response Available In JSON Code</h3>
	                    <h3>Direct Response Perameters</h3>
	                    
	                   <table border="1" cellpadding="10" id="tbl">
	                        <tr>
	                            <th>KeyWord</th>
	                            <th>Result</th>
	                        </tr>
	                        <tr>
	                            <td>status</td>
	                            <td>SUCCESS/FAILED/PENDING</td>
	                       </tr>
	                        <tr>
	                            <td>errmsg</td>
	                            <td>Reason For Failed</td>
	                       </tr>
	                        <tr>
	                            <td>partnertid</td>
	                            <td>Api User's Recharge Id</td>
	                       </tr>
	                        <tr>
	                            <td>orderid</td>
	                            <td>LLP Transaction Id</td>
	                       </tr>
	                        <tr>
	                            <td>opid</td>
	                            <td>Referance Id From Operator</td>
	                       </tr>
	                        <tr>
	                            <td>bal</td>
	                            <td>API User Balance</td>
	                       </tr>
	                    </table>
	                    <h3>Status Check API Response Perameters</h3>
	                    
	                   <table border="1" cellpadding="10" id="tbl">
	                        <tr>
	                            <th>KeyWord</th>
	                            <th>Result</th>
	                        </tr>
	                        <tr>
	                            <td>status</td>
	                            <td>SUCCESS/FAILED/PENDING</td>
	                       </tr>
	                        <tr>
	                            <td>errmsg</td>
	                            <td>Invalid Input </td>
	                       </tr>
	                        <tr>
	                            <td>partnertid</td>
	                            <td>Api User's Recharge Id</td>
	                       </tr>
	                        <tr>
	                            <td>orderid</td>
	                            <td>LLP Transaction Id</td>
	                       </tr>
	                        <tr>
	                            <td>opid</td>
	                            <td>Referance Id From Operator</td>
	                       </tr>
	                        <tr>
	                            <td>mobile</td>
	                            <td>Mobile or DTH Number</td>
	                       </tr>
	                        <tr>
	                            <td>amount</td>
	                            <td>Recharge Amount</td>
	                       </tr>
	                        <tr>
	                            <td>operator</td>
	                            <td>Operator Service</td>
	                       </tr>
	                    </table>
	                </div>
	                <div id="divopcode">
	                    <h3>Note:- Recieve Response By GET Method</h3>
	                    <h3>Call Back Response Perameters</h3>
	                    
	                   <table border="1" cellpadding="10" id="tbl">
	                        <tr>
	                            <th>KeyWord</th>
	                            <th>Result</th>
	                        </tr>
	                        <tr>
	                            <td>status</td>
	                            <td>SUCCESS/FAILED/PENDING</td>
	                       </tr>
	                        <tr>
	                            <td>errmsg</td>
	                            <td>Reason For Failed</td>
	                       </tr>
	                        <tr>
	                            <td>partnertid</td>
	                            <td>Api User's Recharge Id</td>
	                       </tr>
	                        <tr>
	                            <td>orderid</td>
	                            <td>LLP Transaction Id</td>
	                       </tr>
	                        <tr>
	                            <td>opid</td>
	                            <td>Referance Id From Operator</td>
	                       </tr>
	                    </table>
	            </div>
	    </div>
	</div>
	
	
	
	<div class="foot">
		<p style="text-align:center;">Copyright &copy; All Right Reserved Long Life Pro Digital Services</p>
	</div>
</body>
</html>