Thank you for your purchase';
} else {
$data = array(
'TOKEN' => $_GET['token'],
'PAYERID' => $_GET['PayerID'],
'PAYMENTACTION' => 'Sale',
'AMT' => $item['total'],
'CURRENCYCODE' => 'USD',
);
$response = $paypal->call('DoExpressCheckoutPayment',$data);
if ( $response && $response['success'] ) {
echo '
Thank you for your purchase
';
$item['paypal_info'] = $response['TRANSACTIONID'];
$item['is_paid'] = 1;
getDBExecute(
'update membership set '
.' paypal_info = '. sqlQuote($response['TRANSACTIONID'])
.',is_paid = 1 '
.' where id = '. $item['id']
);
if ( array_key_exists('obj_data',$item) ) unset($item['obj_data']);
$msg = '
';
foreach($item as $r => $v) {
$msg .= "\n". ''. str_replace('_',' ',$r) .' | '. htmlspecialchars($item[$r]) .' |
';
}
$msg .= '
';
rawHtmlMail(SUPPORT_EMAIL,SUPPORT_EMAIL,'New membership dues submission '. date('m/d/Y'),$msg);
} else {
echo '
Failed to accept payment
';
echo '
'. $paypal->error .'
';
}
}
} else echo '
Failed to find associated payment, please contact an admin
';
}
if ( ! empty($_POST['form_type']) ) {
$total = 0;
$req = array(
'name' => '1',
'affiliation' => '',
'address' => '1',
'city' => '1',
'state' => '1',
'country' => '1',
'zip' => '1',
'email' => '',
'membership_dues' => '',
'conference_registration' => '',
'other_options' => '',
);
$missing = array();
foreach($req as $r => $v) {
if ( $v ) {
if ( empty($_POST[$r]) || trim($_POST[$r]) == '' ) {
array_push($missing,str_replace('_',' ',$r));
}
}
}
if ( empty($_POST['security_code']) || empty($_SESSION['security_code']) || $_POST['security_code'] != $_SESSION['security_code'] ) {
echo '
Please type the security code correctly
';
} else if ( count($missing) ) {
echo '
Please fill in: '. join(', ',$missing) .'
';
} else {
$can_go = false;
$items = array();
if ( @$_POST['membership_dues'] ) {
$ok = false;
foreach($dues as $due) {
foreach($due['dues'] as $n => $ds)
foreach($ds as $a) {
$n_o = trim($due['name'] .' '. $n);
$v = $n_o .' '. $a;
if ( @$_POST['membership_dues'] == $v ) {
$can_go = true;
$total += $a;
$ok = true;
$items[] = array('name'=>$n_o,'cost' => $a);
break;
}
}
}
if ( ! $ok ) $_POST['membership_dues'] = null;
}
if ( @$_POST['institution'] ) {
$ok = false;
foreach($institution as $due) {
foreach($due['dues'] as $n => $ds)
foreach($ds as $a) {
$n_o = trim($due['name'] .' '. $n);
$v = $n_o .' '. $a;
if ( @$_POST['institution'] == $v ) {
$can_go = true;
$total += $a;
$ok = true;
$items[] = array('name'=>$n_o,'cost' => $a);
break;
}
}
}
if ( ! $ok ) $_POST['institution'] = null;
}
$registration_is_late = false;
if ( @$_POST['conference_registration'] ) {
$ok = false;
foreach($registration as $register) {
$enabled = $register['enabled'];
if ( ! $enabled && @$register['enable_date'] && strtotime($register['enable_date']) ) {
if ( strtotime($register['enable_date']) <= $time ) {
$enabled = true;
}
}
$disabled_date = false;
if ( $enabled ) {
if ( @$register['disable_date'] && strtotime($register['disable_date']) ) {
if ( strtotime($register['disable_date']) <= $time ) {
$enabled = false;
$disabled_date = true;
}
}
}
if ( $enabled ) {
foreach($register['prices'] as $n => $a) {
$v = $n .' '. $a;
if ( @$_POST['conference_registration'] == $v ) {
$can_go = true;
$total += $a;
$ok = true;
$items[] = array('name'=>$n,'cost' => $a);
if ( $register['is_late'] ) $registration_is_late = true;
break;
}
}
}
}
if ( ! $ok ) $_POST['conference_registration'] = null;
}
$other_options_sel = array();
if ( @$_POST['other_options'] ) {
foreach($_POST['other_options'] as $k => $v) {
if ( array_key_exists($k,$other_options) ) {
if ( $other_options[$k]['accepted_single'] ) $can_go = true;
$total += $other_options[$k]['cost'];
$other_options_sel[] = $v;
$items[] = array('name'=>$other_options[$k]['name'],'cost' => $other_options[$k]['cost']);
}
}
}
if ( ! empty($_POST['grad_fund']) && is_numeric($_POST['grad_fund']) ) {
if ( $_POST['grad_fund'] < 0 ) {
$_POST['grad_fund'] = round(floatval(preg_replace('/[^0-9\.]/','',@$_POST['grad_fund_other'])),2);
}
if ( $_POST['grad_fund'] > 0 ) {
$total += $_POST['grad_fund'];
$other_options_sel[] = 'Graduate Student Fund $'. $_POST['grad_fund'];
$items[] = array('name'=>'Graduate Student Fund','cost' => $_POST['grad_fund']);
$can_go = true;
}
}
$other_options_sel = join(', ',$other_options_sel);
if ( $can_go ) {
if ( $total > 0 ) {
$data = array(
'Amt' => $total,
'PAYMENTACTION' => 'Sale',
'ReturnUrl' => PAYPAL_RETURN_URL,
'CANCELURL' => PAYPAL_RETURN_URL,
'CURRENCYCODE' => 'USD',
'EMAIL' => $_POST['email'],
'SHIPTONAME' => $_POST['name'],
'SHIPTOSTREET' => $_POST['address'],
'SHIPTOSTATE' => $_POST['state'],
'SHIPTOCITY' => $_POST['city'],
'SHIPTOZIP' => $_POST['zip'],
'SHIPTOCOUNTRY' => $_POST['country'],
'INVNUM' => uniqid(),
'TRANSACTIONID' => uniqid(),
'SOLUTIONTYPE' => 'Sole',
);
$i = 0;
foreach($items as $item) {
$data['L_NAME'. $i] = $item['name'];
$data['L_AMT'. $i] = $item['cost'];
$data['L_QTY'. $i] = 1;
$i++;
}
$response = $paypal->call('SetExpressCheckout',$data);
if ( $response ) {
$response['token'] = urldecode($response['TOKEN']);
$response['redirect_url'] = 'https://www.paypal.com/webscr&cmd=_express-checkout&token='. $response['token'];
if ( $paypal->is_sandbox ) $response['redirect_url'] = 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token='. $response['token'];
$ret = getDBExecute(
'insert into membership (`name`,`affiliation`,`address`,`city`,`state`,country,`zip`,`email`,`membership_dues`,institution,`conference_registration`,registration_is_late,`other_options`,invoice_id,paypal_token,total,`created`,`created_ip`) values('
. sqlQuote($_POST['name'])
.','. sqlQuote($_POST['affiliation'])
.','. sqlQuote($_POST['address'])
.','. sqlQuote($_POST['city'])
.','. sqlQuote($_POST['state'])
.','. sqlQuote($_POST['country'])
.','. sqlQuote($_POST['zip'])
.','. sqlQuote($_POST['email'])
.','. sqlQuote(@$_POST['membership_dues'])
.','. sqlQuote(@$_POST['institution'])
.','. sqlQuote(@$_POST['conference_registration'])
.','. sqlQuote($registration_is_late ? 1 : 0)
.','. sqlQuote($other_options_sel)
.','. sqlQuote($data['INVNUM'])
.','. sqlQuote($response['token'])
.','. sqlQuote($total)
.','. sqlQuote(getDBTime(time()))
.','. sqlQuote($_SERVER['REMOTE_ADDR'])
.')'
);
if ( $ret ) {
header('Location: '. $response['redirect_url']);
exit;
} else {
echo '
Failed to submit
';
}
} else {
die($paypal->error);
}
} else echo '
No total
';
} else echo '
Please select at least one item to purchase
';
}
$_SESSION['security_code'] = rand(1,1232141);
}
if ( $show_form ) {
?>
For new and renewing members, please enter all applicable information below. Then select the items that you wish to purchase and click "Complete your purchase". Follow the directions with paypal to complete the purchase.
If you are unable or prefer not to register using PayPal, please print the registration form below, then send your completed registration form and check payable to AESA to:
John Petrovic
The University of Alabama
College of Education
Tuscaloosa, AL 35487-0302
If you have any problems, please contact JOHN PETROVIC Thank You.