<?php
if((isset($_GET['gdpremail']))&&(isset($_GET['gdprtype']))&&(isset($_GET['gdprotp'])))
{
	
	global $wpdb;
	$utable=$wpdb->prefix."wpfresh5_gdpr_requests";
	$uupdate=$wpdb->query($wpdb->prepare("update ".$utable." set login=%s where email=%s and type=%s and login=%s ",array('2',$_GET['gdpremail'],$_GET['gdprtype'],$_GET['gdprotp'])));
	if($uupdate)
	{
		echo "<script>alert('Request Confirmed');</script>";
	}
}
?>

<?php
if(isset($_POST['gdprpdasubmit']))
{

     if((filter_var($_POST['gdpremailpda'],FILTER_VALIDATE_EMAIL))&&($_POST['gdprchkbox']=='1'))
	{wpfresh5_gdprRequestDataAccess();	}
	
	
}
if(isset($_POST['gdprfmsubmit']))
{
	if((filter_var($_POST['gdprfmemail'], FILTER_VALIDATE_EMAIL))&&($_POST['gdprchkbox']=='1'))
	{wpfresh5_gdprRequestForgetMe();	}
}
if(isset($_POST['gdprdrsubmit']))
{
	if((filter_var($_POST['gdprdremail'],FILTER_VALIDATE_EMAIL))&&($_POST['gdprchkbox']=='1'))
	{wpfresh5_gdprRequestDataRectification();	}
}
?>
<html>
<head>
<meta charset="utf-8"> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
	$("#gdprfm").hide();$("#gdprdr").hide();
	$("#gdprPDA").click(function(){$("#gdprpda").show();$("#gdprfm").hide();$("#gdprdr").hide();});
	$("#gdprFM").click(function(){$("#gdprfm").show();$("#gdprpda").hide();$("#gdprdr").hide();});
	$("#gdprDR").click(function(){$("#gdprdr").show();$("#gdprpda").hide();$("#gdprfm").hide();});
	
});
</script>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
  <li class="active" id="gdprPDA"><a href="#">Personal Data Access</a></li>
  <li id="gdprFM"><a href="#">Forget Me</a></li>
  <li id="gdprDR"><a href="#">Data Rectification</a></li>
</ul>


<div id="gdprpda" class="form-group">
            <form action="" method="post">
            <br><p>
				<b>Request Your Data Collected By This Website.You will be notified by email once this is done.</b></p>

            
                <label for="gdpremailpda">Email:</label>
                <input type="email" id="gdpremailpda" class="form-control" name="gdpremailpda" value="" required="">
                <br><br>
                <input type="checkbox" name="gdprchkbox" value="1" required="">
                <label for="">
					I consent to my email being collected in order to receive my requested data. See Privacy Policy page for more information.                </label>
                <br><br>
                <input type="submit" class="btn btn-info" name="gdprpdasubmit" value="Submit">
            </form>
        
</div>
<div id="gdprfm" class="Form Control">
<br>
<p>
				<b>Check services you wish to be forgotten by. This will send a request to website admin. You will be notified by e-mail once this is done.</b></p>

            <form action="" method="post">

                

					                        <div class="">
                            <div class="">
                                <input type="checkbox" name="gdprfmchkboxc" value="c">
                            </div>
                            <div class="">
                                <div class=""><b>WordPress Comments</b></div>
                                <div class="">WordPress Comments , entered by users in comments</div>
                            </div>
                        </div>


					                        
                            <div class="">
                                <input type="checkbox" name="gdprfmchkboxp" value="p">
                            </div>
                            
                                <div class=""><b>WordPress Posts</b></div>
                                <div class="">WordPress posts author data</div>
                           
                        


					                        <div class="">
                            <div class="">
                                <input type="checkbox" name="gdprfmchkboxu" value="u">
                            </div>
                            <div class="">
                                <div class=""><b>WordPress User Data</b></div>
                                <div class="">WordPress user data stored as user meta data in database</div>
                            </div>
                        </div>


					

                    <div class="">

                        <label for="">Email:</label>
                        <input type="email" name="gdprfmemail" value="" required="">

                    </div>

                    <input type="checkbox" name="gdprchkbox" value="1" required="">
                    <label for="">
						I consent to my email being collected in order to process this request. See Privacy Policy page for more information.                    </label>

                    <input type="submit"  name="gdprfmsubmit" value="Submit">

</form>
</div>
<div id="gdprdr" class="Form Control">
<br>
            <P>
				<b>Send a request to website admin to rectify your data. Enter what you would like to be rectified. You will be notified once this is done. </b></p>

            <form action="" method="post">

                    <label for="" class="">
						Current data                    </label>
                    <textarea name="gdprcurrent" rows="5" required=""></textarea>

                    <label for="" class="">
						Rectified data                    </label>
                    <textarea name="gdprrectification" rows="5" required=""></textarea>

                    <label for="">Email:</label>
                    <input type="email" name="gdprdremail" value="" required="">

                <br>

                <input type="checkbox" name="gdprchkbox" required="" value="1">
                <label for="">
					I consent to my email being collected in order to process this request. See Privacy Policy page for more information.                </label>

                <input type="submit"  name="gdprdrsubmit" value="Submit">


            </form>
        </div>
</div>

</body>
</html>