=2){ return ("FAILED"); } else { return ("PASSED"); } } function clean_domain($domain){ $domain = strtolower($domain); $domain = str_replace("www.", "", $domain); $domain = str_replace("http://", "", $domain); $cut_at = strpos($domain, "/"); if($cut_at) $domain = substr($domain, 0, $cut_at); return $domain; } function test_ip($ip){ if($ip == "66.98.190.65"){ return 1; } else { return 0; } } function test_cctld($domain){ $domain = strrev($domain); $dotpos = strpos($domain,"."); if ($dotpos == 2) return 1; else return 0; } function test_subdomain($domain){ $dotcount = substr_count($domain, "."); if ($dotcount >= 2) return 1; else return 0; } function test_subdomain_cctld($domain){ $dotcount = substr_count($domain, "."); if ($dotcount >= 3) return 1; else return 0; } function get_main_domain($domain){ $domain_parts = explode(".",$domain); $domain_extention = end($domain_parts); $domain_name = prev($domain_parts); $domain = $domain_name.".".$domain_extention; return $domain; } function get_main_domain_cctld($domain){ $domain_parts = explode(".",$domain); $domain_extention2 = end($domain_parts); $domain_extention1 = prev($domain_parts); $domain_name = prev($domain_parts); $domain = $domain_name.".".$domain_extention1.".".$domain_extention2; return $domain; } function get_main_email_account($domain,$whmuser,$whmpass,$whmdomain){ $account_file = file("http://$whmuser:$whmpass@$whmdomain:2086/scripts2/listaccts?viewall=1"); $file_line_count = 0; while($account_file[$file_line_count]){ if(strstr($account_file[$file_line_count], ">".$domain."<")){ $domain_exist = 1; } if($domain_exist){ if(strstr($account_file[$file_line_count], "@")){ $account_file[$file_line_count] = str_replace("".$domain)){ $domain_exist = 1; } if($domain_exist){ $main_domain_start = strpos($account_file[$file_line_count], "."); $main_domain_end = strpos($account_file[$file_line_count], ""); $main_domain = substr($account_file[$file_line_count], $main_domain_start+1, $main_domain_end-$main_domain_start-1); return $main_domain; break; } $file_line_count++; } } function check_addondomain_cctld($domain,$whmuser,$whmpass,$whmdomain){ $account_file = file("http://$whmuser:$whmpass@$whmdomain:2086/scripts2/listsubdomains?viewall=1"); $file_line_count = 0; while($account_file[$file_line_count]){ $account_file[$file_line_count] = trim($account_file[$file_line_count]); if(strstr($account_file[$file_line_count], "".$domain)){ $domain_exist = 1; } if($domain_exist){ $main_domain_start = strpos($account_file[$file_line_count], "."); $main_domain_end = strpos($account_file[$file_line_count], ""); $main_domain = substr($account_file[$file_line_count], $main_domain_start+1, $main_domain_end-$main_domain_start-1); return $main_domain; break; } $file_line_count++; } } function send_client_message($email, $message, $attachment){ // echo "Email Form Error: We are undergoing maintenance to improve our automated spam filtering. Please send again after a few minutes. Click on the button to go back to the website.

"; $fileatt = $attachment; // Path to the file $fileatt_type = "application/octet-stream"; // File Type $start= strrpos($attachment, '/') == -1 ? strrpos($attachment, '//') : strrpos($attachment, '/')+1; $fileatt_name = substr($attachment, $start, strlen($attachment)); // Filename that will be used for the file as the attachment // echo "fileatt = $fileatt
"; // echo "start = $start
"; // echo "fileatt_name = $fileatt_name
"; $to = $email; $subject = 'Secure Email Contact Form'; $headers = 'From: mailform@yourdomainserver.com'; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nReply-To: do_not_reply_here_replace_with_entered_email@yourdomainserver.com\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . "
" . 
	$message . "
" . "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; $sentMail = mail($to, $subject, $email_message, $headers); echo "Diagnostic Test: sentMail = $sentMail
"; //echo "test mail($to, $subject, $email_message, $headers)"; echo "
to = $to
subject = $subject
email_message = $email_message
headers = $headers
"; $subject = "[BackUp]".$subject; $email_message = "========================================\n\nYDS Backup Copy\n\n========================================\n\n".$email_message; mail("support@ydswebsolution.com", $subject, $email_message, $headers); } function mail_instructions($email_to, $domain){ $formCode = md5(uniqid(rand(), true)); $query = "INSERT INTO formCodes (formCode, accountEmail) VALUES ('".$formCode."', '".$email_to."')"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $message = " You have requested to setup a Secure Email Contact Form. Your unique email form code is: $formCode To setup your Secure Email Contact Form, just follow the instructions below: 1. In the section of your contact form page, please place this line: 2. Use the following code to start creating your Secure Email Contact Form. Copy the code as it is and do not modify.
...
If you have email attachments, change the first line above to:
Please note that the input field named \"fromEmail\" will NOT really appear on the page and the value MUST always be kept blank. The created CSS file in step 1 will be hiding this field and will not be displayed. If you need the email address of the sender, create another input field to get the senders email address. You may change the value of \"returnPage\" to any valid URL and should load a PHP file. This is the page people will see after filling up the form. If you wish to display any of the values entered in the form. The variables are passed back as POST valiable. 4. Continue the rest of your form with your own input fields and names. Attached files are not supported at the moment. You may name your input fields anything except for the following: formCode returnPage fromEmail You cannot have any element with the ID idFromEmail And you cannot have any element with the Class name clsFromEmail This is to avoid any conflicts within the contact form. 5. Set the recipient email address of the Secure Email Contact Form here: http://mailform.yourdomainserver.com/?setmail=$formCode If you do not set the email address for this form code in 72 hours, this form code account will be deleted and you will need to create a new one by visiting: http://mailform.yourdomainserver.com Done! Below is the code for a sample for you can use and modify: ============================================================ Untitled Name:
Address:
Phone:
Email:
Subject:
Message:


============================================================ Feel free to use whatever method you wish for applying styles to your forms. You may add form names, to help in Javascript form validation and element IDs for CSS styled appearance. Feel free to use other elements such as radio buttons, checkboxes and select menus. "; $to = $email_to; // $to = "support@ph.ydswebsolution.com"; $subject = 'Secure Email Contact Form Setup'; $headers = 'From: mailformSetup@yourdomainserver.com' . "\r\n" . 'Reply-To: do_not_reply@yourdomainserver.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // $message = "THIS IS A TEST\n\n".$message; // $subject = "THIS IS A TEST\n\n".$subject; mail($to, $subject, $message, $headers); $subject = "A Secure Email Contact Form was Requested."; $message = "============================================================\n\nThe following Search Email Contact Form was Sent\n\nNo action required from us.\n\n============================================================\n\n".$message; mail("support@ph.ydswebsolution.com", $subject, $message, $headers); } /**************** Setup Request - Initializing and Functions End ****************/ ?> YourDomainServer.com Secure Email Form

. . : : www.yourdomainserver.com : : . .

Secure Email Contact Form

Domain/Subdomain Name:

The domain name entered was checked on our servers. If the domain exists, the main email account holder should already receive an email on how to setup the Secure Email Contact Form. Please check your email now.

Important Note: This works with subdomains and add-on domains. But this will not work with parked domains. If you receive no email and is positive that your domain is hosted on our server, make sure it is not a parked domain name. If ever you wish to have a secure email contact form for this, please use the main domain name of the hosting account and not the parked domain name.

If you no longer use the email address you used to sign up for this account, please login to your control panel and change your hosting account's main email address and visit this page again.

60) break; } if ($dig_test[$dig_count] != ";; ANSWER SECTION:") { $domain_exist = 0; } else { $ip_array = explode(" ", $dig_test[$dig_count+1]); $domain_exist = test_ip(end($ip_array)); } if($domain_exist) { $check_cctld = test_cctld($_POST[domain_name]); if(!$check_cctld){ $check_subdomain = test_subdomain($_POST[domain_name]); if($check_subdomain){ $_POST[domain_name] = get_main_domain($_POST[domain_name]); $account_email = get_main_email_account($_POST[domain_name], $user, $pass, $resellerdomain); mail_instructions($account_email, $_POST[domain_name]); } else { /* if($check_subdomain){ */ $check_addondomain = check_addondomain($_POST[domain_name], $user, $pass, $resellerdomain); if($check_addondomain){ $account_email = get_main_email_account($check_addondomain, $user, $pass, $resellerdomain); mail_instructions($account_email, $check_addondomain); } else { $account_email = get_main_email_account($_POST[domain_name], $user, $pass, $resellerdomain); mail_instructions($account_email, $_POST[domain_name]); } } /* if($check_subdomain){ */ } else { /* if(!$check_cctld){ */ $check_subdomain = test_subdomain_cctld($_POST[domain_name]); if($check_subdomain){ $_POST[domain_name] = get_main_domain_cctld($_POST[domain_name]); } $check_addondomain = check_addondomain_cctld($_POST[domain_name], $user, $pass, $resellerdomain); if($check_addondomain){ $account_email = get_main_email_account($check_addondomain, $user, $pass, $resellerdomain); mail_instructions($account_email, $check_addondomain); } $account_email = get_main_email_account($_POST[domain_name], $user, $pass, $resellerdomain); mail_instructions($account_email, $_POST[domain_name]); } /* if(!$check_cctld){ */ } /* if($domain_exist){ */ } /* if($_POST[domain_name]){ */ } /**************** Setup Request - Main Start ****************/ /**************** Blank Vars - Start ****************/ if(!$_GET[setmail] and !$_POST[domain_name] and !$_POST[setup_email] and !$_POST[returnPage]){ ?>

To setup, please enter your domain name in the space provided below.

Note: The script will work also on add-on domains, but not with parked domains. Please use the main domain name of the hosting account and not the parked domains.


All forms with Form Code
will forward to the email address below:



ERROR: Invalid or Expired Form Code.

"; } } /**************** Setup Config - Main End ****************/ /**************** Setup Email - Start ****************/ if($_POST[setup_email]){ if(!$_POST[contact_business]){ $pos = strpos($_SERVER[HTTP_REFERER], "ttp://mailform.yourdomainserver.com"); if($pos == 1){ $query = "UPDATE formCodes SET recipientEmail = '$_POST[setup_email]' WHERE formCode = '$_POST[formCode]'"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); } } ?>

Your Secure Email Contact form with form code
is now set to deliver emails to .

60) break; } if ($dig_test[$dig_count] != ";; ANSWER SECTION:") { $domain_exist = 0; } else { $ip_array = explode(" ", $dig_test[$dig_count+1]); $domain_exist = test_ip(end($ip_array)); } if($domain_exist and !$_POST[fromEmail]){ $form_code_exist = test_form_code($_POST[formCode]); if($form_code_exist){ $form_details = "FORM DETAILS:\n----------------------------------------\n"; $other_details = "OTHER DETAILS:\n----------------------------------------\n"; foreach ($HTTP_POST_VARS as $key => $values) { if($key != "fromEmail"){ if($key == "formCode" or $key=="returnPage") $other_details .= "$key:\n$values\n\n"; else $form_details .= "$key:\n$values\n\n"; } /* if($key != "fromEmail"){ */ } /* foreach ($HTTP_POST_VARS as $key => $values) { */ $other_details .= "fromPage:\n$_SERVER[HTTP_REFERER]\n\n"; if(!$_SERVER[REMOTE_ADDR]) $_SERVER[REMOTE_ADDR] = "-- unretrievable --"; $other_details .= "senderIP:\n$_SERVER[REMOTE_ADDR]\n\n"; if(!$_SERVER[REMOTE_HOST]) $_SERVER[REMOTE_HOST] = "-- unretrievable --"; $other_details .= "senderHost:\n$_SERVER[REMOTE_HOST]\n\n"; $other_details .= "userAgent:\n$_SERVER[HTTP_USER_AGENT]\n\n"; $completeMessage = $form_details."\n\n\n".$other_details; $completeMessage .= "\n\n\n----------------------------------------\nYourDomainServer.com\nSecure Email Contact Form v.1\nIf you believe there are some errors with contact form,\nplease contact us here http://www.yourdomainserver.com/"; $test_code = "FAILED"; $test_code = clean_email_code($completeMessage); $uploaddir = '/home/yourdoma/public_html/mailform/uploadtemp/'; @mkdir($uploaddir."$_POST[formCode]"); $uploaddir .= $_POST[formCode]."/"; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); if($test_code == "PASSED"){ send_client_message($form_code_exist, $completeMessage, $uploadfile); } /* if($test_code == "PASSED"){ */ } /* if($form_code_exist){ */ } /* if($domain_exist){ */ ?>
$values) { if($key != "fromEmail"){ ?> $values) { */ ?> */ ?>