Saabnet.com: Server Too Busy\n"; echo "\n"; include ('/home/httpd/cgi-bin/ad/ad_selector.php'); echo "The server is serving pages to too many people. Please try again in a moment."; echo "\n\n"; exit(); } function spit_header($pageTitle = '') { echo "Saabnet.com: $pageTitle\n"; echo "\n"; include ('/home/httpd/cgi-bin/ad/ad_selector.php'); echo "

$pageTitle


\n"; echo "
\n"; } function spit_footer() { echo "
\n"; include ('/home/httpd/htdocs/tsn/tsnmap.txt'); echo "\n"; } # script-specific functions below here function check_renew_attempt() { # Check to see if their signup attempt was successful. # If so, return a 1 and print out nothing. # If not, spit out a form with the errors found global $memberInfo, $paymentInfo; $errorAr = array(); # An array of errors to pass to the form (if needed) $testAr = array('firstName' => 'First Name', 'lastName' => 'Last Name', 'street' => 'Street', 'city' => 'City', 'state' => 'State/Provice', 'zip' => 'Zip/Postal Code', 'country' => 'Country'); # foreach ($testAr as $fieldName => $niceName) { # if ($memberInfo->$fieldName == '') { # $errorAr[$fieldName] = "Missing a value for the $niceName field."; # } # } # Check to see if they're trying to slip in a weirdo payment type, or if their browser let them not select anything. if ( ($paymentInfo->payTypeID != 2) && ($paymentInfo->payTypeID != 3) && ($paymentInfo->payTypeID != 5) ) { $errorAr['paytype'] = "Missing a value for the Payment Type."; } # Create a memberInfo to check with the DB to verify that someone already has this username, and is close to their membership expiration $testMemberInfo = new MemberInfo(); $testMemberInfo->select_by_username($memberInfo->username); if ($testMemberInfo->memberID > 0) { # Then they're renewing a valid username. $now = time(); $threeMonthsFromNow = $now + (86400 * 90); #if ($testMemberInfo->membershipExpires > $threeMonthsFromNow) { # # then they're trying to renew too early # $expires = strftime("%B %d, %Y", $memberInfo->membershipExpires); # echo "Sorry, $memberInfo->username, you're trying to renew too early! Your membership doesn't expire until $expires. Please check back in a few months before then. Thanks!

\n"; # spit_footer(); # exit(); #} } else { # couldn't find a valid member $errorAr['renewal_username'] = "Couldn't find an existing member with username $memberInfo->username! Please enter a valid member username."; error_log("renew.html::check_renew_attempt: couldn't find an existing member with username $memberInfo->username"); } if (count($errorAr) > 0) { # Then something was screwed up; spit out the form again. spit_signup_form("", "", "", $errorAr); return 0; } else { # Everything was successful. return 1; } } function email_scott($subject = '', $msg = '') { # send Scott the "member signed up with this info" email. Or a different sort of email, if a different msg & subject are specified global $chargeAmount, $memberInfo, $paymentInfo; if ($msg == '') { $msg = $paymentInfo->email_get_text(); $msg .= "\n\n"; $msg .= $memberInfo->email_get_text(); } if ($subject == '') { $pay = "Credit"; if ($paymentInfo->payTypeID == 2) { $pay = "PayPal"; } else if ($paymentInfo->payTypeID == 3) { $pay = "Check"; } $subject = "RENEWAL ($$chargeAmount w/$pay)"; } $mailheaders = "From: $email\n"; mail("saab@saabnet.com", $subject, $msg, $mailheaders); } function insert_paymentInfo_or_bail() { global $paymentInfo; # Make this a global, so that when it adjusts its own values, other routines can see the results # Insert the paymentInfo if we've gotten this far. Bail out if we encounter an error! $result = $paymentInfo->insertDB(); if ($result != 1) { # Crap, something happened with the DB. Fire off an email; we've still got the hardcopy. $today = date("D M j G:i:s T Y"); $pay = varLog($paymentInfo); mail("saab@saabnet.com", "Error with Payment DB", "$today: Error with Saabnet.com payment DB\n$pay"); exit(); } } function spit_paypal_jump($hasAccount) { # They successfully signed up with TSN, now they need to pay at PayPal. #global $firstname, $lastname, $address, $city, $state, $zip, $email, $chargeAmount, $paymentInfo; global $chargeAmount, $memberInfo, $paymentInfo; echo "Membership renewal request received at Saabnet.com. To complete the process, click on the PayPal - Click here to pay button.\n"; if ($hasAccount == 1) { # test for the "already have an account" case echo "At PayPal's site, you can use a credit card, check, or your PayPal account.

"; } else { # RSVPEDIT: text for the new "don't have a PayPal account" case echo "
PayPal is the Secure Merchant Account Provider (Credit Card Processing Agent) for The Saab Network.\n"; echo "You do not need to have a PayPal account (now or ever) in order to successfully complete this transaction.

\n"; echo "On the next page after clicking the PayPal - Click Here to Pay button at the bottom of this page, simply click on the Don't have a PayPal account link that's shown in the example below (not that one - the one on the next page (AFTER you click the yellow button on the bottom of this page) :-)):

\n"; echo "

\n"; echo "Again, you will not be required to register any accounts with PayPal.

\n"; } echo "Once The Saab Network is automatically notified of your secure transaction, your membership will be processed and renewed.
Please click the button below to pay.

\n"; $itemName = "Saab Network One-Year Membership Renewal"; # echo "

paymentID\"> firstName\"> lastName\"> street\"> city\"> state\"> zip\"> emailContact\"> "; echo "
\n"; } function spit_signup_form($repassword, $reemail, $idchoice, $errorAr = array()) { # Spit out the signup form # $repassword: the password verification field # $reemail: the email verification field # $errorAr: a hash of field-to-error messages to be shown to the user global $memberInfo, $paymentInfo, $isSponsor, $sponsor; $b = array(); # Store our field redness state here. # If there were any errors passed in, show them now. if (count($errorAr) > 0) { echo "The form could not be processed; please take a look at the following errors and re-submit:
\n"; echo "\n"; } # So that we can default to what their earlier exp month/year were $sm = array(); $sy = array(); $pm = array(); $sm[$paymentInfo->ccExpMonth] = ' SELECTED'; $sy[$paymentInfo->ccExpYear] = ' SELECTED'; if ( ($paymentInfo->payTypeID != 2) && ($paymentInfo->payTypeID != 3) && ($paymentInfo->payTypeID != 5) ) { $paymentInfo->payTypeID = 5; } $pm[$paymentInfo->payTypeID] = ' CHECKED'; if ( ($memberInfo->memberTerm < 1) || ($memberInfo->memberTerm > 2) ) { $memberInfo->memberTerm = 2; } $mem[$memberInfo->memberTerm] = ' CHECKED'; if ( ($memberInfo->shirtSize != 'S') && ($memberInfo->shirtSize != 'M') && ($memberInfo->shirtSize != 'L') && ($memberInfo->shirtSize != 'XL') && ($memberInfo->shirtSize != 'XXL') && ($memberInfo->shirtSize != 'XXXL')) { $memberInfo->shirtSize = 'XL'; } $ss[$memberInfo->shirtSize] = ' SELECTED'; if ($memberInfo->country == '') { $memberInfo->country = 'USA'; } $sc[$memberInfo->country] = ' SELECTED'; echo "
\n"; echo "\n"; # Lace the original source into the form $from = $_GET['from']; if ($from == '') { $from = $_POST['from']; } echo "\n"; if ($sponsor != '') { echo "\n"; } echo "Thanks so much for supporting the site as a Full Site Member. I could not keep the site online if not for the members.

\n"; echo "\n"; if ($memberInfo->username != '') { echo " \n"; } else { echo " \n"; } echo "\n"; #echo " \n"; #echo " \n"; echo " \n"; #echo "\n"; #echo " \n"; #echo " \n"; #echo " \n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; # assemble a string to use for shipping. Always use the country. There is NO shipping charge - pin is now free for 2nd year renewal! $countryText = ""; $shippingCostText = ""; if ($memberInfo->country == 'USA') { $countryText = "United States"; if ($memberInfo->memberTerm == 1) { $shippingCostText = " (+$0.00 shipping and you are getting a gift in the mail for renewing for a 2nd year!)"; } } echo " "; echo "\n"; echo "\n"; if ($isSponsor != 1) { # normal term-selection radio buttons and shirt-size popup echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo "
Renewing member:username\">$memberInfo->username
" . $memberInfo->get_member_blurb("", "") . "
You Are Not Logged In Yet - Please Log In to Proceed! " . $memberInfo->get_member_blurb("", "") . "

" . $b[firstName]. "First Name:" .$b["e_firstName"]. " firstName\" size=32 maxlength=32>
" . $b[lastName]. "Last Name:" .$b["e_lastName"]. " lastName\" size=32 maxlength=32>
Name: $memberInfo->firstName $memberInfo->lastName
" . $b[street]. "Street Address:" .$b["e_street"]. " street\" size=60 maxlength=60>
" . $b[city]. "City:" .$b["e_city"]. " city\" size=60 maxlength=60>
" . $b[state]. "State/Province:" .$b["e_state"]. " state\" size=2 maxlength=2>
" . $b[zip]. "Zip/Postal Code:" .$b["e_zip"]. " zip\" size=10 maxlength=10>
" . $b[street]. "Street Address:" .$b["e_street"]. " $memberInfo->street
" . $b[city]. "City:" .$b["e_city"]. " $memberInfo->city
" . $b[state]. "State/Province:" .$b["e_state"]. " $memberInfo->state
" . $b[zip]. "Zip/Postal Code:" .$b["e_zip"]. " $memberInfo->zip
" . $b[country]. "Country:" .$b["e_country"]. " $countryText$shippingCostText"; echo "
Please edit your contact info if the above information is incorrect.

" . $b[membership]. "Purchasing:" .$b["e_membership"]. " One-year Membership Renewal - $20 (Includes an additional 100MB of Photo Gallery space.)
\n"; echo "


" . $b[paytype]. "Payment Method: " .$b["e_paytype"]. "PayPal is The Saab Network's Secure Merchant Account Provider (Credit Card Processing Agent).
This does not require that you have a PayPal account now or in the future.

\n"; echo "I have a PayPal account, and will pay with my PayPal account or a credit card.
\n"; echo " \"\"\"\"\"

\n"; echo "I do not have a PayPal account, but I would like to use a credit card.
\"\"\"\"\"

\n"; echo "I'll mail in a check or money order.
Address provided on next page. (membership not enabled until payment is received)


\n"; echo "

\n"; #echo "

Note: Each Saabnet.com membership is owned by a single person. Never share your password. Multiple users logged into a single account may result in your account not working properly\n"; #echo "until your password is changed. Members must still adhere to the same site usage policies as all users. Cookies must be enabled in order for your membership features to work.

\n"; } function spit_thanks_check() { # Spit out the paid-by-check info, with price global $chargeAmount; $chargeStr = sprintf("%01.2f", $chargeAmount); # force two decimal places, so 22.5 becomes 22.50 echo "

By renewing with The Saab Network, you're helping to support this site's existence - THANK YOU!

Once your payment has been processed, you will receive a renewal confirmation email.

Please send your check, cash, or money order for \$$chargeStr to:

The Saab Network
PO Box 2507
Menlo Park, CA 94026-2507

Please add $8 for checks drawn in a foreign currency (bank fee).

Membership will renew when payment is received.

Return to The Saab Network
"; echo "Return to your original Saabnet.com page

\n"; } function spit_thanks_credit() { # Spit out the credit card "thanks for buying" form echo "

By renewing with The Saab Network, you're helping to support this site's existence - THANK YOU!

Once your payment has been processed, you will receive a renewal confirmation email.

Return to The Saab Network
"; echo "Return to your original Saabnet.com page

\n"; } # # Non-functions below here. # $hostname = "127.0.0.1"; $password = "goApache"; $user = "apache"; # Init POST vars, passed in by the "make a new post" form. $f = $_POST['f']; # Membership-related variables $isMember = 0; $memberInfo = new MemberInfo(); # Object to hold the member information $paymentInfo = new PaymentInfo(); # Object to hold the payment information $linkNum = mysql_pconnect($hostname,$user,$password); if ($linkNum == FALSE) { error_log("MYSQL: signup.html: Member renewal couldn't mysql_pconnect to MySQL: " . mysql_error()); server_down(); exit; } $linkNum2 = mysql_select_db("BBDataD"); if ($linkNum2 == FALSE) { error_log("MYSQL: signup.html: Member renewal couldn't mysql_select_db('BBDataD') in MySQL: " . mysql_error()); server_down(); exit; } # check to see if they claim to be a sponsor. $isSponsor = 0; $sponsor = $_GET['sponsor']; if ($sponsor == '') { $sponsor = $_POST['sponsor']; } if ($sponsor != '') { # they say they're a sponsor, check it against the list foreach ($sponsorAr as $testSponsor) { if (strcmp($testSponsor, $sponsor) == 0) { $isSponsor = 1; # the strings matched, set our flag and continue on break; } } } spit_header("Membership Renewal"); # check to see if they're already logged in. $isLoggedIn = $memberInfo->is_logged_in(); if ($f == 'renew') { # Then they've submitted a signup form. Process it. #$memberInfo->username = $_POST['renewal_username']; $paymentInfo->billStreet = $memberInfo->street; $paymentInfo->billCity = $memberInfo->city; $paymentInfo->billState = $memberInfo->state; $paymentInfo->billZip = $memberInfo->zip; $paymentInfo->billCountry = $memberInfo->country; $paymentInfo->payTypeID = $_POST['paytype']; if (check_renew_attempt() == 1) { # They successfully signed up # # amount calculations # $chargeAmount = 20; $country = $memberInfo->country; # only need to add shipping if their current term is 1 year # AS OF 2/3/19 THERE IS NO CHARGE FOR POSTAGE FOR USA PINS - I cannot afford to send internationally ;-( #if ($memberInfo->memberTerm == 1) { # if ($country == 'USA') { # $chargeAmount += 2; # } #} $paymentInfo->memberID = $memberInfo->memberID; $paymentInfo->amount = $chargeAmount * 100; # 20 dollars $paymentInfo->custName = $memberInfo->firstName . ' ' . $memberInfo->lastName; # Name for CC stuff $paymentInfo->needsActionID = 41; if (($paymentInfo->payTypeID == 2) || ($paymentInfo->payTypeID == 5)) { # set a flag to indicate whether they've got an account; let spit_paypal_jump() modify its text accordingly $hasAccount = 0; if ($paymentInfo->payTypeID == 2) { $hasAccount = 1; } $paymentInfo->payTypeID = 2; # PayPal type, force it, because they might have selected the no-paypal-account version $paymentInfo->payStatusID = 21; # Waiting for response from PayPal insert_paymentInfo_or_bail(); spit_paypal_jump($hasAccount); email_scott(); } else { # default to Check/MO type. #$paymentInfo->payTypeID = 3; # Check type $paymentInfo->payStatusID = 31; # Waiting for check insert_paymentInfo_or_bail(); spit_thanks_check(); email_scott(); } if (strcmp($country, 'OTH') == 0) { $msg = "Member ID $memberInfo->memberID renewed with a country of \"$country\".\n"; email_scott("Country: Other: Member ID $memberInfo->memberID", $msg); } } else { # Something happened; the form, with errors, has been spit out by check_signup_attempt(). Not much to do here. } } else { # They're doing something other than signing up. Give them the form. if ($isLoggedIn) { # This is the within three months of your expiration date provision. Might not be needed. #$now = time(); #$threeMonthsFromNow = $now + (86400 * 90); #if ($memberInfo->membershipExpires > $threeMonthsFromNow) { # $expires = strftime("%B %d, %Y", $memberInfo->membershipExpires); # # then they're trying to renew too early # echo "Sorry, $memberInfo->username, you're trying to renew too early! Your membership doesn't expire until $expires. Please check back a couple of months before then. Thanks!

\n"; # spit_footer(); # exit(); #} if ($memberInfo->memberTypeID == 2) { echo "$memberInfo->username, you're a sponsor and do not need to renew!

\n"; spit_footer(); exit(); } } spit_signup_form('', '', ''); # No repassword or reemail or idchoice to seed. } spit_footer(); ?>