include("/var/www/vhosts/shipping-address-spain.com/clients/session.php");
include("/var/www/vhosts/shipping-address-spain.com/clients/config.php");
include("functions.php");
//Referidor
if(isset($_GET['ref'])){
$referidor = strtolower($_GET['ref']);
$readonly = "readonly";
}else{
$referidor = "";
$readonly = "";
}
//reCaptcha v3
$recaptcha_sitio = "6LcAfM8ZAAAAAGGpkiwy2T_g0CxjigY7QB_mxeSs";
$recaptcha_privada = "6LcAfM8ZAAAAAE4nqjGYLZzDQTG5gnVNzrxzvz7e";
/* IDIOMA DE LA COOKIE - FORMULARIO DE SUSCRIPCION */
if(isset($_COOKIE['pll_language']) AND $_COOKIE['pll_language'] == "de"){ //Idioma en aleman
$i18n_frmTitle = "Ihre Lieferadresse und Rücksendeadresse in Spanien - Günstig und schnell";
$i18n_frmDescSubs = "Registrieren Sie sich jetzt ihre Postfach Anschrift in Spanien";
$i18n_frmComplete = "Bitte füllen Sie alle Felder mit Ihren Daten aus";
$i18n_frmConfirm = "Sie erhalten eine Bestätigungsemail zur Verifizerung.";
$i18n_frmCompany = "Firma";
$i18n_frmName = "Name";
$i18n_frmVAT = "EU Umsatzsteuer ID (falls vorhanden)";
$i18n_frmAddress = "Strasse";
$i18n_frmZip = "PLZ";
$i18n_frmCity = "Ort";
$i18n_frmCountry = "Land";
$i18n_frmCountrySel = "bitte wählen Sie Ihr Land aus";
$i18n_frmState = "Staat";
$i18n_frmLanguage = "Sprache";
$i18n_frmLanguageSel = "Wähle deine Sprache";
$i18n_frmLangEng = "Englisch";
$i18n_frmLangGer = "Deutsch";
$i18n_frmLangSpa = "Spanisch";
$i18n_frmPhone = "Telefon mit Landesvorwahl";
$i18n_frmEmail = "Email";
$i18n_frmReferrer = "Referrer (Es kommt von einem Freund, schreiben Sie Ihr Postfach)";
$i18n_frmSubscription = "Abonnement";
$i18n_frmYearly = "jährlich";
$i18n_frmMonthly = "monatlich";
$i18n_frmMessage = "Bemerkung";
$i18n_frmSend = "Abonnement bezahlen";
$i18n_frmSendfree = "Abonnement erstellen";
$i18n_frmBtnDef = "bitte wählen";
$i18n_frmSpain = "Spanien";
$il18_frmErrorExis = "Das E-Mail-Konto ist bereits vorhanden. Wenn Sie sich nicht an das Zugangskennwort erinnern, klicken Sie HIER";
$il18n_infoPhone = "Das Kurierunternehmen verlangt, dass die Telefonnummer des Empfängers angegeben wird, da er bei Bedarf kontaktiert wird.";
$il18n_acceptConditions = "Ich habe die gelesen und akzeptiert Nutzungsbedingungen des Dienstes Shipping-Address-Spain.com";
$il18n_acceptConditions_error = "Sie müssen die Nutzungsbedingungen unseres Dienstes lesen und akzeptieren.";
$langRecaptcha = "de";
$il18_frmErrorCaptcha = "Googles reCaptcha wurde nicht validiert. Bitte gehen Sie zurück und validieren Sie es, bevor Sie sich anmelden.";
$i18n_gratis = "Unentgeltlich";
$i18n_footerNosotros = "Über uns";
$i18n_footerPrivacidad = "Datenschutz-Bestimmungen";
$i18n_footerCondiciones = "Nutzungsbedingungen";
$i18n_footerGDPR = "GDPR";
$i18n_avisoeu = " Wenn Sie außerhalb der EU (Europäische Union) versenden möchten, benötigen Sie unbedingt einen gültigen Reisepass und eine Rechnung für das zu versendende Produkt.";
}else if(isset($_COOKIE['pll_language']) AND $_COOKIE['pll_language'] == "es"){ //Idioma en español
$i18n_frmTitle = "Su dirección de envío y dirección de devolución en España - Barato y rápido";
$i18n_frmDescSubs = "Suscripción para Shipping Address Spain";
$i18n_frmComplete = "Por favor, complete el formulario con todos sus datos personales.";
$i18n_frmConfirm = "Compruebe de que los campos marcados con * son obligatorios rellenarlos con la información solicitada.";
$i18n_frmConfirmHash = "Compruebe de que los campos marcados con * son obligatorios rellenarlos con la información solicitada.";
$i18n_frmCompany = "Empresa";
$i18n_frmName = "Nombre y apellidos";
$i18n_frmVAT = "CIF (si es posible)";
$i18n_frmAddress = "Dirección";
$i18n_frmZip = "Código postal";
$i18n_frmCity = "Ciudad";
$i18n_frmCountry = "País";
$i18n_frmCountrySel = "Seleccione su país";
$i18n_frmState = "Población";
$i18n_frmLanguage = "Idioma";
$i18n_frmLanguageSel = "Seleccione su idioma";
$i18n_frmLangEng = "Inglés";
$i18n_frmLangGer = "Alemán";
$i18n_frmLangSpa = "Español";
$i18n_frmPhone = "Prefijo internacional y teléfono";
$i18n_frmPhone2 = "Teléfono";
$i18n_frmPrefix2 = "Prefijo";
$i18n_frmEmail = "Correo electrónico";
$i18n_frmReferrer = "Referidor (viene de parte de algún amigo, escriba su pobox)";
$i18n_frmSubscription = "Suscripción";
$i18n_frmSubsSelect= "Seleccione una subscripción";
$i18n_frmYearly = "anualmente";
$i18n_frmMonthly = "mensualmente";
$i18n_frmMessage = "Puede escribir un mensaje";
$i18n_frmSend = "Pagar subscripción";
$i18n_frmSendfree = "Crear subscripción";
$i18n_frmSpain = "España";
$i18n_frmBtnDef = "Seleccione una subscrición";
$il18_frmErrorExis = "La cuenta de correo electrónico ya existe. Si no recuerda la contraseña de acceso, haz click AQUÍ";
$il18n_infoPhone = "La empresa de mensajería requiere que se indique el número de teléfono del destinatario, ya que en el caso de que fuese necesario, se contactaría.";
$il18n_acceptConditions = "He LEÍDO y ACEPTO las condiciones de uso del servicio de Shipping-Address-Spain.com";
$il18n_acceptConditions_error = "Es necesario que lea y acepte las condiciones de uso de nuestro servicio.";
$langRecaptcha = "es";
$il18_frmErrorCaptcha = "No ha sido validado el reCaptcha de Google. Porfavor, vuelva atrás y valídelo antes de suscribirse.";
$i18n_gratis = "GRATIS";
$i18n_footerNosotros = "Sobre nosotros";
$i18n_footerPrivacidad = "Política de privacidad";
$i18n_footerCondiciones = "Condiciones de uso";
$i18n_footerGDPR = "RGPD";
$i18n_avisoeu = " Si desea realizar envíos fuera de la UE (Unión Europea) es imprescindible tener un pasaporte válido y factura del producto a enviar.";
}else{ //Idioma en ingles
$i18n_frmTitle = "Your shipping adress and return adress in Spain - Cheap and fast";
$i18n_frmDescSubs = "Subscription for Shipping Address Spain";
$i18n_frmComplete = "Please complete the form with all your personal data.";
$i18n_frmConfirm = "Check that the fields marked with ( * ) are required to fill them with the requested information.";
$i18n_frmConfirmHash = "Check that the fields marked with ( * ) are required to fill them with the requested information.";
$i18n_frmCompany = "Company";
$i18n_frmName = "Name and surname";
$i18n_frmVAT = "VAT ID (If available)";
$i18n_frmAddress = "Address";
$i18n_frmZip = "Zip Code";
$i18n_frmCity = "City";
$i18n_frmCountry = "Country";
$i18n_frmCountrySel = "Select your country";
$i18n_frmState = "State";
$i18n_frmLanguage = "Language";
$i18n_frmLanguageSel = "Select your language";
$i18n_frmLangEng = "English";
$i18n_frmLangGer = "German";
$i18n_frmLangSpa = "Spanish";
$i18n_frmPhone = "International prefix and phone";
$i18n_frmPhone2 = "Phone";
$i18n_frmPrefix2 = "Prefix";
$i18n_frmEmail = "Email";
$i18n_frmReferrer = "Referrer (it comes from a friend, write your pobox)";
$i18n_frmSubscription = "Subscription";
$i18n_frmSubsSelect= "Select a subscription";
$i18n_frmYearly = "yearly";
$i18n_frmMonthly = "monthly";
$i18n_frmMessage = "Write a message";
$i18n_frmSend = "Pay subscription";
$i18n_frmSendfree = "Make subscription";
$i18n_frmBtnDef = "Select a subcription";
$i18n_frmSpain = "Spain";
$il18_frmErrorExis = "The email account already exists. If you do not remember the access password, click HERE";
$il18n_infoPhone = "The courier company requires that the recipient's phone number be indicated, since if necessary, he would be contacted.";
$il18n_acceptConditions = "I have READ and ACCEPT the conditions of use of the service Shipping-Address-Spain.com";
$il18n_acceptConditions_error = "You need to read and accept the terms of use of our service.";
$langRecaptcha = "en";
$il18_frmErrorCaptcha = "Google's reCaptcha has not been validated. Please, go back and validate it before subscribing.";
$i18n_gratis = "FREE";
$i18n_footerNosotros = "About us";
$i18n_footerPrivacidad = "Policy Privacy";
$i18n_footerCondiciones = "Conditions of use";
$i18n_footerGDPR = "GDPR";
$i18n_avisoeu = " If you want to ship outside the EU (European Union), it is essential to have a valid passport and an invoice for the product to be sent.";
}
//Enviar form
if(isset($_POST['sendSubs'])){
//Honeypot
if($_POST['hpsr'] == ""){
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
$recaptcha_secret = $recaptcha_privada;
$recaptcha_response = $_POST['recaptcha_response'];
$recaptcha = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret . '&response=' . $recaptcha_response);
$recaptcha = json_decode($recaptcha);
//RECAPTCHA OK
if($recaptcha->score >= 0.7){
//Comprobar si existe el email
$sql_existeMail = mysql_query("SELECT * FROM clients WHERE email='".urldecode(mysql_real_escape_string($_POST['email']))."'");
$existeMail = mysql_num_rows($sql_existeMail);
//Si no hay coincidencias, seguir proceso
if($existeMail==0){
$sql_nameCountry = mysql_query("SELECT pais FROM paises WHERE id='".mysql_real_escape_string($_POST['country'])."'");
list($nameCountry) = mysql_fetch_array($sql_nameCountry);
include("/var/www/vhosts/shipping-address-spain.com/clients/langs/i18n_".$_POST['language'].".php");
$company = $_POST['company'];
$company2=utf8_decode($company);
$name = $_POST['name'];
$name2=urldecode($name);
//$name2=utf8_encode($name);
$vatid = $_POST['vatid'];
$address = $_POST['address'];
$address=urldecode($address);
$zip = $_POST['zip'];
$city = $_POST['city'];
$city=urldecode($city);
$country = $_POST['country'];
$country_id = $_POST['country'];
$country_name = $nameCountry;
$state = $_POST['states'];
//Mostrar nombre del estado
$sql_nameStates = mysql_query("SELECT nombre, code FROM paises_states WHERE id='".mysql_real_escape_string($state)."'");
list($nombreState, $code_pais) = mysql_fetch_array($sql_nameStates);
$language = $_POST['language'];
$prefix_phone = $_POST['prefix_phone'];
$phone = $_POST['phone'];
$phone=urldecode($phone);
$email = $_POST['email'];
$email=urldecode($email);
if($_POST['referrer'] != ""){
$referrer = mysql_real_escape_string($_POST['referrer']);
}else{
$referrer = "-";
}
$subscription = $_POST['subscription'];
$message = $_POST['message'];
$message=urldecode($message);
$subscription = $_POST['subscription'];
//Cuerpo del mensaje
$cuerpoMensaje = "
ADDRESS SHIPPING SPAIN Name and surname: ".$name2." Company: ".$company." VAT ID: ".$vatid." Address: ".$address." ZIP: ".$zip." City: ".$city." State: ".$nombreState." Country: ".$country_name." Language: ".$language." Phone: ".$phone." Referrer: ".$referrer." Email: ".$email." Subscription: ".$subscription." Message: ".$message."
function extract_info($contenido, $antes, $despues, $includeMarks) {
$suche=strpos($contenido,$antes);
if($suche===false){ return false; }
$contenido=substr($contenido, $suche+strlen($antes), strlen($contenido)-($suche+strlen($antes)));
$suche=strpos($contenido,$despues);
if($suche===false){ return false; }
$encontrado=substr($contenido,0,$suche);
if($includeMarks==true){
$encontrado=$antes.$encontrado.$despues;
}
return $encontrado;
}
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$API_Endpoint_test);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
$PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD="InstantPaymentOnly"; //Sólo pagos inmediatos
$HDRIMG="http://shipping-address-spain.com/clients/img/logo.jpg"; //Imagen que sale en el pago de paypal
//$PAYMENTREQUEST_0_NOTETOBUYER="La dirección de paypal será la misma a la que se envíe el pedido, modifíquela si no es correcta, gracias."; //Nota para el comprador
if($subscription=="1"){
$price="10.00";
$description="My Spain yearly 10€";
}
else if($subscription=="2"){
$price="9.90";
$description="My Spain Premium monthly 9,90€";
}
else if($subscription=="3"){
$description="My Spain Free";
}
echo "price $price - descrition: $description ";
$PAYMENTREQUEST_0_ITEMAMT=$price; //Suma total de los articulos
$PAYMENTREQUEST_0_AMT=$price; //Total de la suma del pedido
$PAYMENTREQUEST_0_CURRENCYCODE="EUR"; //Moneda del pedido
$nombre_unido=utf8_encode($name);
$PAYMENTREQUEST_0_SHIPTONAME="$nombre_unido";
$PAYMENTREQUEST_0_SHIPTOSTREET=$address;
$PAYMENTREQUEST_0_SHIPTOSTREET=utf8_encode($PAYMENTREQUEST_0_SHIPTOSTREET);
$PAYMENTREQUEST_0_SHIPTOCITY="$city";
$PAYMENTREQUEST_0_SHIPTOCITY=utf8_encode($PAYMENTREQUEST_0_SHIPTOCITY);
$PAYMENTREQUEST_0_SHIPTOZIP="$zip";
$RETURNURL="https://subscription.shipping-address-spain.com/returnpaypal2.php";
$sql_country = mysql_query("SELECT pais_code FROM paises where id='".mysql_real_escape_string($country_id)."'");
list($countries_iso_code)=mysql_fetch_array($sql_country);
$state2="";
if($country_id=="10" or $country_id=="30" or $country_id=="38" or $country_id=="44" or $country_id=="98" or $country_id=="99" or $country_id=="106" or $country_id=="137" or $country_id=="208" or $country_id=="222"){
$state2="&PAYMENTREQUEST_0_SHIPTOSTATE=".$code_pais."";
}
//Si el nombre tiene dos partes, dividir y usar como pbcode
$partName = explode(" ", $name2);
$onlyname = $partName[0];
if($partName[1] != ""){
$surname = $partName[1];
$code = strtoupper(substr(limpiar_especiales($partName[0]),0,3)."".substr(limpiar_especiales($partName[1]),0,3)."".substr(limpiar_especiales($company),0,4));
}else{
$surname = "";
$code = strtoupper(substr(limpiar_especiales($name2),0,3)."".substr(limpiar_especiales($company),0,4));
}
//$code = strtoupper(substr($name,0,3)."".substr($company,0,4));
$sql_existCode = mysql_query("SELECT * FROM clients WHERE pb_code LIKE '%".mysql_real_escape_string($code)."%' ORDER BY idclients DESC LIMIT 1");
$existCode = mysql_fetch_array($sql_existCode);
if(mysql_num_rows($sql_existCode) >= 1){
if(substr($existCode['pb_code'], -1) != ""){
$newCode = $code."".(substr($existCode['pb_code'], -1)+1);
}else{
$newCode = $code."1";
}
}else{
$newCode = $code;
}
//si es el free salir sin ir a paypal_articulos_string
if($subscription==3){
$cadena = rand(1,9999999).date('Y-m-d G:h:s');
$token_pass = sha1($cadena);
$sql="INSERT INTO clients SET pb_code='".mysql_real_escape_string($newCode)."', name='".mysql_real_escape_string($onlyname)."', surname='".mysql_real_escape_string($surname)."', email='".mysql_real_escape_string($email)."', company='".mysql_real_escape_string($company2)."', vat_id='".mysql_real_escape_string($vatid)."', address='".mysql_real_escape_string($address)."', zip='".mysql_real_escape_string($zip)."', city='".mysql_real_escape_string($city)."', state='".mysql_real_escape_string($state)."', country=".mysql_real_escape_string($country_id).", ph1_prefix='".mysql_real_escape_string($prefix_phone)."', ph1='".mysql_real_escape_string($phone)."', lang='".mysql_real_escape_string($language)."', subscription='".mysql_real_escape_string($subscription)."', message='".mysql_real_escape_string($message)."', ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', token_pass='".mysql_real_escape_string($token_pass)."', referidor='".mysql_real_escape_string($referrer)."', ProfileStatus='Active', expire_subscription='2100-08-19 00:00:00'";
$resultado = mysql_query($sql);
$sql_alt="INSERT INTO clients_alt SET pb_code='".mysql_real_escape_string($newCode)."', name='".mysql_real_escape_string($onlyname)."', surname='".mysql_real_escape_string($surname)."', email='".mysql_real_escape_string($email)."', company='".mysql_real_escape_string($company2)."', vat_id='".mysql_real_escape_string($vatid)."', address='".mysql_real_escape_string($address)."', zip='".mysql_real_escape_string($zip)."', city='".mysql_real_escape_string($city)."', state='".mysql_real_escape_string($state)."', country=".mysql_real_escape_string($country_id).", ph1_prefix='".mysql_real_escape_string($prefix_phone)."', ph1='".mysql_real_escape_string($phone)."', lang='".mysql_real_escape_string($language)."', subscription='".mysql_real_escape_string($subscription)."', message='".mysql_real_escape_string($message)."', ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', token_pass='".mysql_real_escape_string($token_pass)."', referidor='".mysql_real_escape_string($referrer)."', ProfileStatus='Active', expire_subscription='2100-08-19 00:00:00'";
$resultado_alt = mysql_query($sql_alt);
//si hay error me envio un mail
if ($resultado === false) {
$body="Error al crear cliente con subscription 3 en subscription/index.php sql: $sql error mysql_error()";
$email="david@tiendade.es";
$subj="Error al crear un cliente en shipping-address-spain";
$headers = "From: $mailtienda\n";
$headers .= "Return-Path: $mailtienda\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"";
mail($email,$subj,$body,$headers);
}
$sql_ultimoCliente = mysql_query("SELECT idclients FROM clients ORDER BY idclients DESC LIMIT 1");
list($ultimoCliente) = mysql_fetch_array($sql_ultimoCliente);
$producto_creado=$ultimoCliente;
$timestamp=date('Y-m-d H:i:s');
$sql2="INSERT INTO clients_history SET idclients=".mysql_real_escape_string($producto_creado).", RecurringPaymentsProfile='', ProfileStatus='Active', date='".$timestamp."', comment=''";
$resultado2 = mysql_query($sql2) or die(mysql_error());
//$sql3="update clients SET token_pass='".mysql_real_escape_string($token)."' where idclients='".mysql_real_escape_string($producto_creado)."'";
//$resultado3 = mysql_query($sql3) or die(mysql_error());
$enlace = "https://shipping-address-spain.com/clients/remember-password.php?tkps=$token_pass";
//Aqui se envia el mail de confirmacion de alta de cliente
$body=enviar_mail_subscription_ok();
/*
$body= "
Subscription to Shipping Address Spain – Your shipping adress and return adress in Spain – cheap and fast
".$i18n_email_1."
".$i18n_email_2."
".$i18n_email_pobox." PoBox: ".$newCode." ".$i18n_address.": Europeart Web Services. Calle Doctor Garcia Brustenga, 8 - 46020 Valencia (Spain)
\n";
include("htmlMimeMail.php");
$mail = new htmlMimeMail();
$mail->setHtml($body, '', 'https://shipping-address-spain.com/boletin/fotos/');
$mail->setHTMLCharset('UTF-8');
$mail->setHTMLEncoding('UTF-8');
$mail->setFrom('');
$mail->setSubject(utf8_decode($i18n_email_0));
$mail->setBcc($mailtienda);
$result = $mail->send(array("$email"));
*/
//Fin de confirmacion de alta de cliente
$PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=$countries_iso_code;
$PAYMENTREQUEST_0_SHIPTOPHONENUM="$phone";
$PAYMENTREQUEST_0_EMAIL="$email";
$CANCELURL="https://shipping-address-spain.com/subscription/cancelpaypal.php?ref=$producto_creado";
//Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
$PAYMENTREQUEST_0_HANDLINGAMT=0;
$PAYMENTREQUEST_0_SHIPDISCAMT=0;
$PAYMENTREQUEST_0_SHIPPINGAMT=0;
//producto
//$producto="&L_PAYMENTREQUEST_0_NAME0=".$description."&L_PAYMENTREQUEST_0_DESC0=".$description."&L_PAYMENTREQUEST_0_AMT0=".$price."&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_TAXAMT0=0&L_PAYMENTREQUEST_0_NUMBER0=1&L_PAYMENTREQUEST_0_ITEMURL0=https://shipping-address-spain.com/prices/&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital";
//
if($USE_PROXY)
curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT);
//NVPRequest for submitting to server
//$paypal_articulos_string= "&L_PAYMENTREQUEST_0_ITEMCATEGORY=Digital&L_PAYMENTREQUEST_0_NAME0=My Spain&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_AMT0=".$price."";
$nvpreq="USER=".$API_UserName_test."&PWD=".$API_Password_test."&SIGNATURE=".$API_Signature_test."&METHOD=SetExpressCheckout&VERSION=".$version_test."&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD=".$PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD."&PAYMENTREQUEST_0_INVNUM=s".$producto_creado."&PAYMENTREQUEST_0_ITEMAMT=".$PAYMENTREQUEST_0_ITEMAMT."&PAYMENTREQUEST_0_AMT=".$PAYMENTREQUEST_0_AMT."&PAYMENTREQUEST_0_HANDLINGAMT=".$PAYMENTREQUEST_0_HANDLINGAMT."&RETURNURL=".$RETURNURL."&CANCELURL=".$CANCELURL."&ALLOWNOTE=1&LOCALECODE=ES&CHANNELTYPE=Merchant&BRANDNAME=http://shipping-address-spain.com&L_PAYMENTTYPE0=InstantOnly&CUSTOMERSERVICENUMBER=902158256&PAYMENTREQUEST_0_CURRENCYCODE=".$PAYMENTREQUEST_0_CURRENCYCODE."&PAYMENTREQUEST_0_SHIPDISCAMT=".$PAYMENTREQUEST_0_SHIPDISCAMT."&HDRIMG=".$HDRIMG."&PAYMENTREQUEST_0_NOTETEXT=s".$producto_creado."&PAYMENTREQUEST_0_SHIPTONAME=".$PAYMENTREQUEST_0_SHIPTONAME."&PAYMENTREQUEST_0_SHIPTOSTREET=".$PAYMENTREQUEST_0_SHIPTOSTREET."&PAYMENTREQUEST_0_SHIPTOCITY=".$PAYMENTREQUEST_0_SHIPTOCITY."&PAYMENTREQUEST_0_SHIPTOZIP=".$PAYMENTREQUEST_0_SHIPTOZIP."&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=".$PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE."".$state2."&PAYMENTREQUEST_0_SHIPTOPHONENUM=".$PAYMENTREQUEST_0_SHIPTOPHONENUM."&ADDROVERRIDE=1&PAYMENTREQUEST_0_EMAIL=".$PAYMENTREQUEST_0_EMAIL."&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=".$description."&noshipping=1";
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
//getting response from server
$response = curl_exec($ch);
//echo "Response $response ";
$token=extract_info($response,'TOKEN=','&',false);
$token = urldecode($token);
mysql_query("update clients set token = '".mysql_real_escape_string($token)."' where idclients = '".mysql_real_escape_string($producto_creado)."';");
$ack=extract_info($response,'ACK=','&',false);
$error=extract_info($response,'L_LONGMESSAGE0=','&',false);
$error = urldecode($error);
if ($ack=='Failure') {
$body="Error en el pago inicial de subscripción de un cliente shipping-address-spain Error: $ack: $error $L_LONGMESSAGE0 total articulos: $PAYMENTREQUEST_0_ITEMAMT total pedido: $PAYMENTREQUEST_0_AMT pedido:$producto_creado Envio: $PAYMENTREQUEST_0_SHIPPINGAMT Incremento tipo pago: $PAYMENTREQUEST_0_HANDLINGAMT Lo que paso a paypal $paypal_articulos_string Contador articulos $paypal_articulos_contador Todo completo: $nvpreq";
$email="david@tiendade.es";
$subj="Error en el pago de un cliente shipping-address-spain";
$headers = "From: $mailtienda\n";
$headers .= "Return-Path: $mailtienda\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"";
mail($email,$subj,$body,$headers);
echo "$i18n_sc_error ";
echo " Error: $ack: $error $L_LONGMESSAGE0";
//echo " total articulos: $PAYMENTREQUEST_0_ITEMAMT total pedido: $PAYMENTREQUEST_0_AMT pedido:$producto_creado Envio: $PAYMENTREQUEST_0_SHIPPINGAMT Incremento tipo pago: $PAYMENTREQUEST_0_HANDLINGAMT Lo que paso a paypal $paypal_articulos_string Contador articulos $paypal_articulos_contador Todo completo: $nvpreq";
$sql22="UPDATE clients SET ProfileSatus='Cancelled' where pb_code='".$newCode."'";
$resultado22 = mysql_query($sql22) or die(mysql_error());
exit();
}
//echo " Token: $token $nvpreq";
//$salida="https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$token."";
$salida="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$token."";
echo "";
exit;
//Fin del pago por paypal
//ERROR EMAIL YA EXISTE
} else {
$msg_error = "
Email exist.
";
}
//ERROR RECAPTCHA
} else {
$msg_error = "
".$il18_frmErrorCaptcha."
";
}
}else{
$msg_error = "
EVIL BOT.
";
}
}
?>
if(isset($_COOKIE['pll_language']) AND $_COOKIE['pll_language'] == "de"){ //Idioma en aleman ?>
Shipping-Address-Spain.com Lagerung und Paketversand in Spanien
}else if(isset($_COOKIE['pll_language']) AND $_COOKIE['pll_language'] == "en"){ //Idioma en aleman ?>
Shipping-Address-Spain.com Storage and parcel forwarding from Spain
}else{ ?>
Shipping-Address-Spain.com Almacenamiento y envío de paquetería desde España
} ?>
You need a ship forwarder or a return address in Spain? You found it!