Yanko-PT

contact.php

Jan 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.06 KB | None | 0 0
  1. <div class="box header" style="display:block">
  2.     Comments &amp; Suggestions
  3. </div>
  4. <div class="box content"style="display:block">
  5.     <form id="comment_form" action="" method="post">
  6.         <span>Fill this form to give us a Comment or a Suggestion</span><br><br>
  7.         <label for="name"><b>Your Name:</b></label>
  8.         <input type="text" name="name" id="name" required>
  9.         <label for="email"><b>Your Email:</b></label>
  10.         <input type="text" name="email" id="email" required>
  11.         <label for="comment"><b>Your Comment / Suggestion:</b></label>
  12.         <textarea form="comment_form" id="comment" name="comment" placeholder="Write here!" required></textarea>
  13.         <input type="submit">
  14.     </form>
  15. </div>
  16. <?php
  17. if(isset($_POST['submit'])){
  18.  $name = $_POST['name'];
  19.  $email = $_POST['email'];
  20.  $message = $_POST['comment'];
  21.  $txt= "
  22.  \n--- " . date() . "---\n
  23.  Name: " . $name . "\n
  24.  Email: " . $email . "\n
  25.  Comment: \n" . $message . "\n
  26.  --- END OF COMMENT ---
  27.  ";
  28.  $file = fopen("comments.log", "a");
  29.  fwrite($txt, $file);
  30.  fclose($file);
  31.  $html = '<style>
  32. @import url("https://fonts.googleapis.com/css?family=Roboto");
  33. body{
  34.   background-color: #e2e2e2;
  35.   font-family: "Roboto", sans-serif;
  36. }
  37.  
  38. .box{
  39.   font-family: "Roboto", sans-serif;
  40.   border: 3px solid #6da5ff;
  41.   border-radius: 3px;
  42.   background: #fff;
  43.   padding: 1%;
  44.   box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  45.   width: 350px;
  46.   font-size: 15px;
  47.  
  48. }
  49.  
  50. .message{
  51.   border: 1px dashed grey;
  52.   border-radius: 1px;
  53.   width: 350px;
  54. }
  55. header{
  56.   font-size: 20px;
  57. }
  58. </style>
  59.  
  60. <div class="box">
  61. <header>New Comment on <strong>LocaTunes</strong></header>
  62. <b>Sender Name: </b>' . $name . '<br>
  63. <b>Sender Email: </b>' . $email . '<br>
  64. Message:
  65. <div class="message">
  66. <pre>' . $message . '</pre>
  67. <font size="3">Service provided by <a href="https://electronic.perina.net/">Perina Electronic</a>/Yanko</font>
  68. </div>
  69. </div>
  70. ';
  71. require 'class.phpmailer.php';
  72.  
  73. $mail = new PHPMailer;
  74.  
  75. $mail->IsSMTP();                                      // Set mailer to use SMTP
  76. $mail->Host = 'smtp.gmail.com';                       // Specify main and backup server
  77. $mail->Port = 465;                                    // Set the SMTP port
  78. $mail->SMTPAuth = true;                               // Enable SMTP authentication
  79. $mail->Username = '[email protected]';             // SMTP username
  80. $mail->Password = 'escoteiros129';                    // SMTP password
  81. $mail->SMTPSecure = 'ssl';                            // Enable encryption, 'ssl' also accepted
  82.  
  83. $mail->From = '[email protected]';
  84. $mail->FromName = 'Comment MailBot';
  85. $mail->AddAddress('[email protected]', 'CyberBoy');  // Add a recipient
  86.  
  87. $mail->IsHTML(true);                                  // Set email format to HTML
  88.  
  89. $mail->Subject = 'LocaTunes - New comment from: ' . $name;
  90. $mail->Body    = $html;
  91.  
  92. if(!$mail->Send()) {
  93.    echo 'Comment could not be sent.';
  94.    echo 'Mailer Error: ' . $mail->ErrorInfo;
  95.    exit;
  96. }
  97.  
  98. echo 'Your comment has been sent!';
  99. }
  100.  
  101. ?>
  102.  
  103. <style>
  104.   @import url('https://fonts.googleapis.com/css?family=Roboto');
  105.    
  106.   body{
  107.   font-family: 'Roboto', sans-serif;
  108.   background-color: #e2e2e2;
  109. }
  110.  
  111. error{
  112.   color: #f73333;
  113. }
  114.         /* Box & Content */
  115.  
  116. .box{
  117.  border-bottom-right-radius: 2px;
  118.   border-bottom-left-radius: 2px;
  119.   background: #fff;
  120.   display: inline-block;
  121.   margin-left: 1rem;
  122.   position: relative;
  123.   padding: 1%;
  124.   box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  125.   transition: all 0.3s cubic-bezier(.25,.8,.25,1);
  126.   width: 500px;
  127.   height: auto;
  128. }
  129.  
  130.    
  131. .box:hover {
  132.   box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
  133. }
  134.  
  135. .header{
  136.   border-top-left-radius: 2px;
  137.   border-top-right-radius: 2px;
  138.   background-color: #0fb7ff;
  139.   display: inline-block;
  140.   margin-left: 1rem;
  141.   position: relative;
  142.   padding: 1%;
  143.   box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  144.   transition: all 0.3s cubic-bezier(.25,.8,.25,1);
  145.   width: 500px;
  146.   height: auto;
  147. }
  148.     /* INPUTS */
  149.    
  150. input[type=text] {
  151.   width: 100%;
  152.   padding: 12px 20px;
  153.   margin: 8px 0;
  154.   box-sizing: border-box;
  155.   border: 1px solid grey;
  156.   border-radius: 4px;
  157.   transition: border 0.25s;
  158.   -webkit-transition: border 0.25s; /* Safari 3.1 to 6.0 */
  159. }
  160.  
  161. input[type=text]:focus{
  162.   border: 3px solid #6da5ff;
  163.   outline: none;
  164. }
  165.    
  166. input[type=submit] {
  167.   width: 100%;
  168.   padding: 12px 20px;
  169.   margin: 8px 0;
  170.   box-sizing: border-box;
  171.   border: 1px solid grey;
  172.   border-radius: 4px;
  173.   transition: background-color 0.25s;
  174.   -webkit-transition: background-color 0.25s; /* Safari 3.1 to 6.0 */
  175. }
  176.  
  177. input[type=submit]:hover{
  178.   background-color: green;
  179.   outline: none;
  180. }
  181.    
  182. textarea {
  183.   width: 100%;
  184.   padding: 12px 20px;
  185.   margin: 8px 0;
  186.   box-sizing: border-box;
  187.   border: 1px solid grey;
  188.   border-radius: 4px;
  189.   transition: border 0.25s;
  190.   -webkit-transition: border 0.25s; /* Safari 3.1 to 6.0 */
  191. }
  192.  
  193. textarea:focus{
  194.   border: 3px solid #6da5ff;
  195.   outline: none;
  196. }
  197. </style>
Add Comment
Please, Sign In to add comment