}?>
</table>
<input type="submit" name="back" value="Back" />
- <!--input type="submit" name="paypal" value="Pay for membership now via PayPal" /-->
- <input type="submit" name="other-payment" value="Pay for membership by bank transfer (or other means)" />
+ <input type="submit" name="confirm" value="Confirm" />
</form><?php
}
function store_member_data($data) {
$fields['date_added'] = date('Y-m-d H:i:s');
foreach (['first_name', 'surname', 'email_address', 'address_line_1',
- 'address_line_2', 'city', 'region', 'postcode', 'country', 'paypal_attempt']
+ 'address_line_2', 'city', 'region', 'postcode', 'country']
as $key)
if (!empty($data[$key])) $fields[$key] = $data[$key];
function content() {?>
<h1>Join the YCRA</h1>
<?php
- if (array_key_exists('paypal-cancel', $_GET)) {?>
- <p>Your PayPal payment has been cancelled and you will not be charged.</p><?php
- return;
- }
- if (array_key_exists('paypal-paid', $_GET)) {?>
- <p>Thank you for paying for your YCRA membership via PayPal. Congratulations
- on becoming a YCRA member!</p><?php
- return;
- }
$errors = $params = [];
if (array_key_exists('back', $_POST))
}
else $params = $_POST;
}
- else if (array_key_exists('paypal', $_POST)) {
- if (validate_member_data($errors, $_POST))
- $errors[] = 'Error occurred redirecting to PayPal. Please try again.';
- $params = $_POST;
- }
- else if (array_key_exists('other-payment', $_POST)) {
+ else if (array_key_exists('confirm', $_POST)) {
if (validate_member_data($errors, $_POST)) {
store_member_data($_POST);?>
- <p>We have received your data. You will become a member of the YCRA after
- you have paid the membership fee of <b>£15.00</b>.</p>
-
- <p>If you wish to pay via bank transfer, our bank details are:</p>
- <table style="width: max-content;">
- <tr>
- <th style="text-align: right;">Sort code:</th>
- <td style="text-align: left;">30-99-50</td>
- </tr>
- <tr>
- <th style="text-align: right;">Account number:</th>
- <td style="text-align: left;">00235588</td>
- </tr>
- </table>
- <p>Please use <q><b>YCRA <?php esc($_POST['surname']);?></b></q> as the
- payment reference.</p><?php
+
+ <p>We have received your registration data.</p><?php
return;
}
else $params = $_POST;
<p>Please use the form below to either join the YCRA, or express interest in
joining the YCRA.</p>
- <p>You will become a member of the YCRA if you enter your details below and
- then subsequently pay for membership. The membership fee is currently
- <b>£15.00</b> for one year.</p>
-
<p>Please view our <a target="_blank" <?php document_href('privacy-policy-v2.pdf');?>>privacy policy</a>
for information on how we will process your data.</p>
text_field($params, 'surname', 'Surname', ['required'=>'']);
email_field($params, 'email_address', 'Email address', ['required'=>'']);?>
- <p>When you join the YCRA, we will send you a membership pack.<!--If you do
- <b>not</b> pay for your membership via PayPal,--> We will need your address so that we can send this to you.
- <!--Please either enter it here, or provide it when you pay for your
- membership.--></p><?php
+ <p>Optionally, give your address below:</p><?php
text_field($params, 'address_line_1', 'Address line 1');
text_field($params, 'address_line_2', 'Address line 2');
<?php
}
-
-if (array_key_exists('paypal', $_POST)) {
- if (validate_member_data($errors, $_POST)) {
- store_member_data(array_merge($_POST, ['paypal_attempt'=>1]));
- $fields = [ 'cmd' => '_cart',
- 'business' => 'treasurer@ycra.org.uk',
- 'upload' => '1',
- 'currency_code' => 'GBP',
- 'item_name_1' => 'One year YCRA membership',
- 'item_number_1' => 'YCRA-MEM-1',
- 'quantity_1' => 1,
- 'amount_1' => 15,
- 'no_shipping' => 2,
- 'no_note' => 1,
- 'cancel_return' => 'https://ycra.org.uk/join.php?paypal-cancel=1',
- 'return' => 'https://ycra.org.uk/join.php?paypal-paid=1',
- ];
- $url_fields = [];
- foreach ($fields as $field=>$value)
- $url_fields[] = urlencode($field) . '=' . urlencode($value);
-
- $url = 'https://www.paypal.com/cgi-bin/webscr?' . implode('&', $url_fields);
- header("Location: $url");
- return;
- }
-}
-
require_once('includes/template.php');
?>