<?php
function shortcodeAcceptUnsubscriptionReqest()
{
	$pref='wpf5gdpr-';
	global $wpdb;
	$table=$wpdb->prefix."wpfresh5_gdpr_requests";
	$login='0';
if(is_user_logged_in())
{
	if(email_exists($_POST['gdpremailuns'])==get_current_user_id())
	{
		$login='1';
		$in=$wpdb->query($wpdb->prepare("insert into ".$table."(id,user,email,login, type,ip,value,updatedvalue,recorded,action, actiontime)values(%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",array('',get_current_user_id(),$_POST['gdpremailpda'],$login,'uns',$_SERVER['REMOTE_ADDR'],'','',date('d-M-Y h:iA'),'0',' ')));

	}

}
if($login=='0')
{
	$login=wpfresh5_gdprMailConfirmationLink($_POST['gdpremailpda'],'Data Access Confirmation','da');
	$in=$wpdb->query($wpdb->prepare("insert into ".$table."(id,user,email,login, type,ip,value,updatedvalue,recorded,action, actiontime)values(%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",array('',get_current_user_id(),$_POST['gdpremailpda'],$login,'uns',$_SERVER['REMOTE_ADDR'],'','',date('d-M-Y h:iA'),'0',' ')));
	echo "<script>alert('Confirmation Link Sent')</script>";
}



	$body="<b>From : ".$_POST['gdpremailpda']."</b>";
	wpfresh5_gdprSendWPMail(get_option($pref.'da-email'),'Data Access Request',$body);
	if($login=='1')
	{echo "<script>alert('Request Received');</script>";}
}
?>
<div class="container-fluid">
  <div class="col-sm-12">
	<div class="row">
<div class="panel panel-primary">
<div class="panel-heading"><h4 class="m0">Unsubscribe Form</h4></div>
<div class="panel-body">
  <form action="" method="post">
      <div class="row">

	<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading"><h4 class="m0">Message to show unsubscribers</h4></div>
<div class="panel-body"><?php wp_editor(get_option($pref.''),'',$editorsettings ); ?></div>
<div class="panel-footer"><form action="" method="post"><input type="submit" class="btn btn-default" value="Use Default Text"  name=""></form></div>
</div>
</div>

<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading"><h4 class="m0">Unsubscribe Confirmation Message</h4></div>
<div class="panel-body"><?php wp_editor(get_option($pref.''),'',$editorsettings ); ?></div>
<div class="panel-footer"><form action="" method="post"><input type="submit" class="btn btn-default" value="Use Default Text"  name=""></form></div>
</div>
</div>

<div class="col-sm-12">
    <div class="form-group">
    	<label for="">Notify Email</label>
    	<input type="email" name="" class="form-control">
    	<input type="submit" class="btn btn-primary" style="margin-top: 8px" value="Submit"  name="">
		</form>
    </div>
          </div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>