Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = '';
- $name = '';
- $email = '';
- $message = '';
- function clean_text($string)
- {
- $string = trim($string);
- $string = stripslashes($string);
- $string = htmlspecialchars($string);
- return $string;
- }
- if(isset($_POST["submitcontact"]))
- {
- if(empty($_POST["name"]))
- {
- $error .= '<p><label class="text-danger">Vul asltublieft uw naam in</label></p>';
- }
- else
- {
- $name = clean_text($_POST["name"]);
- if(!preg_match("/^[a-zA-Z ]*$/",$name))
- {
- $error .= '<p><label class="text-danger">In uw naam zijn alleen letters en spaties toegestaan</label></p>';
- }
- }
- if(empty($_POST["email"]))
- {
- $error .= '<p><label class="text-danger">Vul asltublieft uw email in</label></p>';
- }
- else
- {
- $email = clean_text($_POST["email"]);
- if(!filter_var($email, FILTER_VALIDATE_EMAIL))
- {
- $error .= '<p><label class="text-danger">Vul alstublieft een geldige email in</label></p>';
- }
- }
- if(empty($_POST["message"]))
- {
- $error .= '<p><label class="text-danger">Schrijf alstublieft een bericht</label></p>';
- }
- else
- {
- $message = clean_text($_POST["message"]);
- }
- if($error == '')
- {
- require 'class/class.phpmailer.php';
- $mail = new PHPMailer;
- $mail->IsSMTP(); //Sets Mailer to send message using SMTP
- $mail->Host = 'mail.zxcs.nl'; //Sets the SMTP hosts of your Email hosting, this for Godaddy
- $mail->Port = '465'; //Sets the default SMTP server port
- $mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables
- $mail->Username = '...'; //Sets SMTP username
- $mail->Password = '...'; //Sets SMTP password
- $mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"
- $mail->CharSet = 'UTF-8';
- $mail->From = $_POST["email"]; //Sets the From email address for the message
- $mail->FromName = $_POST["name"]; //Sets the From name of the message
- $mail->AddAddress('...'); //Adds a "To" address
- $mail->IsHTML(true); //Sets message type to HTML
- $mail->Subject = 'Nieuwe vraag'; //Sets the Subject of the message
- //$mail->Body = "Hi there";
- $mail->Body = nl2br(htmlentities($_POST["message"])); //An HTML or plain text message body
- if($mail->Send()) //Send an Email. Return true on success or false on error
- {
- $error .= '<label class="text-success">We hebben uw bericht ontvangen en nemen zo snel mogelijk contact met u op</label>';
- }
- else
- {
- $error .= '<label class="text-danger">Er is iets misgegaan, probeer opnieuw of verstuur handmatig een email naar ...</label>';
- }
- }
- }
- //2nd form
- $error2 = '';
- $vnaam = $_POST["vnaam"];
- $anaam = $_POST["anaam"];
- $email2 = $_POST["email2"];
- $groep = $_POST["groep"];
- $niveau = $_POST["niveau"];
- $tel = $_POST["tel"];
- $basisschool = $_POST["basisschool"];
- $message2 = nl2br(htmlentities($_POST["message2"]));
- $rand = rand(100000, 999999);
- if(isset($_POST["submitinschrijven"]))
- {
- if(empty($_POST["vnaam"]))
- {
- $error2 .= '<p><label class="text-danger">Vul asltublieft uw kind zijn voornaam in</label></p>';
- }
- else
- {
- $vnaam = clean_text($_POST["vnaam"]);
- if(!preg_match("/^[a-zA-Z ]*$/",$vnaam))
- {
- $error2 .= '<p><label class="text-danger">In uw kind voornaam zijn alleen letters toegestaan</label></p>';
- }
- }
- if(empty($_POST["anaam"]))
- {
- $error2 .= '<p><label class="text-danger">Vul asltublieft uw kind zijn achternaam in</label></p>';
- }
- else
- {
- $anaam = clean_text($_POST["anaam"]);
- if(!preg_match("/^[a-zA-Z ]*$/",$anaam))
- {
- $error2 .= '<p><label class="text-danger">In uw kind zijn achternaam zijn alleen letters toegestaan</label></p>';
- }
- }
- if(empty($_POST["basisschool"]))
- {
- $error2 .= '<p><label class="text-danger">Vul asltublieft de huidige basisschool van uw kind in</label></p>';
- }
- else
- {
- $basisschool = clean_text($_POST["basisschool"]);
- if(!preg_match("/^[a-zA-Z ]*$/",$basisschool))
- {
- $error2 .= '<p><label class="text-danger">In de huidige basisschool van uw kind zijn alleen letters en spaties toegestaan</label></p>';
- }
- }
- if(empty($_POST["email2"]))
- {
- $error2 .= '<p><label class="text-danger">Vul asltublieft uw email in</label></p>';
- }
- else
- {
- $email2 = clean_text($_POST["email2"]);
- if(!filter_var($email2, FILTER_VALIDATE_EMAIL))
- {
- $error2 .= '<p><label class="text-danger">Vul alstublieft een geldige email in</label></p>';
- }
- }
- if($error2 == '')
- {
- require 'class/class.phpmailer.php';
- $mail = new PHPMailer;
- $mail->IsSMTP(); //Sets Mailer to send message using SMTP
- $mail->Host = 'mail.zxcs.nl'; //Sets the SMTP hosts of your Email hosting, this for Godaddy
- $mail->Port = '465'; //Sets the default SMTP server port
- $mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables
- $mail->Username = '...'; //Sets SMTP username
- $mail->Password = '...'; //Sets SMTP password
- $mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"
- $mail->CharSet = 'UTF-8';
- $mail->From = '...'; //Sets the From email address for the message
- $mail->FromName = '...'; //Sets the From name of the message
- $mail->AddAddress($_POST["email2"]); //Adds a "To" address
- $mail->AddBCC('...');
- $mail->IsHTML(true); //Sets message type to HTML
- $mail->Subject = 'Uw inschrijving voor ...'; //Sets the Subject of the message
- $mail->Body = '<p>
- Beste ouder(s)/verzorger(s) van '.$vnaam.',....</p>';
- if($mail->Send()) //Send an Email. Return true on success or false on error
- {
- $error3 = '<label class="text-success">We hebben uw inschrijving ontvangen en een mail met de betalingsinstructies naar u verzonden</label>';
- }
- else
- {
- $error3 = '<label class="text-danger">Er is iets misgegaan, probeer opnieuw of verstuur een email naar ...</label>';
- }
- }
- if($error2 !== '')
- {
- $error3 = '<label class="text-danger">Sommige velden lijken niet te kloppen, kijkt u alstublieft nog eens naar het inschrijfformulier</label>';
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>...</title>
- <body>
- <section class="site-section bg-light" id="contact">
- <div class="container">
- <div class="row">
- <div class="col-md-12 text-center mb-5">
- <h2 class="display-4">Contact</h2>
- <div class="row justify-content-center">
- <!--<div class="col-md-7">
- <p class="lead">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
- </div>-->
- </div>
- </div>
- <div class="col-md-7 mb-5">
- <?php echo $error; ?>
- <form action="" method="post">
- <input type="hidden" name="form" value="contact">
- <div class="form-group">
- <label for="name" class="sr-only">Name</label>
- <input type="text" name="name" class="form-control" id="name" placeholder="Naam">
- </div>
- <div class="form-group">
- <label for="email" class="sr-only">Email</label>
- <input type="text" name="email" class="form-control" id="email" placeholder="Email">
- </div>
- <div class="form-group">
- <label for="message" class="sr-only">Message</label>
- <textarea name="message" id="message" cols="30" rows="10" class="form-control" placeholder="Schrijf hier uw bericht"></textarea>
- </div>
- <div class="form-group">
- <input type="submit" id="submitcontact" name="submitcontact" class="btn btn-primary btn-lg" value="Verstuur bericht">
- </div>
- </form>
- </div>
- <div class="col-md-1"></div>
- <div class="col-md-4">
- <p class="text-black">
- Email: <br> <a href="mailto:...">...</a>
- </p>
- </div>
- </div>
- </div>
- </section>
- ----------------------------------FORM in POPUP
- <div class="inschrijfform">
- <div class="modal fade" id="reservationModal" tabindex="-1" role="dialog" aria-labelledby="reservationModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-lg" role="document">
- <div class="modal-content">
- <div class="modal-body">
- <div class="row">
- <div class="col-lg-12">
- </div>
- <div class="col-lg-12 p-5">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <small>SLUITEN </small><span aria-hidden="true">×</span>
- </button>
- <h1 class="mb-4">Inschrijven</h1>
- <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.
- <br>
- <br>Velden met * zijn verplicht</p>
- <?php echo $error2; ?>
- <form action="#" method="post">
- <div class="row">
- <div class="col-md-6 form-group">
- <label for="vnaam">Voornaam kind*</label>
- <input type="text" name="vnaam" class="form-control" id="vnaam" placeholder="voornaam">
- </div>
- <div class="col-md-6 form-group">
- <label for="anaam">Achternaam kind*</label>
- <input type="text" name="anaam" class="form-control" id="anaam" placeholder="achternaam">
- </div>
- </div>
- <div class="row">
- <div class="col-md-12 form-group">
- <label for="email2">Email*</label>
- <input type="text" name="email2" class="form-control" id="email2" placeholder="voorbeeld@gmail.com">
- </div>
- </div>
- <div class="row">
- <div class="col-md-6 form-group">
- <label for="tel">Telefoonnummer</label>
- <input type="text" class="form-control" name="tel" id="tel" placeholder="0612345678">
- </div>
- <div class="col-md-6 form-group">
- <label for="basisschool">Huidige Basisschool*</label>
- <input type="text" class="form-control" name="basisschool" id="basisschool" placeholder="De Heydonck">
- </div>
- </div>
- <div class="row">
- <div class="col-md-6 form-group">
- <label for="groep">Groep kind*</label>
- <select name="groep" id="groep" class="form-control">
- <option value="Groep 7">Groep 7</option>
- <option value="Groep 8">Groep 8</option>
- </select>
- </div>
- <div class="col-md-6 form-group">
- <label for="niveau">Waarschijnlijke vervolgopleiding*</label>
- <select name="niveau" id="groep" class="form-control">
- <option value="vmbo basis/kader">vmbo basis/kader</option>
- <option value="vmbo-t / mavo">vmbo-t / mavo</option>
- <option value="havo">havo</option>
- <option value="havo HIC">havo HIC</option>
- <option value="vwo">vwo</option>
- <option value="vwo HIC">vwo HIC</option>
- </select>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12 form-group">
- <label for="message2">Extra opmerkingen</label>
- <textarea class="form-control" name="message2" id="message2" placeholder="Extra opmerkingen" cols="30" rows="7"></textarea>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12 form-group">
- <input type="submit" name="submitinschrijven" class="btn btn-primary btn-lg btn-block" value="Inschrijving Voltooien">
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement