Form Membership RENEWAL'; $valid = false; if( isset( $_POST['ammp_renewal_captcha'] ) ) { $_POST['ammp_renewal_captcha'] = sanitize_text_field($_POST['ammp_renewal_captcha']) ; // Variable used to determine if submission is valid // Check if captcha text was entered if (empty($_POST['ammp_renewal_captcha'])) { $abortmessage = 'Captcha code is missing. Try again and '; $abortmessage .= 'provide the code.'; //wp_die($abortmessage); //exit; } else { // Check if captcha cookie is set if (isset($_COOKIE['Captcha'])) { list( $hash, $time ) = explode('.', $_COOKIE['Captcha']); // The code under the md5's first section needs to match // the code entered in easycaptcha.php if (md5('SDUVOIAUBDVOBODFBY' . $_REQUEST['ammp_renewal_captcha'] . $_SERVER['REMOTE_ADDR'] . $time) != $hash) { $abortmessage = ' Captcha code is wrong. '; $abortmessage .= 'try to get it right or reload '; $abortmessage .= 'to get a new captcha code.'; //wp_die($abortmessage); //exit; } elseif (( time() - 5 * 60) > $time) { $abortmessage = 'Captcha timed out. Please try again '; $abortmessage .= '(reload the page and submit again)'; //wp_die($abortmessage); //exit; } else { // Set flag to accept and store user input $valid = true; } } else { $abortmessage = 'No captcha cookie given. Make sure '; $abortmessage .= 'cookies are enabled.'; //wp_die($abortmessage); //exit; } } } // Check if registration form has been submitted if ( $valid && isset( $_POST['ammsname'] ) && isset( $_POST['emailaddress'] ) && isset( $_POST['paymentreceipt'] ) ) { check_admin_referer( 'wpamms_member_renewal' ); // Place all user submitted values in an array $member_data = array(); $member_data['id'] = ''; $member_data['name'] = sanitize_text_field($_POST['ammsname']) ; $member_data['emailaddress'] = sanitize_email($_POST['emailaddress']) ; if(is_email($member_data['emailaddress']) == false) $member_data['emailaddress'] = ''; else $member_data['emailaddress'] = is_email($member_data['emailaddress']); $member_data['paymentreceipt'] = sanitize_text_field($_POST['paymentreceipt']) ; $member_data['renewaldate'] = date("Y-m-d") ; $member_data['confirmed'] = '-1'; if ( ! function_exists( 'wp_handle_upload' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } if( file_exists($_FILES['filePaymentReceiptToUpload']['tmp_name']) && is_uploaded_file($_FILES['filePaymentReceiptToUpload']['tmp_name'])) { $uploadedfile = $_FILES['filePaymentReceiptToUpload']; $uploadedfile['name'] = date("Y-m-d-H-i-s") . '_' . $uploadedfile['name']; $upload_overrides = array( 'test_form' => false ); $movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); if ( $movefile && !isset( $movefile['error'] ) ) { //echo "File is valid, and was successfully uploaded.\n"; //var_dump( $movefile); $member_data['paymentreceipt'] = $movefile['url']; } else { wp_die('Upload PAYMENT RECEIPT Failed! if error persist, contact membership help desk for assistance! ' . sanitize_email($options['membership_admin_email']) ); } } // Get access to global database access class global $wpdb; // Call the wpdb insert method $wpdb->insert($wpdb->get_blog_prefix() . 'amms_renewal', $member_data ); if($wpdb->insert_id != false && $wpdb->insert_id >= 1) { $output .= '