Advertisement
Guest User

Untitled

a guest
Feb 14th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.63 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Freud-Online | Apply</title>
  8.  
  9. <!-- Bootstrap -->
  10. <link href="css/bootstrap.css" rel="stylesheet">
  11. <link href="css/styles.css" rel="stylesheet">
  12.  
  13. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  14. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  15. <!--[if lt IE 9]>
  16.       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  17.       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  18.     <![endif]-->
  19. </head>
  20. <body>
  21. <nav class="navbar navbar-default">
  22.   <div class="container-fluid">
  23.     <div class="navbar-header">
  24.       <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#defaultNavbar1"><span class="sr-only">Menu</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
  25.         <span class="navbar-toggler-icon"></span>
  26.     </div>
  27.     <div class="collapse navbar-collapse" id="defaultNavbar1">
  28.       <ul class="navigation">
  29.           <li class="menuitem"><a href="/">Home</a></li>
  30.           <li class="menuitem"><a href="book">Apply</a></li>
  31.           <li class="menuitem"><a href="#">Portfolio</a></li>
  32.           <li class="menuitem"><a href="#">Contact Us</a></li>
  33.       </ul>
  34.     </div>
  35.   </div>
  36. </nav>
  37. <div class="container">
  38.   <div class="appform">
  39.     <h1>Apply</h1>
  40.     <hr>
  41.     <?php
  42.     use PHPMailer\PHPMailer\PHPMailer;
  43.     require_once dirname(__FILE__, 2)."/vendor/autoload.php";
  44.     $msg_firstname = "";
  45.     $formaterror = "";
  46.     $msg_lastname = "";
  47.     $formaterrorl ="";
  48.     $emailerror = "";
  49.     $emailformat = "";
  50.     $msg_phone = "";
  51.     $phoneformat = "";
  52.     $msg_company = "";
  53.     $msg_pages = "";
  54.     $msg_extra = "";
  55.     $msg_success = "";
  56.     $failure = "";
  57.     if (isset($_POST['submit'])) {
  58.     //checking name
  59.     if(empty($_POST['firstname']))
  60.     $msg_firstname = "Please enter your first name!";
  61.     if (!ctype_alpha($_POST['firstname'])) {
  62.         $formaterror = "Only non-numerical characters are permitted";
  63.     }
  64.     //LastName
  65.     if(empty($_POST['lastname']))
  66.     $msg_lastname = "Please enter your last name!";
  67.     if (!ctype_alpha($_POST['lastname'])) {
  68.         $formaterrorl = "Only non-numerical characters are permitted";
  69.     }
  70.    
  71.     //check email
  72.     if(empty($_POST['emailform']))
  73.     $emailerror = "Please enter your email address!";
  74.     $email_subject = $_POST['emailform'];
  75.     if (!filter_var($email_subject, FILTER_VALIDATE_EMAIL)) {
  76.         $emailformat = "Please make sure the email is in the correct format.";
  77.     }
  78.  
  79.     //checking phone
  80.     if(empty($_POST['phone']))
  81.     $msg_phone = "Please enter your phone number!";
  82.     $phone_subject = $_POST['phone'];
  83.     $character = strlen($phone_subject);
  84.     $phone_pattern = '11';
  85.     if($character != $phone_pattern)
  86.     $phoneformat = "Please make sure that your phone number is correctly formatted.";
  87.     //checking companyname
  88.     if(empty($_POST['company']))
  89.     $msg_company = "Please enter your company name!";
  90.     //checking pages
  91.     if(empty($_POST['pages']))
  92.     $msg_pages = "Please enter the estimated amount of pages!";
  93.     //checking companyname
  94.     if(empty($_POST['extra']))
  95.     $msg_extra = "Please enter the pages required!";
  96.   }
  97.     ?>
  98.     <?php
  99.     // validation complete
  100.     if(isset($_POST['submit'])){
  101.     if($msg_firstname=="" && $formaterror=="" && $msg_lastname=="" && $formaterrorl=="" && $emailerror=="" && $emailformat=="" && $msg_phone=="" && $phoneformat=="" && $msg_company=="" && $msg_pages=="" && $msg_extra=="")
  102.     //send mail
  103.    
  104.     try {
  105.         $mail = new PHPMailer;
  106.         $mail->isSMTP();
  107.         $mail->Host = 'smtp.gmail.com';
  108.         $mail->SMTPAuth = true;
  109.         $mail->Username = 'noreply@freud-online.com';
  110.         $mail->Password = '';
  111.         $mail->SMTPSecure = 'tls';
  112.         $mail->Port = 587;
  113.         $mail->setFrom('noreply@freud-online.com', 'Freud Online | Bookings');
  114.         $mail->addAddress('', '');
  115.  
  116.         $mail->isHTML(true);
  117.         $mail->Subject = 'Here is the subject';
  118.         $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
  119.         $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  120.  
  121.     } catch (Exception $e) {
  122.         echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  123.         $failure = 'Message could not be sent. Mailer Error';
  124.     }
  125.     if ($mail->send()) {
  126.         $msg_success = 'Form successfully sent!';
  127.     } else {
  128.         $failure = 'There was an issue sending your form. Please try again later...';
  129. }}
  130.     ?>
  131.  
  132.     <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
  133.         <div class="col-xl-6">
  134.           <h2 class="title">General Information:</h2>
  135.           <div class="formcontent">
  136.             <div class="form-row">
  137.               <div class="form-group col-md-6">
  138.                   <label for="firstname">First Name: *</label>
  139.                   <input type="text" class="form-control" id="firstname" name="firstname" placeholder="John" value="<?= $_POST['firstname'] ?? '' ?>">
  140.           <span class="error"><?php echo $msg_firstname?></span>
  141.           <span class="error"><?php echo $formaterror?></span>
  142.               </div>
  143.                    
  144.         <div class="form-group col-md-6">
  145.                   <label for="lastname">Last Name: *</label>
  146.                   <input type="text" class="form-control" id="lastname" name="lastname" placeholder="Smith" value="<?= $_POST['lastname'] ?? '' ?>">
  147.           <span class="error"><?php echo $msg_lastname?></span>
  148.           <span class="error"><?php echo $formaterrorl?></span>
  149.               </div>
  150.             </div>
  151.             <div class="form-group col-md-12">
  152.                 <label for="emailform">Email address: *</label>
  153.                 <input type="email" class="form-control" name="emailform" placeholder="name@example.com" value="<?= $_POST['emailform'] ?? '' ?>">
  154.                 <small name="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  155.         <span class="error"><?php echo $emailerror;?></span>
  156.         <span class="error"><?php echo $emailformat;?></span>
  157.             </div>
  158.             <div class="form-group col-md-12">
  159.                 <label for="phone">Contact Number: *</label>
  160.                 <input type="number" class="form-control" name="phone" placeholder="(077 7871 5335" value="<?= $_POST['phone'] ?? '' ?>">
  161.         <span class="error"><?php echo $msg_phone;?></span>
  162.         <span class="error"><?php echo $phoneformat;?></span>
  163.             </div>
  164.             <div class="form-group col-md-12">
  165.                 <label for="company">Company Name: *</label>
  166.                 <input type="text" class="form-control" name="company" placeholder="ABC Online" value="<?= $_POST['company'] ?? '' ?>">
  167.         <span class="error"><?php echo $msg_company;?></span>
  168.             </div>
  169.           </div>
  170.         </div>
  171.     <div class="col-xl-6">
  172.       <h2 class="title">Website Information:</h2>
  173.       <div class="formcontent">
  174.         <div class="form-row">
  175.           <div class="form-group col-md-6">
  176.               <label for="pages">Estimated amount of Pages: *</label>
  177.               <input type="number" class="form-control" name="pages" placeholder="1" value="<?= $_POST['pages'] ?? '' ?>">
  178.               <span class="error"><?php echo $msg_pages;?></span>
  179.           </div>
  180.           <div class="form-group col-md-6">
  181.               <label for="extra">Pages Required: *</label>
  182.               <input type="text" class="form-control" name="extra" placeholder="Contact Us" value="<?= $_POST['extra'] ?? '' ?>">
  183.               <small name="extrahelp" class="form-text text-muted">Enter what pages you would like (Gallery, Testimonials, Contact).</small>
  184.               <span class="error"><?php echo $msg_extra;?></span>
  185.           </div>
  186.         </div>
  187.         <div class="form-group col-md-12">
  188.             <label for="comments">Other Requests/Comments:</label>
  189.             <input type="text" class="form-control" name="comments" placeholder="I'd like to have dogs featured somewhere" value="<?= $_POST['comments'] ?? '' ?>">
  190.         </div>
  191.       </div>
  192.       <input type="submit" name="submit" value="Submit" class="btn btn-primary">
  193.       <span class="success"><?php echo $msg_success;?></span>
  194.       <span class="success"><?php echo $failure;?></span>
  195.  
  196.         </div>
  197.       </form>
  198.     </div>
  199. </div>
  200. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  201. <script src="js/jquery-1.11.3.min.js"></script>
  202.  
  203. <!-- Include all compiled plugins (below), or include individual files as needed -->
  204.  
  205. <script src="js/bootstrap.js"></script>
  206. <video autoplay muted loop id="pattern">
  207.   <source src="images/backgroundpattern.mp4" type="video/mp4">
  208. </video>
  209. </body>
  210. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement