<?php
ob_start();
session_start();

require 'vendor/autoload.php';
use GuzzleHttp\Client;
use \Mailjet\Resources;

// Aweber
const AWEBER_LIST_URL = 'https://api.aweber.com/1.0/accounts/1014494/lists/5820541/subscribers';
const AWEBER_TOKEN_URL = 'https://auth.aweber.com/oauth2/token';

// Globa
const GLOBA_ALL_LIST = 10210245;
const GLOBA_DOI_LIST = 10210246;


$link = "https://pdgxl.lovenights.net/c/da57dc555e50572d?s1=846&s2=109883&j6=1&s3=$_SESSION[sid]&click_id=$_SESSION[tracking]&s5=$_SESSION[cid]";

$urlEncodedString = $_GET[email_encoded];
$base64EncodedString = urldecode($urlEncodedString); // ZXhhbXBsZTFAZW1haWxhZGRyZXNzLmNvbQ==
$emailAddress = base64_decode($base64EncodedString); // example1@emailaddress.com

if ($_GET[add] == 1){
	$addstatus = addemail($_SESSION[email],$link);
   }else{
	$email = $emailAddress;
	if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
		$callemail = addtodb($emailAddress);
	}else{
		header("Location: $link");	
	}
}	   




if ($_GET[tracking] != "") 	setcookie('tracking', $_GET[tracking], time() + (86400 * 30), "/"); // 86400 = 1 day
if ($_GET[tag] != "") setcookie('tag', $_GET[tag], time() + (86400 * 30), "/");
if ($_GET[affid] != "") setcookie('affid', $_GET[affid], time() + (86400 * 30), "/");

if ($_GET[tracking] != "") $_SESSION[tracking] = $_GET[tracking];
if ($_GET[tag] != "") $_SESSION[tag] = $_GET[tag];
if ($_GET[affid] != "") $_SESSION[affid] = $_GET[affid];
if ($_GET[lp] != "") $_SESSION[lp] = $_GET[lp];
if ($_GET[re] != "") $_SESSION[re] = $_GET[re];
if ($_GET[campid] != "") $_SESSION[campid] = $_GET[campid];
if ($_GET[linkid] != "") $_SESSION[linkid] = $_GET[linkid];
if ($_GET['sid'] != "") $_SESSION['sid'] = $_GET['sid'];
if ($_GET[cid] != "") $_SESSION[cid] = $_GET[cid];
if ($_GET[p] != "") $_SESSION[p] = $_GET[p];
if ($_GET[email_encoded] != "") $_SESSION[email] = $emailAddress;




if ($_GET[a] == 1){
	//echo "$_SESSION[affid] 11 $_SESSION[tag]";
	//echo "<br>$_COOKIE[affid] 22 $_COOKIE[tag]";
	$affid = $_SESSION[affid];
	$tag = $_SESSION[tag];
	if ($_SESSION['tracking'] != "") $tag = $_SESSION['tracking'];
	if ($_SESSION['sid'] != "") $affid = $_SESSION['sid'];
	$value = 0.5;
	if ($affid == 6 )  $pixel = "http://main.exoclick.com/tag.php?goal=bcd0049c35799cdf57d06eaf2eb3cff6&tag=$tag";
	if ($affid == 16 ) $pixel = "https://tsyndicate.com/api/v1/cpa/action/$tag?value=$value&lead_code=$leadidid&key=WbCW2Vyncw1PD7iQHi74AxgQT04C6MzSO2DF";
	if ($affid == 3 )  $pixel = "https://prprocess.com/conversion/?user_id=4055&click_id=$tag&currency=USD&payout=$value";
	if ($affid == 4 )  $pixel = "https://ck.juicyads.com/ilikeitjuicy.php?u=11273&s2s=$tag&amount=$value&token=46bc9a3d4222fbcc9d88c7aa8ae7d1aa&data=52c69d19d4e4dc2a550005b33c960ad8";
	if ($affid == 7 )  $pixel = "https://ero-analytics.com/tracking/conv.php?cid=$tag&conv_type=a";
	if ($affid == 13 ) $pixel = "http://ads.adamoads.com/goal_tracker.php?goal=bca82e41ee7b0833588399b1fcd177c7&code=$tag";
	if ($affid == 5 )  $pixel = "http://serve.popads.net/cpixel.php?s2s=1&aid=d1919f5f6c957e762869ac492a113099&id=$tag&value=$value";
	if ($affid == 11 ) $pixel = "http://sconvtrk.com/conversion/20852100607f02aee0488298fc12ae8f5f56f335/?visitor_id=$tag&aid=104434";
	if ($affid == 22 ) $pixel = "http://ad.propellerads.com/conversion.php?aid=27243&pid=&tid=25202&visitor_id=$tag&value=$value";
	if ($affid == 23 ) $pixel = "http://main.exoclick.com/tag.php?goal=115fe3d68982c3c0b666ae3aaaa58213&tag=$tag";
	if ($affid == 24 ) $pixel = "http://peppx.ab4all.com/trackpixel/track?tid=$tag&amt=$value";
	if ($affid == 25 ) $pixel = "http://a.adskeeper.co.uk/postback?c=$tag&e=lead195446";
	if ($affid == 26 ) $pixel = "https://ct.popcash.net/click?aid=127826&clickid=$tag&payout=$value";
    if ($affid == 27 ) $pixel = "https://hilltopads.com/conversion/close/master?token=$tag";
	if ($affid == 226 || $affid == "") $pixel = "http://main.exoclick.com/tag.php?goal=41e61295266e16e43e52f7adc4debb71&tag=$tag";
	
	//$link = "https://pdgxl.lovenights.net/c/da57dc555e50572d?s1=846&s2=109883&j6=1&s3=$lp&click_id=$tag&s5=$affid";
	//$link = "https://www.socialspage.com/go/?email=$_GET[email]&sub=9&tags=$tag-$affid";
	$pixel_response = pixel_call($pixel);

	header("Location: $link");
}	

//SET Default on english 
$title = "Adult social network";
$headline = "Socialspage.com <span class=content__highlight> it is new and special service!</span> In few clicks you will start get quality requests from users to your inbox at <span class=content__highlight>$emailAddress</span>. You just need to pickup!";
$yes  = "Yes";
$no   = "No";

$an1a = "Yes";
$an1b = "No";
$an1c = "00:15";


$q1 = "This service is secret and a made specially for you. Do you agree to keep it in secret and not share with your friends?";
$q2 = "Please approve that $emailAddress is your correct email and you want to get users and offers there?";

$content[testafterlead] = "Click To Next Step";
//END of DEFUALT SETTING


if ($_GET[lng]== "en" || $_GET[lng]== ""){
$title = "Adult social network";
$headline = "Socialspage.com <span class=content__highlight> it is new and special service!</span> In few clicks you will start get quality requests from users to your inbox at <span class=content__highlight>$emailAddress</span>. You just need to pickup!";
$yes  = "Yes";
$no   = "No";

$an1a = "Yes";
$an1b = "No";
$an1c = "00:15";


$q1 = "This service is secret and a made specially for you. Do you agree to keep it in secret and not share with your friends?";
$q2 = "Please approve that $emailAddress is your correct email and you want to get users and offers there?";

$content[testafterlead] = "Click To Next Step";
}

if ($_GET[lng]== "es"){
$title = "Red social para adultos";
$headline = "Socialspage.com <span class=content__highlight> ¡es un servicio nuevo y especial! </span> Con unos pocos clics, comenzará a recibir solicitudes de calidad de los usuarios en su bandeja de entrada en <span class=content__highlight> $emailAddress </span>. ¡Solo necesitas recoger!";
$yes  = "Sí";
$no   = "No";


$q1 = "Este servicio es secreto y está hecho especialmente para ti. ¿Aceptas mantenerlo en secreto y no compartirlo con tus amigos?";
$q2 = "Por favor, apruebe que $emailAddress es su correo electrónico correcto y desea que los usuarios y las ofertas estén allí";
}

/*
if ($_GET[lng]== "ro" ){
$title = "Rețea socială pentru adulți";
$headline = "În <span class = content__highlight> rețeaua de sex </span> puteți face sex cu persoane care se bucură de sex fără angajament.";
$yes  = "Da";
$no   = "Nu";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Ai loc pentru o sesiune de sex?";
$q2 = "Când ai timp să faci dragoste?";


$text3 = "* Suntem de acord să nu dezvăluim identitatea utilizatorilor rețelei în public, să nu încărcăm fotografiile lor nud și să folosim prezervativul.";

$content[testafterlead] = "Cliquez pour l'étape suivante";
}

if ($_GET[lng]== "fr"){
$title = "Réseau social adulte";
$headline = "Dans le <span class=content__highlight> réseau de relations sexuelles </span>, vous pouvez faire l'amour avec des personnes qui aiment le sexe sans engagement. ";
$yes  = "Oui";
$no   = "Non";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Avez-vous de la place pour une session de sexe?";
$q2 = "Quand as-tu le temps de faire l'amour?";


$text3 = "* Nous acceptons de ne pas divulguer l'identité des utilisateurs du réseau en public, de ne pas télécharger leurs photos de nu et d'utiliser un préservatif.";

$content[testafterlead] = "Cliquez pour l'étape suivante";
}

if ($_GET[lng]== "de"){
$title = "Erwachsenes soziales Netzwerk";
$headline = "In diesem <span class=content__highlight>neuen Social Network für Sex</span> finden Sie Partner, die es lieben, Sex unverbindlich zu machen";
$yes  = "Ja";
$no   = "Nein";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Hast du Platz für eine Sex Session?";
$q2 = "Wenn du Zeit hast, Sex zu machen?";

$text3 = "";

$content[testafterlead] = "Klicken Sie für den nächsten Schritt";
}

if ($_GET[lng]== "es"){
$title = "Red social para adultos";
$headline = "En la <span class=content__highlight>social sex network</span>, puedes hacer el amor a las personas que aman el sexo sin compromiso. ";$waiting = "Please wait, we calculate the odds ";
$yes  = "Sí";
$no   = "No";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "¿Tienes espacio para la sesión de sexo?";
$q2 = "¿Cuándo tienes tiempo para hacer el sexo?";


$content[testafterlead] = "Click To Next Step";
}



if ($_GET[lng]== "no"){
$title = "Voksent sosialt nettverk";
$headline = "I <span class=content__highlight>sosiale kjønnsnettverket</span> kan du elske folk som elsker sex uten forpliktelse. ";
$waiting = "Vennligst vent, vi beregner oddsen";
$yes  = "Ja";
$no   = "Nei";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";

$q1 = "Har du plass til sex-økt?";
$q2 = "Når du har tid til å lage sex?";

$content[testafterlead] = "Klikk til neste trinn";
}


if ($_GET[lng]== "dk"){
$title = "Voksne sociale netværk";
$headline = "I <span class=content__highlight> sociale kønnetværk </span> kan du elske folk, der elsker sex uden engagement. ";
$yes  = "Ja";
$no   = "Ingen";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Har du plads til sex-session?";
$q2 = "Når har du tid til at lave sex?";

$content[testafterlead] = "Klik til næste trin";
}

if ($_GET[lng]== "hr"){
$title = "Društvena mreža za odrasle";
$headline = "U <span class=content__highlight>društvenoj seksualnoj mreži</span> možete voditi ljubav s ljudima koji vole seks bez predanosti.";
$yes  = "Da";
$no   = "Ne";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Imate li mjesta za seks?";
$q2 = "Kada imate vremena za seks?";

$content[testafterlead] = "Kliknite na sljedeći korak";
}


if ($_GET[lng]== "sv"){
$title = "Vuxen socialt nätverk";
$headline = "I <span class=content__highlight>sociala könnätverket</span> kan du älska människor som älskar sex utan engagemang. ";$yes  = "Ja";
$no   = "Nej";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Har du plats för sex-session?";
$q2 = "När du har tid att göra sex?";

$content[testafterlead] = "Klicka till nästa steg";
}


if ($_GET[lng]== "fi"){
$title = "Aikuisten sosiaalinen verkosto";
$headline = "<Span class=content__highlight> sosiaalisen sukupuolen verkostossa </span> voit rakastaa ihmisiä, jotka rakastavat sukupuolta ilman sitoutumista. ";
$yes  = "Joo";
$no   = "Ei";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Onko sinulla tilaa sukupuoliistuntoon?";
$q2 = "Kun sinulla on aikaa tehdä seksiä?";

$content[testafterlead] = "Valitse Seuraava vaihe";
}



if ($_GET[lng]== "nl"){
$title = "Volwassen sociaal netwerk";
$headline = "In het <span class=content__highlight> sociale-seksnetwerk </span> kun je de liefde bedrijven met mensen die van seks houden zonder commitment. ";
$yes  = "Ja";
$no   = "Nee";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Heb je ruimte voor een sekssessie?";
$q2 = "Wanneer heb je tijd om seks te maken?";

$content[testafterlead] = "Klik op Volgende stap";
}


if ($_GET[lng]== "cs"){
$title = "Sociální síť pro dospělé";
$headline = "V kategorii <span class=content__highlight>sociální sex</span> můžete milovat lidi, kteří milují sex bez závazku. ";
$yes  = "Ano";
$no   = "Ne";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Máte prostor pro sexuální setkání?";
$q2 = "Když máte čas dělat sex?";

$content[testafterlead] = "Klepněte na tlačítko Další krok";
}


if ($_GET[lng]== "pt"){
$title = "Rede social adulta";
$headline = "Na <span class=content__highlight>rede social de sexo</span>, você pode fazer amor com pessoas que amam sexo sem compromisso. ";
$yes  = "Sim";
$no   = "Não";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Você tem espaço para sessão de sexo?";
$q2 = "Quando você tem tempo para fazer sexo?";

$content[testafterlead] = "Clique para a próxima etapa";
}


if ($_GET[lng]== "it"){
$title = "Social network per adulti";
$headline = "Nella <span class=content__highlight>rete di social network</span>, puoi fare l'amore con le persone che amano il sesso senza impegno. ";
$yes  = "Sì";
$no   = "No";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Hai spazio per il sesso?";
$q2 = "Quando hai tempo di fare sesso?";

$content[testafterlead] = "Fare clic sul passaggio successivo";
}



if ($_GET[lng]== "ru"){
$title = "Социальная сеть для взрослых";
$headline = "В <span class=content__highlight>социальной секс-сети</span> вы можете заниматься любовью с людьми, которые любят секс без обязательств. ";
$yes  = "да";
$no   = "нет";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "У вас есть место для секса?";
$q2 = "Когда у тебя есть время заняться сексом?";

$content[testafterlead] = "Нажмите к следующему шагу";
}


if ($_GET[lng]== "hu"){
$title = "Felnőtt szociális hálózat";
$headline = "A <span class=content__highlight>társadalmi szex hálózatban</span> szerethetsz olyan embereket, akik elkötelezettség nélkül szeretik a szexet. ";
$yes  = "Igen";
$no   = "Nem";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Van helyed szexuális foglalkozásra?";
$q2 = "Ha van ideje szexelni?";

$content[testafterlead] = "Kattintson a Tovább gombra";
}

if ($_GET[lng]== "sk"){
$title = "Sociálna sieť pre dospelých";
$headline = "V kategórii <span class=content__highlight> sociálna sexuálna sieť </span> môžete milovať ľudí, ktorí milujú sex bez záväzku. ";
$yes  = "Áno";
$no   = "žiadny";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Máte priestor na sex?";
$q2 = "Keď máte čas na sex?";

$content[testafterlead] = "Kliknite na ďalší krok";
}

if ($_GET[lng]== "pl"){
$title = "Dorosła sieć społecznościowa";
$headline = "W <span class=content__highlight>sieci społecznościowej</span> możesz kochać ludzi, którzy kochają seks bez zaangażowania. ";
$yes  = "Tak";
$no   = "Nie";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Czy masz miejsce na seks?";
$q2 = "Kiedy masz czas na seks?";

$content[testafterlead] = "Kliknij, aby przejść do następnego kroku";
}

if ($_GET[lng]== "sl"){
$title = "Socialna mreža za odrasle";
$headline = "V <span class=content__highlight>družbeni spolni mreži</span> lahko ljubezen do ljudi, ki ljubijo seks brez predanosti. ";
$yes  = "Da";
$no   = "Ne";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Imate prostor za seks?";
$q2 = "Kdaj imaš čas za seks?";

$content[testafterlead] = "Kliknite Za naslednji korak";
}


if ($_GET[lng]== "et"){
$title = "Täiskasvanute sotsiaalne võrgustik";
$headline = "<Span class=content__highlight>sotsiaalse seksi võrgustikus</span> saate armastada inimesi, kes armastavad seksi ilma kohustusteta. ";
$yes  = "Jah";
$no   = "Ei";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Kas teil on ruumi seksiseansi jaoks?";
$q2 = "Kui teil on aega seksida?";

$content[testafterlead] = "Klõpsake järgmisele sammule";
}

if ($_GET[lng]== "mt"){
$title = "Netwerk soċjali għall-adulti";
$headline = "Fin- <span class=content__highlight>network tas-sess soċjali</span>, tista 'tagħmel l-imħabba lil nies li jħobbu s-sess mingħajr impenn. ";
$yes  = "Iva";
$no   = "Le";

$an1a = "20:00";
$an1b = "22:30";
$an1c = "00:15";


$q1 = "Għandek spazju għas-sess?";
$q2 = "Meta għandek il-ħin biex tagħmel is-sess?";

$content[testafterlead] = "Ikklikkja Biex Pass Li Jmiss";
}



*/
//$sid = "$_GET[sid]";
//if ($sid == 226)  $pixelclick = "http://main.exoclick.com/tag.php?goal=8a0790a10f8836c02212d5a576278ba1&tag=$_GET[tracking]";
//if ($sid == 6)  $pixelclick = "http://main.exoclick.com/tag.php?goal=c2383e4dca61bf3b6f174ba5df1172b0&tag=$_GET[tracking]";

$pixelclick = "http://main.exoclick.com/tag.php?goal=8a0790a10f8836c02212d5a576278ba1&tag=$_GET[tracking]";

$addemaillink = "";
?>

<!DOCTYPE html>
<html lang="<?if ($_GET[lng] != "") echo $_GET[lng]?>">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title><? echo $title?></title>
	<link rel="stylesheet" href="css/styles.min.css">
	<script>
		function fire() {
			var img = document.createElement("img");
			img.setAttribute("src", "<?echo $pixelclick?>");
			document.getElementById(img).width = "1";
			document.getElementById(img).height = "1";
			/* set other attributes here */
			document.body.appendChild(img);
		}
	</script>
	
</head>

<body>
	<div class="wrap">
		<div class="bg"></div>

		<div class="content">
      <!--<img src="images/333man.png" alt="" class="content__man">
      <img src="images/..money-left.png" alt="" class="content__money content__money_left">
      <img src="images/money-right.png" alt="" class="content__money content__money_right">-->
	  <?if ($_GET[a] == 1){?>
	  <div class="content__l1">
      	<div class="content__s content__s_active">
      		Vă rugăm să confirmați adresa de e-mail și să faceți clic aici pentru a trece la următorul pas
			<br><br>
			<!--Response:<?echo $pixel_response?><br>pixel:<?echo $pixel?><br>affid:<?echo $affid?><br>tag:<?echo $tag?>-->
			<a href="<?echo $link?>"><button type="button" class="content__button content__button_no content__button_go" data-step="2">Urmatorul pas</button></a>
      	</div>
      </div> 
	<?}else{?>	  
      <div class="content__l1">
      	<div class="content__s content__s_active">
      		<? echo $headline?>
      	</div>
      </div>
	  
      <!-- /.content__l1 -->
      <div class="content__l2">

      	<div class="content__s content__s_active">
      		<span class="content__l2-small"><center><? echo $exp?></span>
      			<div class="content__timer"> </div>
      		</div>
      		<!-- /.content__s_1 -->


      	</div>
      	<!-- /.content__l2 -->
      	<div class="content__l3">

      		<div class="content__s content__s_active content__s_1"><? echo $q1?>
      			<div class="content__buttons">
      				<button type="button" class="content__button content__button_yes content__button_go" data-step="1" onClick="fire();"><? echo $yes?></button>
      				<button type="button" class="content__button content__button_no content__button_go" data-step="1" onClick="fire();"><? echo $no?></button>
      			</div>
      			<!-- /.content__buttons -->
      		</div>
      		<!-- /.content__s_1 -->


      		<div class="content__s content__s_2"><? echo $q2?>
      			<div class="content__buttons">
      				<!--<button type="button" class="content__button content__button_yes content__button_go" data-step="2"><? echo $an1a?></button></a>
      				<button type="button" class="content__button content__button_no content__button_go" data-step="2"><? echo $an1b?></button></a>-->
					<a href="?add=1"><button type="button" class="content__button content__button_yes content__button_go" data-step="2"><? echo $yes?></button>
      				<a href="<?echo $link?>"><button type="button" class="content__button content__button_no content__button_go" data-step="2"><? echo $no?></button></a>
      			</div>
      			<!-- /.content__buttons -->
      		</div>
      		<!-- /.content__s_2 -->
			
				
		
      	
      		<!--	<?//echo $waiting?>Veuillez entrer un pseudonyme et une date de naissance pour continuer
				
      			<form action="" method="post" class="content__form">
      				<div class="content__input-group">
					
					    <div>
						<img src="images/sex.svg" alt="" class="content__icn-envelope">
						 <select name="sex" class="content__select">
								<option value="1" selected>Ton sexe - je suis un homme</option>
								<option value="2">Ton sexe - je suis une femme</option>
						 </select>
      					</div>
					
      					<div>
      						<img src="images/envelope-regular.svg" alt="" class="content__icn-envelope">
      						<input required type="email" name="email" value="" placeholder="Entrez email ici" class="content__input">
      					</div>
						
						<div>
      						<img src="images/password.svg" alt="" class="content__icn-envelope">
      						<input required type="password" name="password" value="" placeholder="Mot de passe" class="content__input">
      					</div>

      					<div>
      					<img src="images/user-regular.svg" alt="" class="content__icn-envelope">
      					<input required type="text" name="screenname" value="" placeholder="Entrez un pseudo ici" class="content__input"> 
						</div>
						
						
      				</div>

      				<div>
	
	        		<select name="y" class="content__select">
			            <option value="2000">2000</option>
			            <option value="1999">1999</option>
			            <option value="1998">1998</option>
			            <option value="1997">1997</option>
						<option value="1996">1996</option>
						<option value="1995">1995</option>
						<option value="1994">1994</option>
						<option value="1993">1993</option>
						<option value="1992">1992</option>
						<option value="1991">1991</option>
						<option value="1990">1990</option>
						<option value="1989">1989</option>
						<option value="1988">1988</option>
						<option value="1987">1987</option>
						<option value="1986">1986</option>
						<option value="1985">1985</option>
						<option value="1984">1984</option>
						<option value="1983">1983</option>
						<option value="1982">1982</option>
						<option value="1981">1981</option>
						<option value="1980" selected>1980</option>
						<option value="1979">1979</option>
						<option value="1978">1978</option>
						<option value="1977">1977</option>
						<option value="1976">1976</option>
						<option value="1975">1975</option>
						<option value="1974">1974</option>
						<option value="1973">1973</option>
						<option value="1972">1972</option>
						<option value="1971">1971</option>
						<option value="1970">1970</option>
						<option value="1969">1969</option>
						<option value="1968">1968</option>
						<option value="1967">1967</option>
						<option value="1966">1966</option>
						<option value="1965">1965</option>
						<option value="1964">1964</option>
						<option value="1963">1963</option>
						<option value="1962">1962</option>
						<option value="1961">1961</option>
						<option value="1960">1960</option>
						<option value="1959">1959</option>
						<option value="1958">1958</option>
						<option value="1957">1957</option>
						<option value="1956">1956</option>
						<option value="1955">1955</option>
						<option value="1954">1954</option>
						<option value="1953">1953</option>
						<option value="1952">1952</option>
						<option value="1951">1951</option>
						<option value="1950">1950</option>
						<option value="1949">1949</option>
						<option value="1948">1948</option>
						<option value="1947">1947</option>
						<option value="1946">1946</option>
						<option value="1945">1945</option>
						<option value="1944">1944</option>
						<option value="1943">1943</option>
						<option value="1942">1942</option>
						<option value="1941">1941</option>
						<option value="1940">1940</option>
						<option value="1939">1939</option>
						<option value="1938">1938</option>
						<option value="1937">1937</option>
						<option value="1936">1936</option>
						<option value="1935">1935</option>
						<option value="1934">1934</option>
						<option value="1933">1933</option>
						<option value="1932">1932</option>
						<option value="1931">1931</option>
						<option value="1930">1930</option>
						<option value="1929">1929</option>
						<option value="1928">1928</option>
						<option value="1927">1927</option>
						<option value="1926">1926</option>
						<option value="1925">1925</option>
						<option value="1924">1924</option>
						<option value="1923">1923</option>
						<option value="1922">1922</option>
						<option value="1921">1921</option>
						<option value="1920">1920</option>
						<option value="1919">1919</option>
						<option value="1918">1918</option>
						<option value="1917">1917</option>
						<option value="1916">1916</option>
						<option value="1915">1915</option>
						<option value="1914">1914</option>
						<option value="1913">1913</option>
						<option value="1912">1912</option>
						<option value="1911">1911</option>
						<option value="1910">1910</option>
						<option value="1909">1909</option>
						</select>
						
					<select name="m" class="content__select">
						<option value="1" selected>1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
			        </select>
      					
						
					<select name="d" class="content__select">
						<option value="1" selected>1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
						<option value="13">13</option>
						<option value="14">14</option>
						<option value="15">15</option>
						<option value="16">16</option>
						<option value="17">17</option>
						<option value="18">18</option>
						<option value="19">19</option>
						<option value="20">21</option>
						<option value="22">22</option>
						<option value="23">23</option>
						<option value="24">24</option>
						<option value="25">25</option>
						<option value="26">26</option>
						<option value="27">27</option>
						<option value="28">28</option>
						<option value="29">29</option>
						<option value="30">30</option>
						<option value="31">31</option>
			        </select>
					
					
						
      					</div>
      					<br>
      					<!-- /.content__input-group 
						<input type="hidden" name="tag" value="<? echo $_GET[tag] ?>">
						<input type="hidden" name="affid" value="<? echo $_GET[affid] ?>">
						<input type="hidden" name="lp" value="<? echo $_GET[lp] ?>">
      					<button type="submit" name="submit" class="content__button content__button_submit">Continuer sur le site</button>
      				
					<br>
						<?echo $text3?>
					
					</form>

      				<!-- /AWeber Web Form Generator 3.0.1 -->
		</div><!--
          <form action="http://rhuilithe.ru/d/sample-form.php" method="post" class="content__form">
            <div class="content__input-group">
              <img src="images/mail.svg" alt="" class="content__icn-envelope">
              <input required type="email" name="email" value="" placeholder="Enter your mail here" class="content__input">
            </div>
            <!-- /.content__input-group 
            <button type="submit" name="submit" class="content__button content__button_submit">SEND</button>
          </form>
          End Of form-->
			<?}?>
        </div>
        <!-- /.content__s_3 -->

      </div>
      <!-- /.content__l3 -->
    </div>
    <!-- /.content -->
  </div>
  <!-- /.wrap -->
  <script src="js/scripts.min.js"></script>
  <script type="text/javascript">


    // URL for redirection after the form is submitted
    var redirectURL = '<? echo $link?>';



    $('.content__form').on('submit', function(event) {
    	if ($('.content__input').is(':invalid')) {
    		event.preventDefault();
    	} else {
    		event.preventDefault();
    		$.ajax({
    			url: $(this).attr('action'),
    			data: $(this).serialize(),
    			method: 'POST',
    			success: function(data) {
    				window.location.href = redirectURL;
    			}
    		});
    	}
    });
  </script>
</body>

</html>


<?
//Function Area
//======================================================================
function pixel_call($request_url) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $request_url);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $response = curl_exec($ch);
  curl_close($ch);

  return $response;
}

//DateLand =================================================
Function calldateland($email,$dob,$tag,$password,$sex,$screenname,$tagid){
	$a = explode("@",$email);
	$time  = time();
	$host  = "yazizim.com";
	$name  = $screenname;
	if ($screenname == "" )$name  = $a[0];
	$ip    = $_SERVER['REMOTE_ADDR'];
	$tid   = $tagid;
	$h     = md5($email.'55z$4sciyu6y99@G340');
	$url = "https://bogdot.co.il/api/get.php?apiver=1.0&ts=$time&service=registration&host=$host&email=$email&name=$name&gender=$sex&dob=$dob&ip=$ip&tid=$tid&h=$h&tag=$tag&password=$password";
	$ch = curl_init( $url );
	curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
	curl_setopt( $ch, CURLOPT_HEADER, 0);
	curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

	$response = json_decode(curl_exec( $ch ));

	if ($response->success) {    
		$status[url] = $response->redirect;
		$status[success] = $response->success;
		return $status;   
	}
}



Function calldf($siteurl,$email,$password,$screenname){
	$url = 'http://www.'.$siteurl.'/remote/registration/';
	$myvars = 'email=' . $email . '&password=' . $password . '&screenname=' . $screenname;

	$ch = curl_init( $url );
	curl_setopt( $ch, CURLOPT_POST, 1);
	curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
	curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt( $ch, CURLOPT_MAXREDIRS, 2);
	curl_setopt( $ch, CURLOPT_HEADER, 0);
	curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

	$response = curl_exec( $ch );
	echo $response;
	$a = explode("|",$response);
	echo "<br>";
	echo "$a[0]<br>$a[1]<br>$a[1]";

	return $a;
}

// **** AWEBER ****
function getCollection($client, $accessToken, $url) {
    $collection = array();
    while (isset($url)) {
        $request = $client->get($url,
            ['headers' => ['Authorization' => 'Bearer ' . $accessToken]]
        );
        $body = $request->getBody();
        $page = json_decode($body, true);
        $collection = array_merge($page['entries'], $collection);
        $url = isset($page['next_collection_link']) ? $page['next_collection_link'] : null;
    }
    return $collection;
}

function aweberRefresToken($client) {
    $credentials = parse_ini_file('credentials.ini');
    $clientId = $credentials['clientId'];
    $clientSecret = $credentials['clientSecret'];
    $response = $client->post(
        AWEBER_TOKEN_URL, [
            'auth' => [
                $clientId, $clientSecret
            ],
            'json' => [
                'grant_type' => 'refresh_token',
                'refresh_token' => $credentials['refreshToken']
            ]
        ]
    );
    $body = $response->getBody();
    $newCreds = json_decode($body, true);
    $accessToken = $newCreds['access_token'];
    $refreshToken = $newCreds['refresh_token'];

    $fp = fopen('credentials.ini', 'wt');
    fwrite($fp,
    "clientId = {$clientId}
    clientSecret = {$clientSecret}
    accessToken = {$accessToken}
    refreshToken = {$refreshToken}");
    fclose($fp);
    chmod('credentials.ini', 0600);
}

function aweberSubscribe($email, $name, $date, $geo, $lng, $link) {

    // Create a Guzzle client
	$client = new GuzzleHttp\Client();
	
	// Refresh token
    aweberRefresToken($client);

    // Load credentials
    $credentials = parse_ini_file('credentials.ini');
    $accessToken = $credentials['accessToken']; 
       
    $data = array(
        'email' => $email,
        'name' => $name,
        'update_existing' => "true",
        'custom_fields' => array(
            'date' => $date,
            'geo' => $geo,
            'lng' => $lng,
            'link' => $link,
        ),
    );
    $client->post(AWEBER_LIST_URL, [
        'json' => $data, 
        'headers' => ['Authorization' => 'Bearer ' . $accessToken]
    ]);
}

// **** MAILJET ****
function mailjetSubscribe($list, $email, $name, $date, $geo, $lng, $link) {

    // Load settings
    $credentials = parse_ini_file('mailjet.ini');
    $apiKey = $credentials['apiKey'];
    $apiSecret = $credentials['apiSecret'];

    // Mailjet client
    $mj = new \Mailjet\Client($apiKey, $apiSecret);

    $body = [
        'IsExcludedFromCampaigns' => "false",
        'Email' => $email,
        'Name' => $name
    ];
    $response = $mj->post(Resources::$Contact, ['body' => $body]);

    $response = $mj->get(Resources::$Contact, ['id' => urlencode($email)]);
    if ($response->success()) {
        $contact = $response->getData()[0];

        // Save additional data
        $body = [
            'Data' => [
                [
                    'Name' => "date",
                    'Value' => $date
                ],
                [
                    'Name' => "geo",
                    'Value' => $geo
                ],
                [
                    'Name' => "lng",
                    'Value' => $lng
                ],
                [
                    'Name' => "link",
                    'Value' => $link
                ]
              ]
        ];

        $response = $mj->put(Resources::$Contactdata, ['id' => $contact['ID'], 'body' => $body]);
        if ($response->success()) {

            // Add to list
            $body = [
                'ContactsLists' => [
                    [
                        'Action' => "addforce",
                        'ListID' => $list
                    ],
                
                ]
            ];
            $response = $mj->post(Resources::$ContactManagecontactslists, ['id' => $contact['ID'], 'body' => $body]);
        }
    }
}


Function addtodb($email){
	
	$servername = "localhost";
	$database = "socialsp_leads";
	$username = "socialsp_lead2";
	$password = "US;lZHn[[7@r";

	// Create connection
	$conn = mysqli_connect($servername, $username, $password, $database);
	// Check connection
	if (!$conn) {
		die("Connection failed: " . mysqli_connect_error());
	}
	
		$exist = 0;
		//echo $email;
		$result = mysqli_query($conn,"SELECT * FROM leads WHERE email='$email' LIMIT 1"); 
		$row = mysqli_fetch_array($result); 
		if($row[email] == $email) $exist = 1;
		//print("<pre>".print_r($arry,true)."</pre>");

		//echo $exist;
		


	if ($exist == 0){
	$ip   = $_SERVER['REMOTE_ADDR'];
	$geo  = geoip_country_code_by_name($ip);
	$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
	$lng  = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
	
			$sql = "INSERT INTO leads (email,geo,lng,ip,link) VALUES ('$email','$geo','$lng','$ip','$link')";
			if (mysqli_query($conn, $sql)) {
				//echo 1;
			} else {
				//echo 0;
				//echo "Error: " . $sql . "<br>" . mysqli_error($conn);
			}

		}else{
			$sql = "UPDATE leads SET count=count+1 WHERE email='$email' LIMIT 1";
			if ($conn->query($sql) === TRUE) {
			//echo "Record updated successfully";
			} else {
			//echo "Error updating record: " . $conn->error;
			}	
		}	
		
	mysqli_close($conn);	

	mailjetSubscribe(GLOBA_ALL_LIST, $email, $name, date("Y-m-d H:i:s"), $geo, $lng, $link);
	
}

function addemail($email,$link) {
	
	$servername = "localhost";
	$database = "socialsp_leads";
	$username = "socialsp_lead2";
	$password = "US;lZHn[[7@r";

	// Create connection
	$conn = mysqli_connect($servername, $username, $password, $database);
	// Check connection
	if (!$conn) {
		die("Connection failed: " . mysqli_connect_error());
	}

	$sql = "UPDATE leads SET status=1 WHERE email='$email' LIMIT 1";
			if ($conn->query($sql) === TRUE) {
			//echo "Record updated successfully";
			$tag = $_SESSION['tracking'];
			$pixel = "http://main.exoclick.com/tag.php?goal=41e61295266e16e43e52f7adc4debb71&tag=$tag";
			$pixel_response = pixel_call($pixel);
			
			$result = mysqli_query($conn,"SELECT * FROM leads WHERE email = '$email' LIMIT 1"); 
				while($data = mysqli_fetch_assoc($result)){
					//mailjetSubscribe(GLOBA_DOI_LIST, $email, $name, $data['date'], $data['geo'], $data['lng'], $data['link']);
					//aweberSubscribe($email, $name, $data['date'], $data['geo'], $data['lng'], $data['link']);
				
				}
			
			header("Location: $link");
			} else {
			header("Location: $link");
			//echo "Error updating record: " . $conn->error;
			}
	

	
}

?>