<?php

$url = admin_url('admin.php?page=mywpch_unlock_pro');
if(isset($_POST['submit']))
{
    global $wpdb;
    
    update_option('my_pro_licence_key',$_POST['post_pro1_licence_key']);
    
    // Set up the API request
    if($_POST['post_pro1_licence_key']=='MyContentCreatorPro-1234') {
        update_option('my_pro_licence_status','completed');
        echo 'Your License is active now.';        
    } else {
      echo '<h3>Please Enter valid license key.</h3>';
    }
?>   
    <script>
        location.href = "<?php  echo $url; ?>";
    </script>
    <?php
}

$pro_licence_actv = get_option('my_pro_licence_key');
$pro_licence_email = get_option('my_pro_licence_email');
$pro_licence_status = get_option('my_pro_licence_status');
$pro_licence_type = get_option('my_pro_licence_type');

?>
<br/>
<div class="content_hero_container">
<h3>WELCOME TO MyContentCreatorPro</h3><br/>
<h3>Please activate your license below:-</h3><br/>
<form action="" method="post" enctype="multipart/form-data">
       
    <div style="display: flex;margin-top:10px;">
        
	    <label style="padding:5px;cursor:auto;width:20%;font-size: 16px;">  Licence Key: </label> 
        <input type="text" class="regular-text" name="post_pro1_licence_key" placeholder="Enter the elite licence key" value="<?php if(!empty($pro_licence_actv)) { echo $pro_licence_actv; } ?>" required> <br/>
    </div>
	<input style="margin-top:1em !important;" class="btn btn-success" type="submit" name="submit" value="Submit" />
	
</form>
</div>
<?php 
if($pro_licence_actv == "MyContentCreatorPro-1234" && $pro_licence_status != "inactive")
{
	echo "<br/><h3> You are Using Free version of MyContentCreatorPro. Please  upgrade to elite version of <a href='https://www.mycontentcreatorpro.com/'>MyContentCreatorPro</a></h3><br/><br/><br/>";
}  else {
        	echo "<br/><h3 style='color:#ff0000;'> Please enter valid License key.</h3><br/><br/><br/>";

}
?>