Parse error: syntax error, unexpected '' ../ configs / variables.php \ ');' (T_CONSTANT_ENCAPSED_STRING), expecting identifier (T_STRING) in ... on line 275

0

I have the error that says the title in PHP, it affects where it leaves the first include (variables.php) of the code: (that is the line 275)

echo "INFO: Defining shortened URL content.<br>";
if(!isset($_GET['mcpe']))
{
echo "WARNING: mcpe parameter specified.";
$urlcontent = '<?php
$servername = "'.$servername.'";
$longlink = "'.$longlink.'";
$alias = "'.$alias.'";
$password = "'.$password.'";
include (\'../configs/variables.php\');
include (\'../configs/template.php\');
?>';

}
else {
unset($urlcontent);
// No template, instant redirect
$urlcontent = '<?php
$servername = "'.$servername.'";
$longlink = "'.$longlink.'";
$alias = "'.$alias.'";
$password = "'.$password.'";
include (\'../configs/variables.php\');
include (\'../configs/template.php\');
header("Refresh:0; url='.$longlink.'")';
?>';
echo "WARNING: mcpe parameter not specified.";

}

Thanks

    
asked by José Hernandez 14.04.2017 в 22:27
source

1 answer

0
  • Do not use backslashes \ before a string. you are used to escape characters. In your case for include is not necessary.

    include ('../configs/variables.php');
    include ('../configs/template.php');
    
  • You are concatenating Mal the variable urlcontent in Else

     $urlcontent = '<?php
     $servername = "'.$servername.'";
     $longlink = "'.$longlink.'";
     $alias = "'.$alias.'";
     $password = "'.$password.'";
     include ("../configs/variables.php");
     include ("../configs/template.php");
     header("Refresh:0; url="'.$longlink.'");
    ?>';
    
answered by 14.04.2017 в 23:19