1
Good morning, I migrated the site from a client with php 5.3 to a hosting with php 5.5 (there is no setting php 5.3 by php.ini) and is returning the following errors when accessing the page.
Notice: Undefined index: tipotopo in /home/bluce130/sistema/include-topo.php on line 13
Notice: Undefined index: tipo in /home/bluce130/sistema/include-topo.php on line 15
Notice: Undefined index: id in /home/bluce130/sistema/include-topo.php on line 17
Notice: Undefined index: idcolecao in /home/bluce130/sistema/include-topo.php on line 18
Notice: Undefined index: acao in /home/bluce130/sistema/include-topo.php on line 19
Notice: Undefined index: portal in /home/bluce130/sistema/include-topo.php on line 20
Notice: Undefined index: pagina in /home/bluce130/sistema/include-topo.php on line 21
Notice: Undefined index: filtro in /home/bluce130/sistema/include-topo.php on line 22
Notice: Undefined index: idioma in /home/bluce130/sistema/include-topo.php on line 23
Notice: Undefined index: erro in /home/bluce130/sistema/include-topo.php on line 24
Code include-top.php
<?
session_start();
ini_set('memory_limit','64M');
require_once("../scripts/conexao.php");
require_once("../scripts/funcoes.php");
require_once("../scripts/mysql.php");
require_once("../scripts/img.canvas.php");
require_once("../scripts/paginacao.php");
$page = basename($_SERVER['PHP_SELF'],".php");
if($page != 'index') require_once("verifica.php");
$tipotopo = seguranca($_GET['tipotopo']);
if($tipotopo) $_SESSION['tipo'] = $tipotopo;
$tipomoda = $_SESSION['tipo'];
$id = intval($_GET["id"]);
$idcolecao = intval($_GET["idcolecao"]);
$acao = seguranca($_GET["acao"]);
$portal = seguranca($_GET["portal"]);
$pagina = seguranca($_GET["pagina"]);
$filtro = seguranca($_GET["filtro"]);
$idioma = seguranca($_GET["idioma"]);
$erro = seguranca($_GET["erro"]);
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Administração</title>
<meta name="Author" content="www.dataprisma.com.br" />
<meta name="robots" content="all" />
<meta name="robots" content="noindex,nofollow" />
<link rel="stylesheet" type="text/css" href="../css/sistema.css" />
<link rel="stylesheet" type="text/css" href="../css/jcrop.css" />
<link rel="stylesheet" type="text/css" href="../css/smoothness/jquery-ui-1.8.20.css" />
<link rel="stylesheet" type="text/css" href="../css/jquery.fancybox.css?v=2.0.6" media="screen" />
<script type="text/javascript">
var page = '<?=$page?>';
var tipomoda = '<?=$tipomoda?>';
</script>
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script type="text/javascript" src="../scripts/jquery.fancybox.js?v=2.0.6"></script>
<script type="text/javascript" src="../scripts/jquery.fancybox-media.js?v=1.0.0"></script>
<script type="text/javascript" src="../scripts/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="../scripts/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="../scripts/jcrop.min.js"></script>
<script type="text/javascript" src="../scripts/jscolor/jscolor.js"></script>
<script type="text/javascript" src="../scripts/jquery-ui-1.8.20.min.js"></script>
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="../scripts/sistema.js"></script>
<script type="text/javascript">
<? if($erro == 1){ ?>
alert('Um ou mais arquivos não foram enviados, extensão não permitida!');
<? } ?>
</script>
</head>
<body>
<div id="carregando"><img src="../img/sistema/carregando.gif" class="vimg" /> Processando...</div>
<div class="center" style="position:relative; width:1000px; margin:15px auto 0 auto">
<table width="1000" cellpadding="10" cellspacing="0" bgcolor="#ffffff" style="border:#999 1px solid; border-bottom:none;">
<? if($page != 'index'){ ?>
<tr>
<td width="175" valign="top">
<strong style="color:#666">Logado em:</strong>
<select name="tipotopo" id="tipotopo">
<option value="F" <? if($tipomoda == 'F') echo 'selected="selected"' ?>>Feminino</option>
<option value="M" <? if($tipomoda == 'M') echo 'selected="selected"' ?>>Masculino</option>
</select>
</td>
<td width="668" valign="top"><input type="button" name="bt-tipotopo" id="bt-tipotopo" value="OK" /></td>
<td width="95" align="right"><a href="<?=$http?>"><img src="../img/sistema/happy-logo.jpg" /></a></td>
</tr>
<tr align="center">
<td colspan="3" id="menu" style="padding:0 5px">
<ul>
<li><a href="home.php" <? if($page == 'home') echo 'class="hover"'; ?>>Home</a></li>
<li><a href="background.php" <? if($page == 'background') echo 'class="hover"'; ?>>Background</a></li>
<li><a href="clipping.php" <? if($page == 'clipping') echo 'class="hover"'; ?>>Clipping</a></li>
<li><a href="colecao.php" <? if($page == 'colecao' || $page == 'campanha') echo 'class="hover"'; ?>>Coleção</a></li>
<li><a href="onde-comprar.php" <? if($page == 'onde-comprar') echo 'class="hover"'; ?>>Onde Comprar</a></li>
<!--li><a href="imprensa.php" <? if($page == 'imprensa') echo 'class="hover"'; ?>>Imprensa</a></li-->
<li><a href="empresa.php" <? if($page == 'empresa') echo 'class="hover"'; ?>>Empresa</a></li>
<li><a href="newsletter.php" <? if($page == 'newsletter') echo 'class="hover"'; ?>>Newsletter</a></li>
<li><a href="contatos.php" <? if($page == 'contatos') echo 'class="hover"'; ?>>Contatos</a></li>
<li><a href="logout.php" style="color:#d33">Sair</a></li>
</ul>
</td>
</tr>
<?
} else {
echo '<tr align="center" class="menu"><td>';
echo '<h2 style="color:#2c2a2b;margin:0">Para acessar a administração, preencha seu login e senha:</h2>';
echo '</td></tr>';
}
?>
</table>
</div>
Code index.php
<? include("include-topo.php"); ?>
<div class="center conteudo">
<form id="form1" name="form1" method="post" action="<?=$sistema?>autentica.php">
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td valign="middle"><strong>Qual site deseja administrar?</strong></td>
</tr>
<tr>
<td valign="middle">
<select name="tipo" id="tipo" style="width:100%">
<option value="F">Feminino</option>
<option value="M">Masculino</option>
</select>
</td>
</tr>
<tr>
<td valign="middle"><strong>Login:</strong></td>
</tr>
<tr>
<td><input name="login" type="text" id="login" size="35" /></td>
</tr>
<tr>
<td valign="middle"><strong>Senha:</strong></td>
</tr>
<tr>
<td><input name="senha" type="password" id="senha" size="35" /></td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td align="center"><input type="submit" value="Entrar" /></td>
</tr>
</table>
</form>
</div>
<? include("include-rodape.php"); ?>
As I’m slowly learning how to handle php, I couldn’t solve this problem myself.
To avoid this error, simply test whether this frame field has been initialized with isset().
– user60252
Related: https://answall.com/questions/58355/quando%C3%A9-necess%C3%A1rio-utilizar-o-isset
– Inkeliz
I believe that both of the above questions answer the question. Furthermore, I find it ironic to have a function named after
seguranca
whether you are using an obsolete and officially insecure PHP such as PHP 5.5 and PHP 5.3.– Inkeliz
This may be better duplicated: https://answall.com/questions/21714/como-resolver-um-notice-undefined-index?rq=1
– Inkeliz
I find this most enlightening https://answall.com/questions/56015/undefined-index-ao-recuperar-dados-do-post
– user60252
Good afternoon, is that my knowledge is 0 in php, I work only with hosting. I was migrating this from a client and his website started to give this problem. I have been reading the links mentioned by you but still I could not solve my problem =(
– Felipe Silva