<?php
$gdprpref='wpf5gdpr-';
if(isset($_POST['gdprsettandc']))
{
	update_option($gdprpref.'tandc-version',$_POST['gdprtndcversion']);
   update_option($gdprpref.'tandc-lusr',$_POST['gdprtndclusr']);
   update_option($gdprpref.'tandc-nlusr',$_POST['gdprtndcnlusr']);
   update_option($gdprpref.'tandc-bef',$_POST['beftandc']);
   update_option($gdprpref.'tandc-aft',$_POST['afttandc']);
   if(isset($_POST['wpgdprtandceu']))
   {
	   update_option($gdprpref.'tandc-eu','1');
   }
   else
   {
		update_option($gdprpref.'tandc-eu','0');
   }
}

// var_dump(get_option($gdprpref.'tandc-lusr'));
?>

<h3>Terms And Conditions - <a href="https://wpfreshstart5.com/support/knowledgebase/terms-and-conditions/" target="_blank" style="font-size:0.8em">Support</a></h3>
<!-- 1. Place <b>[wpgdprTandC]</b> shortcode on your existing Terms and Conditions page to add an accept button.<br> -->
<p>Select your Terms and Conditions page below, so users can be redirected there to give their consent.</p>

	<label for="">Redirect logged in users to terms page? </label>
	<label class="radio-inline"><input id="lusr" style="margin-right:6px;margin-left:10px;outline: none;" type="radio"  name="gdprtndclusr" value="1" <?php if(get_option($gdprpref.'tandc-lusr')=='1'){echo "checked='checked'";} ?>>Yes</label>
	<label class="radio-inline"><input id="lusr" style="margin-right:6px;margin-left:10px;outline: none;" type="radio"  name="gdprtndclusr" value="0" <?php if(get_option($gdprpref.'tandc-lusr')=='0'){echo "checked";} ?>>No</label>
<br/>
<br/>
	<label for="">Redirect non logged in users to terms page? </label>
	<label class="radio-inline"><input id="nlusr" type="radio" style="margin-right:6px;margin-left:10px;outline: none;"  name="gdprtndcnlusr" value="1" <?php if(get_option($gdprpref.'tandc-nlusr')=='1'){echo "checked";} ?>>Yes</label>
	<label class="radio-inline"><input id="lusr" type="radio" style="margin-right:6px;margin-left:10px;outline: none;"  name="gdprtndcnlusr" value="0" <?php if(get_option($gdprpref.'tandc-nlusr')=='0'){echo "checked";}  ?>>No</label>
<br/>
<br/>

	<label>
	<input type="checkbox" <?php if(get_option($gdprpref.'tandc-eu')=='1'){echo "checked";} ?> name="wpgdprtandceu" style="margin-right:10px;">
Display only to visitors from EU countries</label>
<br>

<br/>



	<label for="">Select T&C Page</label>
	<p id="lusr" style="margin: 0 0 0px;"><?php wpfresh5_gdpr_all_pages('beftandc') ?></p>
<p><b>Note:</b> you can create a GDPR ready Terms and Conditions page <a href="<?php echo admin_url( 'admin.php?page=wp-freshstart5-legal' );?>">here</a></b>
<br/>
<br/>

	<label for="">What’s the version number of your current T&C policy?</label>
	<input type="text" title="Make sure you change the version number every time when you make a change in the T&C documents so that your site visitors can be redirected afresh.
" name="gdprtndcversion" class="form-control" value="<?php echo get_option($gdprpref.'tandc-version'); ?>" style="width:auto">
<br/>
	   <label for="">Select where to redirect after accepted</label>
	<p id="lusr" style="margin: 0 0 0px;"><?php wpfresh5_gdpr_all_pages('afttandc') ?></p>

	<input type="hidden" value="1" name="gdprsettandc">