Olá, galera..
eu estou com 2 problema simples..
tenho um script de noticia, que quando a pessoa clica no nome da noticia para visualizar ela, abre uma janela popup, como posso fazer para quando clica em um noticia, ir com a mesma pagina???
CODIGO
[NOTICIA.PHP]
E o segundo problema, é que esse escript ta vulnerável a sql injection, como posso se proteger disso?
quando clico para ver a noticia, fica php?id= e ja testei no Havij, está vulneravel
ae o codigo da pagina de [VIEW.PHP]
eu estou com 2 problema simples..
tenho um script de noticia, que quando a pessoa clica no nome da noticia para visualizar ela, abre uma janela popup, como posso fazer para quando clica em um noticia, ir com a mesma pagina???
CODIGO
[NOTICIA.PHP]
<?php
include "includes/config.php";
$y = mysql_query("SELECT * FROM tabela Order By id DESC")or die(mysql_error());
while($x = mysql_fetch_array($y))
{
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>'.$titulo.'</title>
<style type="text/css">
<!--
@import url("estilos/estilos.css");
-->
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="1%"> </td>
<td width="99%"><b><span class="form_ver">'.$x['data'].'</span></b></td>
</tr>
<tr>
<td><img src="imagens/setinha.jpg" width="8" height="8" /></td>
<td><b><span class="form_ver"><a href="#" onClick=window.open("view.php?id='.$x[id].'","Janela","toolbar=no,location=no,directories=n o,status=no,menubar=no,scrollbars=yes,resizable=no ,width='.$width.',height='.$height.'"); return false;" style="color: #000000"><u>'.$x['titulo'].'</u></a></span></b></td>
</tr>
<tr>
<td> </td>
<td class="geral">'.$x['subtitulo'].'</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" background="imagens/divide.jpg"></td>
</tr>
</table>
</body>
</html>
';
}
?>
include "includes/config.php";
$y = mysql_query("SELECT * FROM tabela Order By id DESC")or die(mysql_error());
while($x = mysql_fetch_array($y))
{
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>'.$titulo.'</title>
<style type="text/css">
<!--
@import url("estilos/estilos.css");
-->
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="1%"> </td>
<td width="99%"><b><span class="form_ver">'.$x['data'].'</span></b></td>
</tr>
<tr>
<td><img src="imagens/setinha.jpg" width="8" height="8" /></td>
<td><b><span class="form_ver"><a href="#" onClick=window.open("view.php?id='.$x[id].'","Janela","toolbar=no,location=no,directories=n o,status=no,menubar=no,scrollbars=yes,resizable=no ,width='.$width.',height='.$height.'"); return false;" style="color: #000000"><u>'.$x['titulo'].'</u></a></span></b></td>
</tr>
<tr>
<td> </td>
<td class="geral">'.$x['subtitulo'].'</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" background="imagens/divide.jpg"></td>
</tr>
</table>
</body>
</html>
';
}
?>
E o segundo problema, é que esse escript ta vulnerável a sql injection, como posso se proteger disso?
quando clico para ver a noticia, fica php?id= e ja testei no Havij, está vulneravel
ae o codigo da pagina de [VIEW.PHP]
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
}
-->
</style><table width="879" height="388" border="1" align="center">
<tr>
<td colspan="2" bgcolor="#000000"> </td>
</tr>
<tr>
<td width="106" valign="top"><p>Home</p>
<p>Fotos</p>
<p>Videos</p></td>
<td width="757" valign="top"><p><?php
include "includes/config.php";
if(!isset($_GET["id"])) {
echo '<div align=\"center\"><font face=\"Arial\" size=\"2\">O registro nao pode ser vizualisado verifique as configuraçoes!<meta http-equiv=\"refresh\" content=\"2; URL=exibir.php\"></font></div>';
} else {
$y = mysql_query("select * from tabela where id='".$_GET["id"]."' order by id limit 1") or die(mysql_error());
while ($x = mysql_fetch_array($y)) {
echo'
<title> '.$titulo.'</title>
<style type="text/css">
<!--
@import url("estilos/estilos.css");
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="3">
<tr>
<td class="ft10"><div align="center" class="titleview">'.$x['titulo'].'</div></td>
</tr>
<tr>
<td class="geral">'.$x['noticia'].'</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td><div align="center" class="ft10"><a href="mailto:'.$autor.'" class="form">Desenvolvido por Diego Oliveira </a></div></td>
</tr>
</table>
';}
}
?>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000"> </td>
</tr>
</table>
<!--
body {
background-color: #CCCCCC;
}
-->
</style><table width="879" height="388" border="1" align="center">
<tr>
<td colspan="2" bgcolor="#000000"> </td>
</tr>
<tr>
<td width="106" valign="top"><p>Home</p>
<p>Fotos</p>
<p>Videos</p></td>
<td width="757" valign="top"><p><?php
include "includes/config.php";
if(!isset($_GET["id"])) {
echo '<div align=\"center\"><font face=\"Arial\" size=\"2\">O registro nao pode ser vizualisado verifique as configuraçoes!<meta http-equiv=\"refresh\" content=\"2; URL=exibir.php\"></font></div>';
} else {
$y = mysql_query("select * from tabela where id='".$_GET["id"]."' order by id limit 1") or die(mysql_error());
while ($x = mysql_fetch_array($y)) {
echo'
<title> '.$titulo.'</title>
<style type="text/css">
<!--
@import url("estilos/estilos.css");
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="3">
<tr>
<td class="ft10"><div align="center" class="titleview">'.$x['titulo'].'</div></td>
</tr>
<tr>
<td class="geral">'.$x['noticia'].'</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td><div align="center" class="ft10"><a href="mailto:'.$autor.'" class="form">Desenvolvido por Diego Oliveira </a></div></td>
</tr>
</table>
';}
}
?>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000"> </td>
</tr>
</table>
Comment