Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
1,334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 13.65 KB | None | 0 0
  1. <?php
  2.  
  3. $error = '';
  4. $name = '';
  5. $email = '';
  6. $message = '';
  7.  
  8. function clean_text($string)
  9. {
  10.   $string = trim($string);
  11.   $string = stripslashes($string);
  12.   $string = htmlspecialchars($string);
  13.   return $string;
  14. }
  15.  
  16. if(isset($_POST["submitcontact"]))
  17. {
  18.   if(empty($_POST["name"]))
  19.   {
  20.       $error .= '<p><label class="text-danger">Vul asltublieft uw naam in</label></p>';
  21.     }
  22.     else
  23.     {
  24.         $name = clean_text($_POST["name"]);
  25.         if(!preg_match("/^[a-zA-Z ]*$/",$name))
  26.         {
  27.             $error .= '<p><label class="text-danger">In uw naam zijn alleen letters en spaties toegestaan</label></p>';
  28.         }
  29.     }
  30.     if(empty($_POST["email"]))
  31.     {
  32.         $error .= '<p><label class="text-danger">Vul asltublieft uw email in</label></p>';
  33.     }
  34.     else
  35.     {
  36.         $email = clean_text($_POST["email"]);
  37.         if(!filter_var($email, FILTER_VALIDATE_EMAIL))
  38.         {
  39.             $error .= '<p><label class="text-danger">Vul alstublieft een geldige email in</label></p>';
  40.         }
  41.     }
  42.     if(empty($_POST["message"]))
  43.     {
  44.         $error .= '<p><label class="text-danger">Schrijf alstublieft een bericht</label></p>';
  45.     }
  46.     else
  47.     {
  48.         $message = clean_text($_POST["message"]);
  49.     }
  50.     if($error == '')
  51.     {
  52.         require 'class/class.phpmailer.php';
  53.         $mail = new PHPMailer;
  54.         $mail->IsSMTP();                                //Sets Mailer to send message using SMTP
  55.         $mail->Host = 'mail.zxcs.nl';       //Sets the SMTP hosts of your Email hosting, this for Godaddy
  56.         $mail->Port = '465';                                //Sets the default SMTP server port
  57.         $mail->SMTPAuth = true;                         //Sets SMTP authentication. Utilizes the Username and Password variables
  58.         $mail->Username = '...';                    //Sets SMTP username
  59.         $mail->Password = '...';                    //Sets SMTP password
  60.         $mail->SMTPSecure = 'ssl';                          //Sets connection prefix. Options are "", "ssl" or "tls"
  61.         $mail->CharSet = 'UTF-8';
  62.         $mail->From = $_POST["email"];                  //Sets the From email address for the message
  63.         $mail->FromName = $_POST["name"];               //Sets the From name of the message
  64.         $mail->AddAddress('...');       //Adds a "To" address
  65.         $mail->IsHTML(true);                            //Sets message type to HTML            
  66.         $mail->Subject = 'Nieuwe vraag';                //Sets the Subject of the message
  67.         //$mail->Body = "Hi there";
  68.         $mail->Body = nl2br(htmlentities($_POST["message"]));       //An HTML or plain text message body
  69.         if($mail->Send())                               //Send an Email. Return true on success or false on error
  70.         {
  71.             $error .= '<label class="text-success">We hebben uw bericht ontvangen en nemen zo snel mogelijk contact met u op</label>';
  72.         }
  73.         else
  74.         {
  75.             $error .= '<label class="text-danger">Er is iets misgegaan, probeer opnieuw of verstuur handmatig een email naar ...</label>';
  76.         }
  77.     }
  78. }
  79.  
  80. //2nd form
  81.  
  82. $error2 = '';
  83. $vnaam = $_POST["vnaam"];
  84. $anaam = $_POST["anaam"];
  85. $email2 = $_POST["email2"];
  86. $groep = $_POST["groep"];
  87. $niveau = $_POST["niveau"];
  88. $tel = $_POST["tel"];
  89. $basisschool = $_POST["basisschool"];
  90. $message2 = nl2br(htmlentities($_POST["message2"]));
  91. $rand = rand(100000, 999999);
  92.  
  93. if(isset($_POST["submitinschrijven"]))
  94. {
  95.     if(empty($_POST["vnaam"]))
  96.     {
  97.         $error2 .= '<p><label class="text-danger">Vul asltublieft uw kind zijn voornaam in</label></p>';
  98.     }
  99.     else
  100.     {
  101.         $vnaam = clean_text($_POST["vnaam"]);
  102.         if(!preg_match("/^[a-zA-Z ]*$/",$vnaam))
  103.         {
  104.             $error2 .= '<p><label class="text-danger">In uw kind voornaam zijn alleen letters toegestaan</label></p>';
  105.         }
  106.     }
  107. if(empty($_POST["anaam"]))
  108.     {
  109.         $error2 .= '<p><label class="text-danger">Vul asltublieft uw kind zijn achternaam in</label></p>';
  110.     }
  111.     else
  112.     {
  113.         $anaam = clean_text($_POST["anaam"]);
  114.         if(!preg_match("/^[a-zA-Z ]*$/",$anaam))
  115.         {
  116.             $error2 .= '<p><label class="text-danger">In uw kind zijn achternaam zijn alleen letters toegestaan</label></p>';
  117.         }
  118.     }  
  119.  
  120.     if(empty($_POST["basisschool"]))
  121.     {
  122.         $error2 .= '<p><label class="text-danger">Vul asltublieft de huidige basisschool van uw kind in</label></p>';
  123.     }
  124.     else
  125.     {
  126.         $basisschool = clean_text($_POST["basisschool"]);
  127.         if(!preg_match("/^[a-zA-Z ]*$/",$basisschool))
  128.         {
  129.             $error2 .= '<p><label class="text-danger">In de huidige basisschool van uw kind zijn alleen letters en spaties toegestaan</label></p>';
  130.         }
  131.     }  
  132.  
  133.     if(empty($_POST["email2"]))
  134.     {
  135.         $error2 .= '<p><label class="text-danger">Vul asltublieft uw email in</label></p>';
  136.     }
  137.     else
  138.     {
  139.         $email2 = clean_text($_POST["email2"]);
  140.         if(!filter_var($email2, FILTER_VALIDATE_EMAIL))
  141.         {
  142.             $error2 .= '<p><label class="text-danger">Vul alstublieft een geldige email in</label></p>';
  143.         }
  144.     }
  145.  
  146.     if($error2 == '')
  147.     {
  148.         require 'class/class.phpmailer.php';
  149.         $mail = new PHPMailer;
  150.         $mail->IsSMTP();                                //Sets Mailer to send message using SMTP
  151.         $mail->Host = 'mail.zxcs.nl';       //Sets the SMTP hosts of your Email hosting, this for Godaddy
  152.         $mail->Port = '465';                                //Sets the default SMTP server port
  153.         $mail->SMTPAuth = true;                         //Sets SMTP authentication. Utilizes the Username and Password variables
  154.         $mail->Username = '...';                    //Sets SMTP username
  155.         $mail->Password = '...';                    //Sets SMTP password
  156.         $mail->SMTPSecure = 'ssl';                          //Sets connection prefix. Options are "", "ssl" or "tls"
  157.         $mail->CharSet = 'UTF-8';
  158.         $mail->From = '...';                    //Sets the From email address for the message
  159.         $mail->FromName = '...';                //Sets the From name of the message
  160.         $mail->AddAddress($_POST["email2"]);        //Adds a "To" address
  161.         $mail->AddBCC('...');
  162.         $mail->IsHTML(true);                            //Sets message type to HTML            
  163.         $mail->Subject = 'Uw inschrijving voor ...';                //Sets the Subject of the message
  164.         $mail->Body = '<p>
  165.         Beste ouder(s)/verzorger(s) van '.$vnaam.',....</p>';
  166.  
  167.         if($mail->Send())                               //Send an Email. Return true on success or false on error
  168.         {
  169.             $error3 = '<label class="text-success">We hebben uw inschrijving ontvangen en een mail met de betalingsinstructies naar u verzonden</label>';
  170.         }
  171.         else
  172.         {
  173.             $error3 = '<label class="text-danger">Er is iets misgegaan, probeer opnieuw of verstuur een email naar ...</label>';
  174.         }
  175.     }
  176.     if($error2 !== '')
  177.     {
  178.         $error3 = '<label class="text-danger">Sommige velden lijken niet te kloppen, kijkt u alstublieft nog eens naar het inschrijfformulier</label>';
  179.     }
  180. }
  181. ?>
  182.  
  183. <!DOCTYPE html>
  184. <html lang="en">
  185.   <head>
  186.     <title>...</title>
  187.  
  188. <body>
  189.  
  190.     <section class="site-section bg-light" id="contact">
  191.       <div class="container">
  192.         <div class="row">
  193.           <div class="col-md-12 text-center mb-5">
  194.             <h2 class="display-4">Contact</h2>
  195.            <div class="row justify-content-center">
  196.               <!--<div class="col-md-7">
  197.               <p class="lead">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
  198.             </div>-->
  199.             </div>
  200.           </div>
  201.           <div class="col-md-7 mb-5">
  202. <?php echo $error; ?>
  203.             <form action="" method="post">
  204.                     <input type="hidden" name="form" value="contact">
  205.               <div class="form-group">
  206.                 <label for="name" class="sr-only">Name</label>
  207.                 <input type="text" name="name" class="form-control" id="name" placeholder="Naam">
  208.               </div>
  209.               <div class="form-group">
  210.                 <label for="email" class="sr-only">Email</label>
  211.                 <input type="text" name="email" class="form-control" id="email" placeholder="Email">
  212.               </div>
  213.               <div class="form-group">
  214.                 <label for="message" class="sr-only">Message</label>
  215.                 <textarea name="message" id="message" cols="30" rows="10" class="form-control" placeholder="Schrijf hier uw bericht"></textarea>
  216.               </div>
  217.               <div class="form-group">
  218.                 <input type="submit" id="submitcontact" name="submitcontact" class="btn btn-primary btn-lg" value="Verstuur bericht">
  219.               </div>
  220.             </form>
  221.           </div>
  222.           <div class="col-md-1"></div>
  223.           <div class="col-md-4">
  224.             <p class="text-black">
  225.               Email: <br> <a href="mailto:...">...</a>
  226.             </p>
  227.           </div>
  228.         </div>
  229.       </div>
  230.     </section>
  231.    
  232.  
  233.  
  234. ----------------------------------FORM in POPUP
  235.  
  236.    
  237.  
  238.     <div class="inschrijfform">
  239.     <div class="modal fade" id="reservationModal" tabindex="-1" role="dialog" aria-labelledby="reservationModalLabel" aria-hidden="true">
  240.       <div class="modal-dialog modal-lg" role="document">
  241.         <div class="modal-content">
  242.           <div class="modal-body">
  243.             <div class="row">
  244.               <div class="col-lg-12">
  245.               </div>
  246.               <div class="col-lg-12 p-5">
  247.                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  248.                   <small>SLUITEN </small><span aria-hidden="true">&times;</span>
  249.                 </button>
  250.                 <h1 class="mb-4">Inschrijven</h1>  
  251.                 <p>Na uw aanmeldingen ontvangt u een bevestigingsmail met de betalingsinstructies om uw inschrijving te voltooien. Ontvangt u deze niet? Neem dan contact met ons op.
  252.                     <br>
  253.                     <br>Velden met * zijn verplicht</p>
  254.                 <?php echo $error2; ?>
  255.                 <form action="#" method="post">
  256.  
  257.                   <div class="row">
  258.                     <div class="col-md-6 form-group">
  259.                       <label for="vnaam">Voornaam kind*</label>
  260.                       <input type="text" name="vnaam" class="form-control" id="vnaam" placeholder="voornaam">
  261.                     </div>
  262.                     <div class="col-md-6 form-group">
  263.                       <label for="anaam">Achternaam kind*</label>
  264.                       <input type="text" name="anaam" class="form-control" id="anaam" placeholder="achternaam">
  265.                     </div>
  266.                   </div>
  267.                   <div class="row">
  268.                     <div class="col-md-12 form-group">
  269.                       <label for="email2">Email*</label>
  270.                       <input type="text" name="email2" class="form-control" id="email2" placeholder="voorbeeld@gmail.com">
  271.                     </div>
  272.                   </div>
  273.  
  274.                   <div class="row">
  275.                     <div class="col-md-6 form-group">
  276.                       <label for="tel">Telefoonnummer</label>
  277.                       <input type="text" class="form-control" name="tel" id="tel" placeholder="0612345678">
  278.                     </div>
  279.                     <div class="col-md-6 form-group">
  280.                       <label for="basisschool">Huidige Basisschool*</label>
  281.                       <input type="text" class="form-control" name="basisschool" id="basisschool" placeholder="De Heydonck">
  282.                     </div>
  283.                   </div>
  284.  
  285.                   <div class="row">
  286.                     <div class="col-md-6 form-group">
  287.                       <label for="groep">Groep kind*</label>
  288.                       <select name="groep" id="groep" class="form-control">
  289.                         <option value="Groep 7">Groep 7</option>
  290.                         <option value="Groep 8">Groep 8</option>
  291.                       </select>
  292.                     </div>
  293.                     <div class="col-md-6 form-group">
  294.                       <label for="niveau">Waarschijnlijke vervolgopleiding*</label>
  295.                       <select name="niveau" id="groep" class="form-control">
  296.                         <option value="vmbo basis/kader">vmbo basis/kader</option>
  297.                         <option value="vmbo-t / mavo">vmbo-t / mavo</option>
  298.                         <option value="havo">havo</option>
  299.                         <option value="havo HIC">havo HIC</option>
  300.                         <option value="vwo">vwo</option>
  301.                         <option value="vwo HIC">vwo HIC</option>
  302.                       </select>
  303.                     </div>
  304.                   </div>
  305.  
  306.                   <div class="row">
  307.                     <div class="col-md-12 form-group">
  308.                       <label for="message2">Extra opmerkingen</label>
  309.                       <textarea class="form-control" name="message2" id="message2" placeholder="Extra opmerkingen" cols="30" rows="7"></textarea>
  310.                     </div>
  311.                   </div>
  312.                  
  313.                   <div class="row">
  314.                     <div class="col-md-12 form-group">
  315.                       <input type="submit" name="submitinschrijven" class="btn btn-primary btn-lg btn-block" value="Inschrijving Voltooien">
  316.                     </div>
  317.                   </div>
  318.  
  319.                 </form>
  320.               </div>
  321.             </div>
  322.           </div>
  323.         </div>
  324.       </div>
  325.     </div>
  326.   </div>
  327.  
  328. </body
  329. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement