Guest User

Untitled

a guest
Jun 12th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.74 KB | None | 0 0
  1. <?php
  2. if($_POST)
  3. {
  4.     if(!function_exists('pt_check_captch_cond'))
  5.     {
  6.         if(!pt_check_captch_cond())
  7.         {
  8.             $url = get_permalink($post->ID);
  9.             if(strstr($url,'?'))
  10.             {
  11.               $url = $url."&emsg=captch";
  12.             }else
  13.             {
  14.                 $url = $url."?emsg=captch";
  15.             }
  16.             wp_redirect($url);
  17.             exit;
  18.         }
  19.     }
  20.     $yourname = $_POST['yourname'];
  21.     $youremail = $_POST['youremail'];
  22.     $frnd_subject = $_POST['frnd_subject'];
  23.     $frnd_comments = $_POST['frnd_comments'];
  24.     $pid = $_POST['pid'];
  25.     $to_email = $_POST['to_email'];
  26.     $to_name = $_POST['to_name'];
  27.     if($_REQUEST['pid'])
  28.     {
  29.         $productinfosql = "select ID,post_title from $wpdb->posts where ID =".$_REQUEST['pid'];
  30.         $productinfo = $wpdb->get_results($productinfosql);
  31.         foreach($productinfo as $productinfoObj)
  32.         {
  33.             $post_title = $productinfoObj->post_title;
  34.         }
  35.     }
  36.    
  37.     ///////Inquiry EMAIL START//////
  38.     global $General;
  39.     global $upload_folder_path;
  40.     $store_name = get_option('blogname');
  41.     $clientdestinationfile =   TEMPLATEPATH."/library/notification/send_to_friend.txt";
  42.     $message1 =  implode('',file($clientdestinationfile));
  43.     $filecontent_arr1 = explode('[SUBJECT-STR]',$message1);
  44.     $filecontent_arr2 = explode('[SUBJECT-END]',$filecontent_arr1[1]);
  45.     $subject = $filecontent_arr2[0];
  46.     if($subject == '')
  47.     {
  48.         $subject = $frnd_subject;
  49.     }
  50.     $client_message = $filecontent_arr2[1];
  51.     $curpermalink = get_permalink();
  52.     $post_url_link = '<a href="'.$curpermalink.'">'.$post_title.'</a>';
  53.     /////////////customer email//////////////
  54.     $yourname_link = $yourname.'<br>Send from - <b><a href="'.get_option('siteurl').'">'.get_option('blogname').'</a></b>.';
  55.     $search_array = array('[#$to_name#]','[#$post_title#]','[#$frnd_subject#]','[#$frnd_comments#]','[#$your_name#]','[#$post_url_link#]');
  56.     $replace_array = array($to_name,$post_url_link,$frnd_subject,nl2br($frnd_comments),$yourname_link,$post_url_link);
  57.     $client_message = str_replace($search_array,$replace_array,$client_message);
  58.     /*echo "From : $youremail  Name : $yourname <br>";
  59.     echo "To : $to_email  Name : $to_name <br>";
  60.     echo "Subject $subject <br>";
  61.     echo "$client_message";
  62.     exit;*/
  63.     sendEmail($youremail,$yourname,$to_email,$to_name,$subject,$client_message,$extra='');///To clidne email
  64.     //////Inquiry EMAIL END////////
  65.     $headers  = 'MIME-Version: 1.0' . "\r\n";
  66.     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  67.     $headers .= 'From: Form inquiry <[email protected]>' . "\r\n";
  68.     mail($to_email, $subject, $client_message, $headers);
  69.     $my_email = '[email protected]';
  70.     mail($my_email, $subject, $client_message, $headers);
  71.     $url = get_permalink($post->ID);
  72.     if(strstr($url,'?'))
  73.       {
  74.           $url = $url."&sendtofrnd=success";
  75.       }else
  76.       {
  77.             $url = $url."?sendtofrnd=success";           
  78.       }
  79.     wp_redirect($url);
  80. }
  81. ?>
Advertisement
Add Comment
Please, Sign In to add comment