TeleQom.org website (https://teleqom.org)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
TeleQom.org/php/newsletter.php

25 lines
1.0 KiB

<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/config/PRIVATE/NEWSLETTER.php';
$lang_folder = $_GET['newsletter-language']=="fr"?"/pages/fr/":"/pages/en/";
$contact_form_url = $_GET['newsletter-language']=="fr"?$_ENV['newsletter_url_fr']:$_ENV['newsletter_url_en'];
if(!str_contains($_GET['newsletter-email'], "@") || !str_contains($_GET['newsletter-email'], ".") || strlen($_GET['newsletter-email']) < 6 || $_GET['newsletter-email-2'] != "") {
header('Location: '.$lang_folder.'err/general.html');
die();
}
$ch = curl_init($contact_form_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode('email').'='.urlencode($_GET['newsletter-email']));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode==200){
header('Location: '.$lang_folder.'confirmation.html');
die();
}
header('Location: '.$lang_folder.'err/general.html');
?>