version 12 X version 14

Issues related to forms.
Post Reply
Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

version 12 X version 14

Post by Baltazar » Tue Feb 12, 2019 3:30 am

Dear,
I made a small page in version 12, in this version the page works perfectly, but when I publish it in version 14 the error “Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/balta784/public_html/Teste/Contatox.php on line 2”.
Nothing was changed nothing page, only the publication in version 14, does anyone know the solution ??

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Tue Feb 12, 2019 6:59 am

Did you publish all flies?

What code is on line 2 of 'Contatox.php'?

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Tue Feb 12, 2019 2:39 pm

204/5000
The test site is composed of 2 pages, the index that contains a link to the page contatox, index is defined as html and contatox as php, it is a page that receives a message and sends it to an email.

Can I pass the project on to you if possible?

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Tue Feb 12, 2019 3:07 pm

Did you publish all files?
Including the (updated) PHP mailer files?

To share your project please see this:
viewtopic.php?f=10&t=82134

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Tue Feb 12, 2019 8:23 pm

How do I have updated all PHP mailer files

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Tue Feb 12, 2019 8:40 pm

If you publish all files then the PhP Mailer files will be generated automatically (if needed).

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Tue Feb 12, 2019 9:35 pm

The problem occurs when setting the option "use PHP Mailer Instead of standard PHP mail" in the "Mail Engine" tab, if you do not use this option the page is loaded without problems.

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Tue Feb 12, 2019 9:49 pm

Did you publish/upload all files?

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Tue Feb 12, 2019 10:10 pm

Yes, all have been published

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Wed Feb 13, 2019 7:06 am

What is the URL of the page?
Which code is on line 2 of the PHP?

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Wed Feb 13, 2019 11:53 am

The page url is baltazar.eti.br/Teste

if I run this little page in version 12 it works

Below the code in php,

<?php
use PHPMailer\PHPMailer\PHPMailer;

require 'PHPMailer.php';
require 'SMTP.php';

function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form2')
{
$mailto = 'cesar@arqmais.eco.br';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Mensagem via Website';
$message = 'Mensagem via webs sites';
$success_url = './index.html';
$error_url = './index.html';
$error = '';
$autoresponder_from = 'cesar@arqmais.eco.br';
$autoresponder_to = isset($_POST['email']) ? $_POST['email'] : $mailfrom;
$autoresponder_subject = 'Resposta de Arqmais';
$autoresponder_message = 'Em breve retornaremos o contato';
$eol = "\n";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'mail.arqmais.eco.br';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = 'cesar';
$mail->Password = 'cesar2019';
$mail->SMTPSecure = 'tls';
$mail->Subject = stripslashes($subject);
$mail->From = $mailfrom;
$mail->FromName = $mailfrom;
$mailto_array = explode(",", $mailto);
for ($i = 0; $i < count($mailto_array); $i++)
{
if(trim($mailto_array[$i]) != "")
{
$mail->AddAddress($mailto_array[$i], "");
}
}
$mail->AddReplyTo($mailfrom);
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}

if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}

$internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
$message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
$logdata = '';
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$mail->CharSet = 'ISO-8859-1';
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0)
{
$mail->AddAttachment($_FILES[$key]['tmp_name'], $_FILES[$key]['name']);
}
}
}
$mail->WordWrap = 80;
$mail->Body = $message;
if (!$mail->Send())
{
die('PHPMailer error: ' . $mail->ErrorInfo);
}
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->Subject = stripslashes($autoresponder_subject);
$mail->From = $autoresponder_from;
$mail->FromName = $autoresponder_from;
$mail->AddAddress($autoresponder_to, "");
$mail->AddReplyTo($autoresponder_from);
$mail->IsHTML(false);
$mail->WordWrap = 80;
$mail->Body = $autoresponder_message;
if (!$mail->Send())
{
die('PHPMailer error: ' . $mail->ErrorInfo);
}
header('Location: '.$success_url);
exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Cotatox</title>
<meta name="generator" content="WYSIWYG Web Builder 14 - http://www.wysiwygwebbuilder.com">
<link href="Teste14.css" rel="stylesheet">
<link href="Contatox.css" rel="stylesheet">
<script>
function Validatecontato()
{
var regexp;
var Editbox2 = document.getElementById('Editbox2');
if (!(Editbox2.disabled || Editbox2.style.display === 'none' || Editbox2.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox2.value.length != 0 && !regexp.test(Editbox2.value))
{
alert("Please enter a valid email address.");
Editbox2.focus();
return false;
}
}
var Editbox3 = document.getElementById('Editbox3');
if (!(Editbox3.disabled || Editbox3.style.display === 'none' || Editbox3.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox3.value.length != 0 && !regexp.test(Editbox3.value))
{
alert("Please enter a valid email address.");
Editbox3.focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<div id="wb_Form2" style="position:absolute;left:613px;top:94px;width:324px;height:646px;z-index:9;">
<form name="contato" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form2" onsubmit="return Validatecontato()">
<input type="hidden" name="formid" value="form2">
<input type="text" id="Editbox1" style="position:absolute;left:104px;top:48px;width:190px;height:16px;z-index:0;" name="Nome" value="" spellcheck="false">
<input type="text" id="Editbox2" style="position:absolute;left:104px;top:79px;width:190px;height:16px;z-index:1;" name="email" value="" spellcheck="false">
<textarea name="Mensagem" id="TextArea2" style="position:absolute;left:104px;top:148px;width:190px;height:90px;z-index:2;" rows="4" cols="29" spellcheck="false"></textarea>
<input type="submit" id="Button3" name="" value="Send" style="position:absolute;left:142px;top:285px;width:96px;height:25px;z-index:3;">
<input type="text" id="Editbox3" style="position:absolute;left:104px;top:110px;width:190px;height:16px;z-index:4;" name="email" value="" spellcheck="false">
<label for="Editbox1" id="Label3" style="position:absolute;left:0px;top:48px;width:89px;height:16px;line-height:16px;z-index:5;">Nome</label>
<label for="Editbox2" id="Label4" style="position:absolute;left:0px;top:79px;width:89px;height:16px;line-height:16px;z-index:6;">Email:</label>
<label for="TextArea2" id="Label5" style="position:absolute;left:0px;top:110px;width:89px;height:16px;line-height:16px;z-index:7;">Confirme E-mail</label>
<label for="" id="Label7" style="position:absolute;left:13px;top:154px;width:76px;height:16px;line-height:16px;z-index:8;">Mensagem</label>
</form>
</div>
</body>
</html>

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Wed Feb 13, 2019 12:12 pm

The problem is related to PHPMailer.
Does your hosting account have PHP 5.6 or newer?

Baltazar
 
 
Posts: 11
Joined: Mon Feb 25, 2013 11:54 am

Re: version 12 X version 14

Post by Baltazar » Wed Feb 13, 2019 12:33 pm

Below the server settings


Apache 2.2.26
PHP 5.5.30, 5.6.14
Perl 5.8.8
MySQL 5.5.40
JSP Disponível somente em Dedicados e VPS
cPanel 11.52.x – atualizado automaticamente
GD 2.0.34
Image Magic 6.7.6

User avatar
Pablo
 
Posts: 15193
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: version 12 X version 14

Post by Pablo » Wed Feb 13, 2019 12:59 pm

PHP 5.5 should work according to the website:
https://github.com/PHPMailer/PHPMailer/ ... GRADING.md

However the error indicates that the problem is related to PHP mailer, so it looks like your hosting account is not compatible.

Post Reply