File "submit_ebook_pt.php"

Full Path: /home/ptgoldenvisa/public_html/investorvisa/submit_ebook_pt.php
File size: 3.83 KB
MIME-type: text/x-php
Charset: utf-8

<?php
require('vendor/autoload.php'); // recaptcha library
$recaptcha_secret="6Le8QTwUAAAAAAB1QEY8leJJy6lryj4XRn_DPj5Q";

if(isset($_POST['g-recaptcha-response'])) {
		$recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret);
		$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
		if ($resp->isSuccess()) {
		    // verified!
		    // if Domain Name Validation turned off don't forget to check hostname field
		    // if($resp->getHostName() === $_SERVER['SERVER_NAME']) {  }
$email = $_POST['ebook_email'];$Telefone = $_POST['ebook_phone'];$origin = $_POST['ebook_origin'];$ipaddress = $_POST['ebook_ipaddress'];

	$dbuser = "ptgolden_diogo";
	$dbpass = "DiogoCamara2017!";
	$dbname = "ptgolden_contacts";

	$from = "Investor Visa.PTGoldenVisa <[email protected]>";
	$to = "[email protected]";
	$to = strtolower($email);
	$subject = 'Get Residence Permit and Citizenship - Ebook - Portugal.';

	$message = '<p>Dear Investor,</p>
	<p>We are glad you are interested in our E-book - How to Obtain Residence Permit in Europe. To download the ebook you just need to click at the link bellow.</p>
	<p><a href="http://www.ptgoldenvisa.com/Portugal_Visa_Ebook.pdf">HOW TO OBTAIN VISA AND RESIDENCE PERMIT IN PORTUGAL</a></p>
	  <p>For further information, please click the link below to schedule a call with our managers:</p>
    <p><a href="http://www.ptgoldenvisa.com/scheduleyourcall/"></a></p>
	<p><br/>Our team is specialised in obtaining Residence Visa and Passport in Portugal which allows you to freely travel, study or live in any of the European Countries belonging to Schengen space.</p>
	<p><br /><br />We welcome you to schedule a meeting by phone or Skype in order to clarify your doubts or guide you through all Visa process. We will try to contact you in order to help you with the process.</p><p><br /><br />Kind Regards,</p><p><br /><br />David Machado</p><p><b>PTGoldenVisa</b></p>
<p>Avenida Engenheiro Duarte Pacheco, Edf. Amoreiras Torre 2, Piso 9, Sala 10</p>
<p>1070-103 Lisboa - Portugal</p><p><b>Email:</b>[email protected]</p><p><b>Tel.</b>+351 962284098</p><p><b>Website:</b> www.ptgoldenvisa.com</p><p><b>Skype:</b> davidsilvamachado</p><p><p><b></b></p>';
	
	$notific_to = '[email protected]';
	$notific_subject = ucwords(strtolower($email)).' - New Request for Information Visa Ebook';
	$notific_message = '<p>Hello.</p><p>A request for information just entered the database'.$db_nome.'.  </p><p>telefone -&gt; '.$Telefone.'.<br>Email &nbsp;-&gt; '.strtolower($email).'.<br>Ip &nbsp;-&gt;<a href="https://check-host.net/ip-info?host='.strtolower($ipaddress).'">'.strtolower($ipaddress).'<br></p>';

$dbhost = "localhost";$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');mysql_select_db($dbname);$todayDate = date("Y-m-d g:i a");$currentTime = time($todayDate);$hours_to_incriase = 7;$timeAfterOneHour = $currentTime+(60*$hours_to_incriase)*60;
//ebook (id, nome, telefone, data, email)
$query2 = mysql_query("INSERT INTO `ptgolden_contacts`.`ebook` (`email` ,`telefone` ,`data` ,`origin`,`ipaddress`) VALUES ('".$email."', '".$Telefone."', '".date("Y-m-d H:i:s",$timeAfterOneHour)."', '".$origin."', '".$ipaddress."');");
$xheaders = "";$xheaders .= "From: $from\n";$xheaders .= "X-Sender: <$from>\n";$xheaders .= "X-Mailer: PHP\n";$xheaders .= "X-Priority: 1\n";$xheaders .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";mail($to, $subject, $message, $xheaders,'-f [email protected]');mail($notific_to, $notific_subject, $notific_message, $xheaders,'-f [email protected]');header('location: indexok.php');
            } else {
		    $errors = $resp->getErrorCodes();
		    if(!empty($errors)){
			die('Recaptcha validation error: '.implode(',',$errors));
		    }
		}
}
else{
	die('Recaptcha validation error.');
}
?>