2

Encontrei dois sistemas de controle de ponto com código-aberto na internet: sisponto e wponto. Mas estão apresentando vários erros. Alguns eu corrigi, do tipo que não deu espaço ou faltou ponto e vírgula, mas outros não entendo, como este.

O erro completo é:

( ! ) 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: _DESCRICAO 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: _AUTOR 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'

Código-fonte do 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!");
?>

O site pode ser acessado no seguinte endereço: http://200.171.59.245/wponto/

2
  • 4
    Qual é a dúvida? Pelo que você mostrou, não tem erro nenhum, apenas alertas de que suas variáveis não estão definidas. Tem certeza que o include está com o caminho correto?
    – Bacco
    22/09/2014 às 16:15
  • 1
    Parte do código fonte não é interpretada por causa da open_short_tag troque as ocorrências de <? por: <?php.
    – rray
    22/09/2014 às 17:49

1 Resposta 1

-1

A razão porque não está conseguindo aceder ás variáveis é porque a opção short_open_tags vem por definição desligada e vc está usando essa opção para inserir o php no html.

O php pode ser inserido no html de várias formas:

a standard

<?php echo "olá mundo" ?>

as short tags (precisa de estar habilitada);

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

estilo ASP (precisa de estar habilitada);

<% echo "olá mundo" %>

estilo script

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

No se caso, pode ir no php.ini habilitar as short tags ou alterar o seu código de

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

para

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

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .