Advertisement
Guest User

Untitled

a guest
Jan 14th, 2017
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. <?php
  2.  
  3. $from = "Emerick <emerick@live.be>";
  4. $to = "Emerick <emerick@live.be>";
  5. $subject = "Mail from my website";
  6.  
  7. $host = "smtp-mail.outlook.com";
  8. $username = "emerick@live.be";
  9. $password = "my password";
  10.  
  11. $headers = array ('From' => $from,
  12. 'To' => $to,
  13. 'Subject' => $subject);
  14. $smtp = Mail::factory('smtp',
  15. array ('host' => $host,
  16. 'auth' => true,
  17. 'username' => $username,
  18. 'password' => $password));
  19.  
  20. $mail = $smtp->send($to, $headers, $body);
  21.  
  22. if (PEAR::isError($mail)) {
  23. echo("<p>" . $mail->getMessage() . "</p>");
  24. } else {
  25. echo("<p>Message successfully sent!</p>");
  26. }
  27.  
  28.  
  29.  
  30.  
  31. if(isset($_POST['email'])) {
  32.  
  33.  
  34.  
  35.  
  36.  
  37. function died($error) {
  38.  
  39. // your error code can go here
  40.  
  41. echo "Iets liep fout bij het versturen. ";
  42.  
  43. echo "De fout(en) staan hier onder:<br /><br />";
  44.  
  45. echo $error."<br /><br />";
  46.  
  47. echo "Ga terug om dit op te lossen.<br /><br />";
  48.  
  49. die();
  50.  
  51. }
  52.  
  53.  
  54.  
  55. // validation expected data exists
  56.  
  57. if(!isset($_POST['name']) ||
  58.  
  59. !isset($_POST['email']) ||
  60.  
  61. !isset($_POST['comment'])) {
  62.  
  63. died('We are sorry, but there appears to be a problem with the form you submitted.');
  64.  
  65. }
  66.  
  67.  
  68.  
  69. $name = $_POST['name']; // required
  70.  
  71. $email = $_POST['email']; // required
  72.  
  73. $comment = $_POST['comment']; // required
  74.  
  75.  
  76.  
  77. $error_message = "";
  78.  
  79. $string_exp = "/^[A-Za-z .'-]+$/";
  80.  
  81. if(!preg_match($string_exp,$name)) {
  82.  
  83. $error_message .= 'De naam dat u ingegeven hebt is niet correct.<br />';
  84.  
  85. }
  86.  
  87. if(strlen($comment) < 2) {
  88.  
  89. $error_message .= 'Het bericht dat u proberen in te geven hebt is niet correct.<br />';
  90.  
  91. }
  92.  
  93. if(strlen($error_message) > 0) {
  94.  
  95. died($error_message);
  96.  
  97. }
  98.  
  99. $email_message = "Details:nn";
  100.  
  101.  
  102.  
  103. function clean_string($string) {
  104.  
  105. $bad = array("content-type","bcc:","to:","cc:","href");
  106.  
  107. return str_replace($bad,"",$string);
  108.  
  109. }
  110.  
  111.  
  112.  
  113. $email_message .= "Naam: ".clean_string($name)."n";
  114.  
  115. $email_message .= "E-mail: ".clean_string($email)."n";
  116.  
  117. $email_message .= "Bericht: ".clean_string($comment)."n";
  118.  
  119.  
  120.  
  121.  
  122.  
  123. // create email headers
  124.  
  125. $headers = 'From: '.$email."rn".
  126.  
  127. 'Reply-To: '.$email."rn" .
  128.  
  129. 'X-Mailer: PHP/' . phpversion();
  130.  
  131. @mail($email_to, $email_subject, $email_message, $headers);
  132.  
  133. ?>
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141. <!DOCTYPE html>
  142. <html>
  143. <title>AsmusToday</title>
  144. <meta name="viewport" content="width=device-width, initial-scale=1">
  145. <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
  146. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
  147. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
  148. <link rel="icon" href="logo.png">
  149. <style>
  150. body,h1,h2,h3,h4,h5,h6 {font-family: "Lato", sans-serif;}
  151. body, html {
  152. height: 100%;
  153. color: #777;
  154. line-height: 1.8;
  155. }
  156.  
  157. /* Create a Parallax Effect */
  158. .bgimg-1 {
  159. { background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; }
  160.  
  161. /* First image (Logo. Full height) */
  162. .bgimg-1 { background-image: url('skyline.jpeg'); min-height: 100%; }
  163.  
  164. .w3-wide {letter-spacing: 10px;}
  165. .w3-hover-opacity {cursor: pointer;}
  166.  
  167. /* Turn off parallax scrolling for tablets and mobiles */
  168.  
  169. @media only screen and (max-width: 1024px) {
  170. .bgimg-1 {
  171. background-attachment: scroll;
  172. }
  173. }
  174.  
  175.  
  176. /* Ads style on the text of the page */
  177. .square {
  178. background-color:#000!important;
  179. padding: 12px;
  180. margin-left: 150px;
  181. margin-right: 150px;
  182.  
  183. }
  184.  
  185. </style>
  186.  
  187. <body>
  188.  
  189. <!-- Refreshes the page after 5 sec. to the homepage -->
  190. <meta http-equiv="refresh" content="5;URL= http://asmus.ga">
  191.  
  192. <!-- Parallax Image with Text -->
  193. <div class="bgimg-1 w3-opacity w3-display-container">
  194. <div class="w3-display-middle" style="white-space:nowrap;">
  195. <span class="w3-center w3-padding-xlarge w3-black w3-xlarge w3-wide w3-animate-opacity" style="border-radius: 5px;">Bedankt!</span>
  196. </div>
  197. </div>
  198.  
  199. </body>
  200. </html>
  201.  
  202.  
  203. <?php
  204.  
  205. }
  206.  
  207. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement