Guest User

Untitled

a guest
Jun 10th, 2012
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 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. $post_url_link = '<a href="'.get_option('siteurl').'/?p='.$_REQUEST['pid'].'">'.$post_title.'</a>';
  52. /////////////customer email//////////////
  53. $yourname_link = $yourname.'<br>Send from - <b><a href="'.get_option('siteurl').'">'.get_option('blogname').'</a></b>.';
  54. $search_array = array('[#$to_name#]','[#$post_title#]','[#$frnd_subject#]','[#$frnd_comments#]','[#$your_name#]','[#$post_url_link#]');
  55. $replace_array = array($to_name,$post_url_link,$frnd_subject,nl2br($frnd_comments),$yourname_link,$post_url_link);
  56. $client_message = str_replace($search_array,$replace_array,$client_message);
  57. /*echo "From : $youremail Name : $yourname <br>";
  58. echo "To : $to_email Name : $to_name <br>";
  59. echo "Subject $subject <br>";
  60. echo "$client_message";
  61. exit;*/
  62. sendEmail($youremail,$yourname,$to_email,$to_name,$subject,$client_message,$extra='');///To clidne email
  63. //////Inquiry EMAIL END////////
  64. $headers = 'MIME-Version: 1.0' . "\r\n";
  65. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  66. $headers .= 'From: Form inquiry <[email protected]>' . "\r\n";
  67. mail($to, $subject, $client_message, $headers);
  68. $url = get_permalink($post->ID);
  69. if(strstr($url,'?'))
  70. {
  71. $url = $url."&sendtofrnd=success";
  72. }else
  73. {
  74. $url = $url."?sendtofrnd=success";
  75. }
  76. wp_redirect($url);
  77. }
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment