How to fix "Undefined variable" error?

Asked

Viewed 6,040 times

2

I found two open-source point control systems on the Internet: seismic and wponto. But they are presenting several errors. Some I corrected, the kind that did not give space or lacked semicolon, but others do not understand, like this.

The complete error is:

( ! ) Notice: Undefined variable: _PALAVRAS in C: wamp www sisponto inc header.php on line 26 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php' ).. index.php:3 " /> ( ! ) Notice: Undefined variable: _DESCRIPTION in C: wamp www sisponto inc header.php on line 27 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php' ).. index.php:3 " /> ( ! ) Notice: Undefined variable: _AUTHOR in C: wamp www sisponto inc header.php on line 28 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php' ).. index.php:3 " /> ( ! ) Notice: Undefined variable: _LICENCA in C: wamp www sisponto inc header.php on line 29 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php' ).. index.php:3 " /> ( ! ) Notice: Undefined variable: _DATA in C: wamp www sisponto inc header.php on line 30 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php' ).. index.php:3 " /> ( ! ) Notice: Undefined variable: tempo in C: wamp www sisponto inc header.php on line 31 Call Stack #Timememoryfunctionlocation 10.0009244840{main}( ).. index.php:0 20.0020251112include( 'C: wamp www sisponto inc header.php'

Source code of header.php:

<?
// Caso _ERROS esteja setado para False, desabilita a 
// exibição de erros, caso contrario, habilita!
  if ($_ERROS == "True") 
   error_reporting(0);
  else
   error_reporting(E_ALL);

  if (isset($_GET['origem'])) {
     $tempo=3;
  }else{
     $tempo=9999999;
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br">
<head>
        <?php include ("conf\common.php"); ?>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <meta name="Keywords" content="<?=$_PALAVRAS?>" />
        <meta name="Description" content="<?=$_DESCRICAO?>" />
        <meta name="Autor" content="<?=$_AUTOR?>" />
        <meta name="License" content="<?=$_LICENCA?>" />
        <meta name="Date" content="<?=$_DATA?>" />
        <meta HTTP-EQUIV="Refresh" CONTENT="<?=$tempo?>; URL=<?=$_URL?>">

        <title><?=$_TITULO?></title>
        <link rel="Stylesheet" href="<?=$_DIRINC?>/styles.css" />
        <script type="text/javascript" language="JavaScript" src="<?=$_DIRINC?>/functions.js"></script>
</head>
<body>
<?
// Estabelece a conexão com o banco de dados
  $CON = pg_connect("host=$_HOST dbname=$_DB user=$_USER password=$_PASS") or msgerro("Impossível acessar a base de dados!");
?>

The website can be accessed at the following address: http://200.171.59.245/wponto/

  • 4

    What is the doubt? From what you have shown, there is no error, only alerts that your variables are not defined. Are you sure that the include is on the right track?

  • 1

    Part of the source code is not interpreted because of open_short_tag changes the occurrences of <? for: <?php.

1 answer

-1

The reason you are not able to access the variables is because the short_open_tags option comes by definition off and you are using this option to insert php into html.

php can be inserted into html in many ways:

the standard

<?php echo "olá mundo" ?>

the short tags (needs to be enabled);

<? echo "olá mundo" ?> ou evitando o comando echo <?=$var ?>

ASP style (needs to be enabled);

<% echo "olá mundo" %>

script style

<script language="php">
 echo "olá mundo";
</script>

In this case, you can go to php.ini and enable short tags or change your code

<meta name="Keywords" content="<?=$_PALAVRAS?>" />

for

<meta name="Keywords" content="<?php echo $_PALAVRAS ?>" />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.