Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // echo $_SERVER['HTTP_REFERER'];
- // die();
- //if($_SERVER['HTTP_REFERER'] != 'http://www.frontiercanhelp.com/byod/form/index.php' && $_SERVER['HTTP_REFERER'] != 'http://frontiercanhelp.com/byod/form.php' && $_SERVER['HTTP_REFERER'] != 'http://frontiercanhelp.com/byod/form/index.php?utm_source=byod&utm_medium=email&utm_campaign=assessment') die();
- error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
- ini_set('display_errors', 'on');
- ini_set('track_errors', 1);
- include 'PHPMailer/class.phpmailer.php';
- /****************************************
- * Lead Form Submission
- ***************************************/
- $alert_email = 'grant.w.waldrop@ftr.com';
- //$alert_email = 'fox@d4creative.com';
- //$alert_email = 'vince.omega@gmail.com';
- if (isset($_POST['btn_submit'])) //-validate form
- {
- $q1 = ($_POST['q1']) ;
- $q2 = ($_POST['q2']) ;
- $q3 = ($_POST['q3']) ;
- $q4 = ($_POST['q4']) ;
- $q5 = ($_POST['q5']) ;
- $q6 = ($_POST['q6']) ;
- $first = ($_POST['first_name']);
- $first ? empty($_POST['first_name']) : header('Location:index.php');
- $last = ($_POST['last_name']);
- $last ? empty($_POST['last_name']) : header('Location:index.php');
- $email = ($_POST['email']);
- $email ? empty($_POST['email']) : header('Location:index.php');
- $phone = ($_POST['phone']);
- $phone ? empty($_POST['phone']) : header('Location:index.php');
- // $fleet_size = (isset($_POST['fleet_size'])) ? $_POST['fleet_size'] : '';
- // $checkbox = (isset($_POST['receive-info'])) ? $_POST['receive-info'] : '';
- // if (empty($q1) || empty($q2) || empty($q3)
- // || empty($q4) || empty($q5) || empty($q6) )
- // {
- // $msg = 'Please enter a valid value for all fields.';
- // }
- // else
- // {
- $tally = $q1 + $q2 + $q3 + $q4 + $q5;
- $perfect = (4*5);
- $total = ($tally/$perfect) * 100;
- $total = (string)$total."%";
- $a1 = "";
- $a2 = "";
- $a3 = "";
- $a4 = "";
- $a5 = "";
- $a6 = "";
- switch($q1){
- case '0':
- $a1 = "0%";
- break;
- case '1':
- $a1 = "25%";
- break;
- case '2':
- $a1 = "50%";
- break;
- case '3':
- $a1 = "75%";
- break;
- case '4':
- $a1 = "100%";
- break;
- case '':
- $a1 = "N/A";
- break;
- }
- switch($q2){
- case '0':
- $a2 = "0%";
- break;
- case '1':
- $a2 = "25%";
- break;
- case '2':
- $a2 = "50%";
- break;
- case '3':
- $a2 = "75%";
- break;
- case '4':
- $a2 = "100%";
- break;
- case '':
- $a2 = "N/A";
- break;
- }
- switch($q3){
- case '0':
- $a3 = "0-20%";
- break;
- case '1':
- $a3 = "20-40%";
- break;
- case '2':
- $a3 = "40-60%";
- break;
- case '3':
- $a3 = "60-80%";
- break;
- case '4':
- $a3 = "80-100%";
- break;
- case '':
- $a3 = "N/A";
- break;
- }
- switch($q4){
- case '0':
- $a4 = "0-20%";
- break;
- case '1':
- $a4 = "20-40%";
- break;
- case '2':
- $a4 = "40-60%";
- break;
- case '3':
- $a4 = "60-80%";
- break;
- case '4':
- $a4 = "80-100%";
- break;
- case '':
- $a4 = "N/A";
- break;
- }
- switch($q5){
- case '0':
- $a5 = "0%";
- break;
- case '1':
- $a5 = "25%";
- break;
- case '2':
- $a5 = "50%";
- break;
- case '3':
- $a5 = "75%";
- break;
- case '4':
- $a5 = "100%";
- break;
- case '':
- $a5 = "N/A";
- break;
- }
- switch($q6){
- case '0':
- $a6 = "Unsure";
- break;
- case '1':
- $a6 = "No";
- break;
- case '2':
- $a6 = "Ad-hoc";
- break;
- case '3':
- $a6 = "In place but not enforced";
- break;
- case '4':
- $a6 = "Yes";
- break;
- case '':
- $a6 = "N/A";
- break;
- }
- // var_dump($q1);
- // var_dump($q2);
- // var_dump($q3);
- // var_dump($q4);
- // var_dump($q5);
- // var_dump($q6);
- // die();
- $record = "\n".(string)$total.', '.(string)$a1.', '.(string)$a2.', '.(string)$a3.', '.(string)$a4.', '.(string)$a5.', '.(string)$a6.', '.(string)$first.', '.(string)$last.', '.(string)$email.', '.(string)$phone."\n";
- //$opr = chmod ("ari_vd19nbG9zc2FyeSI7czoxOiJ5IjtzOjIxOiJmaW_wp.csv", 0755);
- //$record = (string)$first_name.','.(string)$last_name.','.(string)$email.','.(string)$phone.','.(string)$title.','.(string)$company.','.(string)$fleet_size.','.(string)$checkbox."\n";
- $file = fopen('/nfs/c09/h04/mnt/190742/domains/frontiercanhelp.com/html/byod/form/results/form_results.csv','a+');
- if ($file)
- {
- //foreach($record as $key => $value){
- fwrite($file, $record);
- // }
- fclose($file);
- }
- $mail = new PHPMailer();
- $mail->From = "noreply@frontier.com";
- $mail->FromName = "Frontier BYOD";
- $mail->AddAddress('grant.w.waldrop@ftr.com');
- $mail->AddBCC("stanfield@d4creative.com");
- $mail->AddBCC("stauffer@d4creative.com");
- $mail->AddBCC("fox@d4creative.com");
- $mail->Subject = "Frontier survey results";
- $mail->Body = "The following score was submitted via http://frontiercanhelp.com/byod/form/"."\n\n";
- $mail->Body .= "First Name: " . $first . "\n\n";
- $mail->Body .= "Last Name: " . $last . "\n\n";
- $mail->Body .= "Email: " . $email . "\n\n";
- $mail->Body .= "Phone: " . $phone . "\n\n";
- $mail->Body .= "What percentage of your employees works remotely, in branch offices, or in the field connects to the company network?: " ."\r\n". $a1 . "\n\n";
- $mail->Body .= "What percentage of your employees use a personal device (PC, tablet, smartphone) to connect to the company network for various applications including email? " ."\r\n". $a2 . "\n\n";
- $mail->Body .= "What percentage of the devices on the wireless network are corporate managed (as compared to employee owned)? " . "\r\n".$a3 . "\n\n";
- $mail->Body .= "What percentage of the devices on the network are visible to your IT group, and are authenticated (both device and user)?" . "\r\n".$a4 . "\n\n";
- $mail->Body .= "What percentage of your employees and customers are able to access your network or the Internet wirelessly from your business location(s)? " . "\r\n". $a5 . "\n\n";
- $mail->Body .= " Does your company have a wireless device usage policy in place? " . "\r\n". $a6 . "\n\n";
- $mail->Body .= "Total: " . $total . "\n\n";
- $mail->Body .= "Click the following link to export the results as a CSV:\n\n";
- $mail->Body .= "http://frontiercanhelp.com/byod/form/results/form_results.csv";
- if (!$mail->Send())
- {
- echo "<h1>Mailer error:</h1><br />" . $mail->ErrorInfo;
- }
- $success = true;
- //}
- }
- $first64 = base64_encode($first);
- $last64 = base64_encode($last);
- $email64 = base64_encode($email);
- $phone64 = base64_encode($phone);
- header("Location: /byod/form/results.php#".$total."?first=".$first64."&last=".$last64."&email=".$email64."&phone=".$phone64."&scrollTop=0");
- die();
- ?>
Add Comment
Please, Sign In to add comment