Advertisement
Guest User

process.php

a guest
Aug 28th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. require('../../../wp-blog-header.php');
  4. get_header();
  5.  
  6.     if ( isset( $_POST['afs-submitted'] ) ) {
  7.  
  8.         global $wpdb;
  9.  
  10.         $row = $wpdb->get_row("SELECT * FROM wp_asf_layout");
  11.  
  12.         $userName    = sanitize_text_field( $_POST["asf-name"] );
  13.         $userEmail   = sanitize_email( $_POST["asf-email"] );
  14.  
  15.         $subject = $row->subject;
  16.         $message = $row->message;
  17.         $attachments = array( $row->files );
  18.         $admin_email = $row->email_from;
  19.         $headers = "From: $row->name_from <$admin_email>" . "\r\n";
  20.  
  21.         $new_url = add_query_arg( 'success', 1, get_permalink() );
  22.         wp_redirect( $new_url, 303 );
  23.  
  24.         if ( wp_mail( $userEmail, $subject, $message, $headers, $attachments) ) {
  25.             echo '<div>';
  26.             echo '<p>Thanks for contacting</p>';
  27.             echo '</div>';
  28.         } else {
  29.             echo 'An unexpected error occurred';
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement