  <?php 
 $chek = mysqli_query($conn,"SELECT * FROM users WHERE email='$user' ");
 
 $pdata = mysqli_fetch_array($chek); 
 if(isset($_POST['key'])){
			
$api_email = $_POST['api_email'];
$webs = $_POST['website'];

$xamount = 5000;

 if(!empty($api_email) && !empty($webs) ){
 
 if($pdata['level'] !== 'paid' ){
     
$updat = mysqli_query($conn,"UPDATE users SET website='$webs' WHERE email ='$user' ");     
	 
echo "<div class='alert alert-danger'>You must have a reseller account to have access to our API, Upgrade your account now to get API access. <br>
<a href='reseller.php'><font color='red'><b>Click Here To Upgrade</b></font></a></div>"; 


	 
	 
	 } else{     
	   
	   
$updat = mysqli_query($conn,"UPDATE users SET apikey='$apikey' WHERE email ='$user' ") or die(mysqli_error()); 

	 }
   
 }else{
	 
	echo "<div class='alert alert-danger'>No Entry made </div>"; 
	 }
       
    } 

?> 
                                    
                                 
                                    
                     <p>Please note API key conditions below:</p>
  <ul class="w3-ul w3-card" style="">
    <li> Fill the form below correctly to request for an API key</li>
    <li> Service available on API are DATA, AIRTIME VTU, Electricity Payment, Cable TV Subscription, BulkSMS, Exam PINs, JAMB PINS, BET Funding, etc.)</li>
    <li> You must upgrade to reseller account to have access to our API <font color="blue"><b>(Current account Type: <?php echo $accType; ?>)</b></font></li>
    <li> You can generate new API key anytime free </li>
    <li> Keep your API key secured, don't share with anyone, <?php echo $sitename; ?> staffs will never request for it</li>
    <li> Enter valid email on API request, updates about API service will be sent to the email</li>
    <li> Enter the website address on which you want to use the API in this format e.g mywebsite.com</li>
    
    <li> For API service technical issue email <?php echo $settings['email'];?> </li>
  </ul>                
                                    
                                    
               Fill the form below to request for an API key:                  
                                        
                                        
                                        
           <form method="post" action="" id="TransTable">
                                        <br>
                                        
                <label for="inputText3" class="col-form-label">Enter Valid Email Address(Update about API will be send to this email)</label>    
                                       <div class="input-group mb-3">
                                               
                      <input type="email" class="form-control" name="api_email" value="<?php echo $email; ?>" readonly>
                                              
                                            </div>      
                                           
                                            
                           <div class="form-group">
          <label for="inputText3" class="col-form-label">Website Address (the website on which you want to use the API)</label>
    <input id="inputText3" type="url" class="form-control" name="website" value="<?php echo $data['website']; ?>">
                                            </div>                   
                                         
                                     <div class="col-sm-6 pl-0">
                                         
                                                <p class="text-center">
                                                    <button type="submit" name="key" class="btn btn-rounded btn-primary" >Request API Key</button>