codice:
<? include("top_foot.inc.php");
include("config.inc.php");
top();
if ($pass != $password):
echo "Password errata";
elseif (trim($titolo) == "" OR trim($testo) == ""):
echo "I campi Titolo e Testo devono essere riempiti!";
else:
$titolo = addslashes(stripslashes($titolo));
$autore = addslashes(stripslashes($autore));
$mail = addslashes(stripslashes($mail));
$testo = addslashes(stripslashes($testo));
$titolo = str_replace("<", "<", $titolo);
$titolo = str_replace(">", ">", $titolo);
$autore = str_replace("<", "<", $autore);
$autore = str_replace(">", ">", $autore);
$testo = str_replace("<", "<", $testo);
$testo = str_replace(">", ">", $testo);
$testo = nl2br($testo);
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
$query = "INSERT INTO news (titolo, testo, data, autore, mail) VALUES ('$titolo', '$testo', 'UNIX_TIMESTAMP()', '$autore', '$mail')";
if (mysql_query($query, $db))
echo "L'articolo è stato inserito correttamente";
else
echo "Erorre durante l'inserimento";
mysql_close($db); endif;
foot();
?>