<?php
if (isset($_POST['grecaptcharesponse']) && !empty($_POST['grecaptcharesponse']) || 1) {
    //your site secret key
    $secret = '6LcNdTUUAAAAAL5VYxoCX2itVnaooUjEN-XFJ_iq';
    //get verify response data
    $captcha = $_POST['grecaptcharesponse'];
    $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
    $cSECRET_KEY = '6LdN27sUAAAAAGVn4uwLVZjdBimQOcJ_Mc_j_Qto';
    $recaptcha = file_get_contents($recaptcha_url . '?secret=' . $cSECRET_KEY . '&response=' . $captcha);
    $responseData = json_decode($recaptcha);
    if ($responseData->success || 1) {
        session_start();
        $conn = mysql_connect("localhost", "skynetuser", "SkynetUserBlog2017$");
        mysql_select_db("skynet_blog", $conn);
        require("class.phpmailer.php");
        include("class.smtp.php");
        //$redirect_url = '../supportthanks.html';
        //$your_email ='rajesh@skynetindia.info';// <<=== update to your email address
        $your_email = 'rajesh@skynetindia.info';// <<=== update to sir email address
        //$your_email = 'developer7@skynettechnologies.com';// <<=== update to your email address
        $attachment_enabled = 1;
        $autoresponder_enabled = 1;

        $fileallow = array('png', 'jpeg', 'jpg', 'gif', 'doc', 'docx', 'xlsx', 'xls', 'csv', 'rtf', 'pdf', 'zip', 'gzip', 'rar');
        //***
        # the response from reCAPTCHA
        $resp = null;
        # the error code from reCAPTCHA, if any
        $error = null;

        if ($_POST["grecaptcharesponse"]) {
            $_POST['IP'] = $_SERVER["REMOTE_ADDR"];
            $_POST['Date'] = date('d-m-Y H:i:s');
            $reg_no = rand(0, 9999);
            //********SMS TO US

            /* $ch = curl_init();
             $reseller = "rajesh@skynetindia.info";
             $user = "admin@wealthadvisory.in:R3M3L";
             $receipientno = "9824407292";
 //$senderID="WEALTH";
             $senderID = "SKYNET";
             $msgtxt = "New Query with Ref. No. " . $reg_no . " , Phone: " . $_POST['PhoneNo'] . " , Email: " . $_POST['email_from'];
             curl_setopt($ch, CURLOPT_URL, "59.162.167.52/api/MessageCompose");
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, "reseller=$reseller&user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt&state=0");
             $buffer = curl_exec($ch);
             if (empty ($buffer)) {
 // echo " buffer is empty ";
             } else {
 // echo $buffer;
             }
             curl_close($ch);


 //**********SMS TO USER

             $ch = curl_init();
             $reseller = "rajesh@skynetindia.info";
             $user = "admin@wealthadvisory.in:R3M3L";
             $receipientno = $_POST['PhoneNo'];
             $senderID = "SKYNET";
             $msgtxt = "Hello " . $_POST['Contact_Person'] . " , Thank You for your Query, Your Reference Number is " . $reg_no . " .";
             curl_setopt($ch, CURLOPT_URL, "59.162.167.52/api/MessageCompose");
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, "reseller=$reseller&user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt&state=0");
             $buffer = curl_exec($ch);
             if (empty ($buffer)) {
 //echo " buffer is empty ";
             } else {
 //echo $buffer;
             }
             curl_close($ch);*/

            function get_form_data()
            {

                global $REQUEST_METHOD;

                global $_POST;

                global $_GET;

                global $reg_no;


                $vars = ($REQUEST_METHOD == 'GET') ? $_GET : $_POST;

                $additionalservice = isset($vars['Website_Upgrades']) ? implode(',', $vars['Website_Upgrades']) : (isset($vars['seo_service']) ? implode(',', $vars['seo_service']) : (isset($vars['maintain_type']) ? implode(',', $vars['maintain_type']) : null));
                $comment = !empty($vars['comment']) ? $vars['comment'] : null;
                $comment = !empty($vars['appcomment']) ? $vars['appcomment'] : $comment;
                $comment = !empty($vars['maincomment']) ? $vars['maincomment'] : $comment;
                $comment = !empty($vars['seocomment']) ? $vars['seocomment'] : $comment;
                $comment = !empty($vars['hirecomment']) ? $vars['hirecomment'] : $comment;

                $dataArr = [
                    "reg_no" => $reg_no,
                    "company_name" => $vars['Company_Name'],
                    "contact_person" => $vars['Contact_Person'],
                    "email_from" => $vars['email_from'],
                    "phoneno" => $vars['PhoneNo'],
                    "city" => $vars['city'],
                    "state" => $vars['state'],
                    "nda_required" => $vars['nda_required'],
                    "country" => $vars['Country'],
                    "service" => $vars['service_type'],
                    "domain_url" => $vars['domain_url'],
                    "redesign_change" => $vars['redesign_change'],
                    "maintain_duration" => $vars['maintain_duration'],
                    "ref_url" => $vars['ref_url'],
                    "design_url" => $vars['design_url'],
                    "brand" => ($vars['brand'] != "No") ? $vars['brand_desc'] : $vars['brand'],
                    "color_plate" => $vars['color_plate'],
                    "search_google" => $vars['search_google'],
                    "page_name" => $vars['page_name'],
                    "document" => $vars['document'],
                    "add_services" => $additionalservice,
                    "ref_app" => $vars['ref_app'],
                    "design_app" => $vars['design_app'],
                    "app_type" => $vars['app_type'],
                    "backend_required" => $vars['backend_required'],
                    "budget" => !empty($vars['seo_budget']) ? $vars['seo_budget'] : $vars['budget'],
                    "timeframe" => !empty($vars['apptimeframe']) ? $vars['apptimeframe'] : $vars['timeframe'],
                    "hiring_model" => $vars['hiring_model'],
                    "technology" => $vars['technology'],
                    "hire_plan" => $vars['hire_plan'],
                    "hire_duration" => $vars['hire_duration'],
                    'primary_purpose'   =>  $vars['primary_purpose'],
                    'competitor'   =>  $vars['competitor'],
                    "devexp" => $vars['devexp'],
                    "comment" => $comment,
                    "question" => $vars['question'],
                    "ip_address" => $vars['IP']
                    /*"status"            =>1,*/
                ];
                if (is_array($dataArr) && (count($dataArr) > 0)) {
                    foreach ($dataArr as $key => $value) {
                        $value = mysql_real_escape_string($value); // this is dedicated to @Jon
                        $value = "'$value'";
                        $insertrecord[] = "$key = $value";
                    }
                }
                $field_value = implode(',', $insertrecord);
                $query = 'INSERT INTO inquiry_data SET ' . $field_value;
                $res = mysql_query($query);
                //strip spaces from all fields

                return $dataArr;

            }

            function _build_fields($vars)
            {
                $skip_fields = array(
                    'Submit',
                    'recaptcha_challenge_field', 'recaptcha_response_field');

                // order by numeric begin, if it exists

                $is_ordered = 0;

                foreach ($vars as $k => $v)

                    if (in_array($k, $skip_fields)) unset($vars[$k]);


                $new_vars = array();

                foreach ($vars as $k => $v) {

                    // remove _num, _reqnum, _req from end of field names

                    $k = preg_replace('/_(req|num|reqnum)$/', '', $k);

                    // check if the fields is ordered

                    //if (preg_match('/^\d+[ \:_-]/', $k)) $is_ordered++;

                    //remove number from begin of fields

                    $k = preg_replace('/^\d+[ \:_-]/', '', $k);

                    $new_vars[$k] = $v;

                }

                $vars = $new_vars;

                $basicinfo=['ip_address'=>$vars['ip_address'],'country'=>$vars['country'],'company_name'=>$vars['company_name'],'contact_person'=>$vars['contact_person'],'email_from'=>$vars['email_from'],'phoneno'=>$vars['phoneno'],'city'=>$vars['city'],'state'=>$vars['state']];
                unset($vars['ip_address'],$vars['country'],$vars['company_name'],$vars['contact_person'],$vars['email_from'],$vars['phoneno'],$vars['city'],$vars['state']);
                $max_length = 10; // max length of key field

                foreach ($vars as $k => $v) {

                    $klen = strlen($k);

                    if (($klen > $max_length) && ($klen < 40))

                        $max_length = $klen;

                }


                if ($is_ordered)

                    ksort($vars);

                // make output text

                $out = '<!doctype html>
                        <html>
                        <head>
                          <meta charset="utf-8">
                          <title>Request a Quote -  Skynet Technologies</title>
                        </head>
                        <body style="padding:0; margin:0;">
                          <table width="100%" style="background-color:#f2f2f2; width:100%; ">
                            <tr>
                              <td style="padding: 50px;">
                                <table width="700" align="center" cellpadding="0" cellspacing="0" style="max-width:700px; margin:0 auto">
                                  <tr>
                                    <td style="background-color:#fff; padding:15px 20px">
                                      <table cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                          <td valign="middle" style="text-align:left;">
                                            <a href="https://www.skynetindia.info/"><img src="https://www.skynetindia.info/images/skynet-technologies-logo.png" alt="Skynet Technologies" height="40" width="280" style="display:block"></a>
                                          </td>
                                          <td valign="middle" style="text-align: right">
                                            <table align="right" cellpadding="0" cellspacing="0">
                                              <tr>
                                                <td style="color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:18px; text-align:right; line-height:1.3;">
                                                  <a href="https://www.skynetindia.info/" title="Skynet Technologies" style="color: #000; text-decoration: none;"><b>www.skynetindia.info</b></a>
                                                </td>
                                              </tr>
                                            </table>
                                          </td>
                                        </tr>
                                      </table>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td style="background-color: #063992">
                                      <table cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                          <td valign="middle" style="background-color:#3239c2; padding:7px 10px; color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:30px;  line-height:1.3;">
                                            Quote Request Submitted! 
                                          </td>
                                          <td width="150px" valign="middle" style="background-color:#063992; padding:7px 10px; color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:18px;  line-height:1.3; text-align: right"> ' . date('F d,Y') . ' </td>
                                        </tr>
                                      </table>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td>                   
                                        <table width="100%" cellspacing="0" cellpadding="0">
                                            <tbody>
                                                <tr>
                                                    <td style="padding:15px 10px 15px 20px; background-color:#fff" width="50%" valign="top">
                                                        <table width="100%" cellspacing="0" cellpadding="0">
                                                            <tbody><tr>
                                                                <td style="border:5px solid #3239c2; padding:15px; height:150px" valign="top">
                                                                    <table width="100%" cellspacing="0" cellpadding="0">
                                                                        <tbody><tr>
                                                                            <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:20px;  line-height:1.3; padding-bottom:10px">
                                                                                <strong>Submitted From:</strong>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:15px;  line-height:1.3; padding-bottom:10px">
                                                                                <strong>IP Address:</strong> <br>
                                                                                <span>' . $basicinfo['ip_address'] . '</span> <br>
                                                                                <strong>IP Location:</strong> <br>
                                                                                <span>' . $basicinfo['country'] . '</span>
                                                                            </td>
                                                                        </tr>
                                                                        </tbody></table>
                                                                </td>
                                                            </tr>
                                                            </tbody></table>
                                                    </td>
                                                    <td style="padding:15px 20px 15px 10px; background-color:#fff" width="50%" valign="top">
                                                        <table width="100%" cellspacing="0" cellpadding="0">
                                                            <tbody>
                                                            <tr>
                                                                <td style="padding:15px; height:150px" valign="top">
                                                                    <table width="100%" cellspacing="0" cellpadding="0">
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:20px;  line-height:1.3; padding-bottom:10px">
                                                                                    <strong>Personal information:</strong>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:15px;  line-height:1.3; padding-bottom:10px">
                                                                                    <strong>Company Name:</strong> ' . $basicinfo['company_name'] . ' <br>
                                                                                    <strong>Contact Person:</strong> ' . $basicinfo['contact_person'] . '<br>
                                                                                    <strong>E-mail Address:</strong> <a href="mailto:' . $basicinfo['email_from'] . '">' . $basicinfo['email_from'] . '</a> <br>
                                                                                   
                                                                                    <strong>Phone No:</strong> ' . $basicinfo['phoneno'] . ' <br>
                                                                                    <strong>City / State:</strong> ' . $basicinfo['city'] . ' ,'.$basicinfo['state'].' <br>
                                                                                </td>
                                                                            </tr>                
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td style=" background-color:#fff; padding:0 20px">
                                      <table width="100%" cellspacing="0" cellpadding="0">
                                        <thead>
                                          <tr>
                                            <th colspan="2" style="text-align:center; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; background-color:#333333; color:#fff; padding:10px 15px; font-size:18px; line-height:1.3; font-weight: normal"><strong>'.ucwords(strtolower($vars['service'])).'</strong> Quote Request Details:</th>
                                          </tr>
                                        </thead>
                                        <tbody>';
                                        foreach ($vars as $k => $v) {
                                            if (is_array($v)) {
                                                foreach ($v as $kk => $vv) {
                                                    $kk = str_replace('_', ' ', $kk);
                                                    $kk = ucfirst($kk);
                                                    $out .= '<tr>
                                                            <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;  color:#333; padding:7px 12px; font-size:15px; line-height:1.3; border:1px solid #ccc; border-collapse:collapse; text-align: left">
                                                              <strong><span>' . $kk . '</span></strong><br>
                                                       
                                                              <span>' . $vv . '</span>
                                                            </td>
                                                          </tr>';
                                                    }
                                                } elseif (!empty($v)) {
                                                    $k = str_replace('_', ' ', $k);
                                                    $k = ucfirst($k);
                                                    $out .= '<tr>
                                                            <td style="font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;  color:#333; padding:7px 12px; font-size:15px; line-height:1.3; border:1px solid #ccc; border-collapse:collapse; text-align: left">
                                                              <strong><span>' . $k . '</span></strong><br>
                                                          
                                                              <span>' . nl2br($v) . '</span>
                                                            </td>
                                                      </tr>';
                                                            }
                                                        }
                                                        $out .= '</tbody>
                                                      </table>
                                                    </td>
                                                  </tr>                          
                                                  <tr>
                                                    <td style="height:10px;  background-color: #fff;">
                                            
                                                    </td>
                                            
                                                  </tr>
                                                  <tr>
                                                    <td style="background-color:#333; color:#fff; padding:10px 20px; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:12px; text-align: center; line-height: 1.7;">
                                                      Copyright @ Skynet Technologies. <br> 
                                                      <a href="https://www.skynetindia.info/faqs.html" title="FAQ" style="color: white; text-decoration: none;">FAQ</a> |  <a href="https://www.skynetindia.info/aboutus.html" title="About us" style="color: white; text-decoration: none;">About us</a> |  <a href="https://www.skynetindia.info/payment.html" title="How to Pay for Web Design India" style="color: white; text-decoration: none;">Payments</a>
                                                    </td>
                                                  </tr>
                                                </table>
                                              </td>
                                            </tr>
                                          </table>                             
                                        </body>     
                                        </html>';
                return $out;
            }

            $vars = get_form_data();
            $body = _build_fields($vars);
            //Auto Responser Function To Send Auto Respond
            $autoresponder_from = $your_email;

            $subject = "site feedback from skynetindia.info";

            $autoresponder_subject = "%subject% (autoresponse) from skynetindia.info";

            /*$autoresponder_message = <<<MSG

Dear %Contact Person%,



We are glade that you submitted your inquiry request to us.
One of our team member will assist you asap

With regards
Skynet Technologies

--

MSG;*/
            $autoresponder_message = '<!doctype html><html>
            <head>
              <meta charset="utf-8">
              <title>Auto Repsonse-  Skynet Technologies</title>
            </head>
            
            <body style="padding:0; margin:0;">
            
              <table width="100%" style="background-color:#f2f2f2; width:100%; ">
                <tr>
                  <td style="padding: 50px;">
                    <table width="600" align="center" cellpadding="0" cellspacing="0" style="max-width:600px; margin:0 auto">
                      <tr>
                        <td style="background-color:#fff; padding:15px 20px">
                          <table cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                              <td valign="middle" style="text-align:left;">
                                <a href="https://www.skynetindia.info/"><img src="https://www.skynetindia.info/images/skynet-technologies-logo.png" alt="Skynet Technologies" height="40" width="280" style="display:block"></a>
                              </td>
                              <td valign="middle" style="text-align: right">
                                <table align="right" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td style="color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:18px; text-align:right; line-height:1.3;">
                                      <a href="https://www.skynetindia.info/" title="Skynet Technologies" style="color: #000; text-decoration: none;"><b>www.skynetindia.info</b></a>
                                    </td>
                                  </tr>
                                </table>
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                      <tr>
                        <td style="background-color: #063992">
                          <table cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                              <td valign="middle" style="background-color:#3239c2; padding:7px 10px; color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:23px;  line-height:1.3;text-align: center">
                                Yippie!!! Your Quote Request Has Been Received! 
                            
                            </tr>
                          </table>
                        </td>
                      </tr>
                     
                      <tr>
                        <td>
                          <table width="100%" cellpadding="0" cellspacing="0">
                             <tbody><tr>
                              <td style="padding:20px 40px 0; background-color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:25px;  line-height:1.1; text-align: left; color: #063992; font-weight: bold;" width="100%" valign="top">
                                Dear ' . $vars['contact_person'] . ',
                              </td>
                            </tr>
                            <tr>
                              <td style="padding:20px 40px 0; background-color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:24px;  line-height:1.1; text-align: left; color: #0f73ee; font-weight: bold;" width="100%" valign="top">
                               Thank you so much for filling RFQ(Request for quote) form. 
                              </td>
                            </tr>
                            
                            
                             <tr>
                              <td style="padding:20px 40px 0; background-color:#fff; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:16px;  line-height:1.3; text-align: left; color: #000; font-weight: normal;" width="100%" valign="top">
                               We have received your quote for '.$vars['service'].' and We will get back to you soon. <br> <br> In case If you need any urgent assistance, please do not hesitate to email us at <a href="mailto:hello@skynetindia.info">hello@skynetindia.info</a> or chat with us on <a href="skype:skynetindia1?chat">Skype.</a> <br> <br><br>        
                              <strong>Best regards, </strong> <br>
                              <strong>Team, Skynet Technologies</strong>
                              </td>
                            </tr>
                            
                          </tbody></table>
                        </td>
                      </tr>
                      <tr >
                        <td style = "height:10px;  background-color: #fff;" >      
                        </td >                
                      </tr >
                      <tr >
                        <td style = "background-color:#333; color:#fff; padding:10px 20px; font-family: Segoe UI, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; font-size:12px; text-align: center; line-height: 1.7;" >Copyright @ Skynet Technologies . <br /><a href = "https://www.skynetindia.info/faqs.html" title = "FAQ" style = "color: white; text-decoration: none;" > FAQ</a > |<a href="https://www.skynetindia.info/aboutus.html" title = "About us" style = "color: white; text-decoration: none;" > About us </a > |  <a href = "https://www.skynetindia.info/payment.html" title = "How to Pay for Web Design India" style = "color: white; text-decoration: none;" > Payments</a >
                        </td >
                      </tr >
                    </table >
                </td >
              </tr>
             </table>
            </body>
            </html > ';

            function auto_respond($vars)
            {

                global $autoresponder_from, $autoresponder_message, $autoresponder_subject;

                /// replace all vars in message

                $msg = $autoresponder_message;

                preg_match_all(' /%(.+?)%/', $msg, $out);

                $s_vars = $out[1]; //field list to substitute

                foreach ($s_vars as $k)

                    $msg = str_replace("%$k%", $vars[$k], $msg);

                /// replace all vars in subject

                $subj = $autoresponder_subject;

                preg_match_all(' /%(.+?)%/', $subj, $out);

                $s_vars = $out[1]; //field list to substitute

                foreach ($s_vars as $k)

                    $subj = str_replace("%$k%", $vars[$k], $subj);

                //

                $_send_to = "$vars[name] <" . $vars[email_from] . ">";

                $_send_from = $autoresponder_from;

                $headers = "MIME-Version: 1.0" . "\r\n";
                $headers .= "Content-type:text/html;charset=UTF-8 \r\n";
                $headers .= "From: noreply@skynetindia.info \r\n";
                mail($_send_to, $subj, $msg, $headers);

            }

            if (empty($errors)) {
                $mail_php = new PHPMailer();
                $files = array(); //files (field names) to attach in mail

                if ($_FILES['Company_Document']['name'] != '') {
                    if (count($_FILES) && $attachment_enabled) {
                        $files = array_keys($_FILES);
                    }
                    if (count($files)) {

                        foreach ($files as $file) {

                            $file_name = $_FILES[$file]['name'];
                            $extarr = explode('.', $file_name);
                            $ext = end($extarr);
                            $file_type = $_FILES[$file]['type'];

                            $file_tmp_name = $_FILES[$file]['tmp_name'];
                            if ($_FILES[$file]['size'] > 4000000) {
                                echo json_encode(['status' => 402, "message" => "File size cannot be greater than 4mb"]);

                                exit;
                            } elseif (!in_array($ext, $fileallow)) {
                                $fileformat = implode(',', $fileallow);
                                echo json_encode(['status' => 402, "message" => "Please use only $fileformat format"]);
                                exit;
                            }


                            $file_cnt = "";
                            if ($file_name != '') {
                                if (!is_dir('file_inqury'))
                                    mkdir('file_inqury');
                                $file_name = 'file_inqury/' . $file_name;
                                move_uploaded_file($file_tmp_name, $file_name);
                                $mail_php->AddAttachment($file_name);

                            }
                        }

                        //  $mail .= "\n--$mime_delimiter--";

                    }
                } else {
                    $mail = $body;
                }

                $to = $your_email;
                $subject = "Enquiry From Skynet Technologies";
                $from = $_POST['email_from'];
                $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';

                //SMTP format begin

                $mail_php->IsSMTP();
                $mail_php->CharSet = 'UTF - 8';
                // 2 = messages only
                $mail_php->SMTPAuth = true;                  // enable SMTP authentication
                $mail_php->SMTPSecure = "ssl";                 // sets the prefix to the servier
                $mail_php->Host = "smtp.gmail.com";      // sets GMAIL as the SMTP server
                $mail_php->Port = '465';                   // set the SMTP port for the GMAIL server
                $mail_php->Username = "hr@skynetindia.info";  // GMAIL username
                $mail_php->Password = "sd&*(&*$&#";            // GMAIL password


                $mail_php->From = strip_tags($your_email);
                $mail_php->FromName = "skynet";

                $mail_php->AddAddress($your_email);//


                $mail_php->IsHTML(true);                                  // set email format to HTML

                /* $vars = get_form_data();*/
                $database_file = 'email . csv';
                $database_fields = ' * ';

                /*$str = _build_fields($vars);*/
                $mail_php->Subject = "Enquiry From Skynet Technologies";
                $mail_php->Body = ($body);
                //echo $mail->Body;
                $mail_php->AltBody = "test";
                //mail($to,'Enquiry From Skynet Technologies', $mail,$headers);
                // echo "<pre>";//echo $file_name;
                //  echo (htmlentities($mail->Body));exit();
                if (!$mail_php->send()) {

                    echo json_encode(['status' => 402, "message" => "Mailer Error: " . $mail_php->ErrorInfo]);
                    exit;
                } else {

                    if ($autoresponder_enabled)
                        auto_respond($vars);
                    //echo "Message has been sent";
                    if (count($files)) {
                        foreach ($files as $file) {
                            $file_name = $_FILES[$file]['name'];
                            $file_name = 'file_inqury/' . $file_name;
                            unlink($file_name);
                        }
                    }


                    echo json_encode(['status' => 200, "message" => "Done"]);
                }

            }
            function IsInjected($str)
            {
                $injections = array('(\n +)',
                    '(\r +)',
                    '(\t +)',
                    '(%0A +)',
                    '(%0D +)',
                    '(%08 +)',
                    '(%09 +)'
                );
                $inject = join(' | ', $injections);
                $inject = "/$inject/i";
                if (preg_match($inject, $str)) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }//end if
    else {
        # set the error code so that we can display it
        $error = $resp->error;
        echo json_encode(['status' => 402, "message" => "Invalid Captcha"]);
        exit;
    }
}//end if
else {
    # set the error code so that we can display it
    $error = $resp->error;
    echo json_encode(['status' => 402, "message" => "Captcha Failed"]);
    exit;
}
?>