· 8 years ago · Jan 24, 2018, 10:30 AM
1<?php
2
3 $FirstName=$_POST['FirstName'];
4 $LastName=$_POST['LastName'];
5 $email=$_POST['email'];
6 $phone=$_POST['phone'];
7 $Title=$_POST['Title'];
8 $Description=$_POST['Description'];
9
10 $captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response']:'';
11
12 $secret_key = 'xxxxxxxxxxxxx';
13
14 if ($captcha != '') {
15 $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secret_key) . '&response=' . $captcha;
16 $recaptcha = file_get_contents($url);
17 $recaptcha = json_decode($recaptcha, true);
18 if (!$recaptcha['success']) {
19 header('Location: http://xxxxxx.com/pages.php?status=captchafail');
20 } else {
21 ?>
22
23 <form id="jsform" name="insightly_web_to_lead" action="https://crm.na1.insightly.com/WebToLead/Create" method="post">
24 <input type="hidden" name="formId" value="xxxxxxxxxxxxxxxxxx" />
25 <input style="display: none" id="insightly_firstName" name="FirstName" type="text" value="<?php echo $FirstName; ?>"/>
26 <input style="display: none" id="insightly_lastName" name="LastName" type="text" value="<?php echo $LastName; ?>"/>
27 <input style="display: none" id="insightly_organization" name="OrganizationName" type="text" value="<?php echo $OrganizationName; ?>"/>
28 <input style="display: none" id="insightly_Email" name="email" type="text" value="<?php echo $email; ?>"/>
29 <input style="display: none" id="insightly_Phone" name="phone" type="text" value="<?php echo $phone; ?>"/>
30 <input style="display: none" id="insightly_Title" name="Title" type="text" value="Contact From Website - <?php echo $Title; ?>"/>
31 <textarea style="display: none" id="insightly_Description" name="Description" type="text"><?php echo $Description; ?></textarea>
32 <input type="hidden" id="insightly_ResponsibleUser" name="ResponsibleUser" value="xxxxxx"/>
33 <input type="hidden" id="insightly_LeadSource" name="LeadSource" value="xxxxxxxxxxxx"/>
34 <input style="display: none" type="submit" value="Submit">
35 </form>
36
37 <div style="position: absolute; top: 50%; left: 50%;"><img src="loading-gear.gif" /></div>
38
39 <script type="text/javascript">
40 document.getElementById('jsform').submit();
41 </script>
42
43 <?php
44 }
45} else {
46 header('Location: http://xxxxxxxx.com/pages.php?status=captchafail');
47 }
48?>