cioè ?
cmq ho notato che nell'altro db che ho in una tabella c'è un template di invision con tanto di " tranquillamente ... senza slashes... cmq ti posto il codice della pagina che immette i dati nel db sql
Codice PHP:
<?php
//inculdo la configurazione
include 'config.inc.php';
//includo il parser BB
include 'cbparser.php';
//connetto al myql
$db = mysql_connect($db_host, $db_user, $db_password) or die ('Problema nella connessione al database');
//controllo
if ($db == FALSE){
echo "<center>Problema nella connessione al database</center>
";
} else {
echo "<center>connessione avvenuta</center>
";
}
//chiedo il responso
//connetto al db
$sel_db = mysql_select_db($db_name, $db)
or die ("<center>Errore nella selezione del database. Verificare i parametri nel file config.inc.php</center>");
if ($sel_db == FALSE){
echo "<center>Db nn trovato </center>
";
} else {
echo "<center>Db trovato </center>
";
}
//controllo delle cosette
if ( trim($titolo) == "" OR trim($articolo_form) == "" OR trim($aut_name) == "" OR trim($aut_mail) == ""){
echo "<center>I campi obbligatori devono essere riempiti!</center>";
echo "<meta http-equiv=\"refresh\" content=\"2;URL=index.php\">";
}
else {
//pro e contro
if ($pro_form != ""){
$pro='<center><table width="10%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%">[img]pro_contro_r2_c1.gif[/img]</td>
<td width="58%">[img]pro_contro_r2_c2.gif[/img]</td>
<td width="30%">[img]pro_contro_r2_c3.gif[/img]</td>
</tr>
<tr>
<td background="pro_contro_r3_c1.gif"></td>
<td background="pro_contro_r3_c2.gif">'.$pro_form.'</td>
<td background="pro_contro_r3_c3.gif"></td>
</tr>
<tr>
<td>[img]pro_contro_r4_c1.gif[/img]</td>
<td>[img]pro_contro_r4_c2.gif[/img]</td>
<td>[img]pro_contro_r4_c3.gif[/img]</td>
</tr>
</table></center>';
}else{
$pro="";
}
if ($contro_form != ""){
$contro='<center><table width="10%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%">[img]pro_contro_r2_c1.gif[/img]</td>
<td width="58%" valign="bottom">[img]pro_contro_r6_c2.gif[/img]</td>
<td width="30%">[img]pro_contro_r2_c3.gif[/img]</td>
</tr>
<tr>
<td background="pro_contro_r3_c1.gif"></td>
<td background="pro_contro_r3_c2.gif">'.$contro_form.'</td>
<td background="pro_contro_r3_c3.gif"></td>
</tr>
<tr>
<td>[img]pro_contro_r4_c1.gif[/img]</td>
<td>[img]pro_contro_r4_c2.gif[/img]</td>
<td>[img]pro_contro_r4_c3.gif[/img]</td>
</tr>
</table></center>';
}else{
$contro="";
}
$articolo=bb2html($articolo_form, "");
$header= $header_form ;
$query = "INSERT INTO articoli (chiavi,header,titolo,articolo,aut_name,aut_mail,pro,contro) VALUES ('$chiavi','$header','$titolo','$articolo','$aut_name','$aut_mail','$pro','$contro')";
//controllo che sia stato aggiunto
if (mysql_query($query, $db)) {
echo "<meta http-equiv=\"refresh\" content=\"5;URL=index.php\"><center>L'articolo è stato inserito correttamente, attendi pochi secondi e verrai reindirizzato</center>";
$sql = "select max(id) as 'last_id' from articoli";
$cmd = mysql_query ($sql);
$last_id = mysql_fetch_assoc ($cmd);
echo "<center>L'url del tuo articolo è <a href=\"index.php?idarticolo=".$last_id['last_id']."\">index.php?idarticolo=".$last_id['last_id']."</a></center>";
}
else
echo "<center>Errore durante l'inserimento</center>
";
}
mysql_close($db);
?>
e della index che li riceve
Codice PHP:
<?php
//configurazione
include 'config.inc.php';
//if iniziale
if ($idarticolo == ""){
include 'cutenews/show_news.php';
} else {
//connessione
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE){
echo "<center>connessione fallita su $db_host</center>
";
} else {
//selezione db
mysql_select_db($db_name, $db)
or die ("<center>Errore nella selezione del database. Verificare i parametri nel file config.inc.php</center>");
//cerca i risultati
$result = mysql_query("SELECT * FROM $nome_tabella WHERE id='$idarticolo'")
or die(mysql_error());
//controllino
if(mysql_num_rows($result)){
//e da i risultati
while($record = mysql_fetch_array($result)) {
$titolo_alto=$record['titolo'];
//template dell'articolo:
echo $record['header'];
echo '<table border="0" cellpadding="0" cellspacing="0" width="558">
<tr>
<td width="37">[img]spacer.gif[/img]</td>
<td width="486">[img]spacer.gif[/img]</td>
<td width="34">[img]spacer.gif[/img]</td>
<td width="10">[img]spacer.gif[/img]</td>
</tr>
<tr>
<td colspan="3">[img]articoli_r2_c4.jpg[/img]</td>
<td>[img]spacer.gif[/img]</td>
</tr>
<tr>
<td>[img]articoli_r3_c4.jpg[/img]</td>
<td background="articoli_r3_c5.jpg">[b]'.$record['titolo'].'[/b]</td>
<td>[img]articoli_r3_c8.jpg[/img]</td>
<td>[img]spacer.gif[/img]</td>
</tr>
<tr>
<td>[img]articoli_r5_c4.jpg[/img]</td>
<td>[img]articoli_r5_c5.jpg[/img]</td>
<td>[img]articoli_r5_c8.jpg[/img]</td>
<td>[img]spacer.gif[/img]</td>
</tr>
<tr>
<td background="articoli_r6_c4.jpg"></td>
<td background="articoli_r5_c3.jpg">
<div align="justify">'.$record['articolo'].'</div></p>
[b]A cura di [/b][email="'.$record['aut_mail'].'"]'.$record['aut_name'].'[/email]</p></td>
<td background="articoli_r7_c4.jpg"></td>
<td>[img]spacer.gif[/img]</td>
</tr>
<tr>
<td>[img]articoli_r7_c2.jpg[/img]</td>
<td>[img]articoli_r7_c3.jpg[/img]</td>
<td>[img]articoli_r9_c4.jpg[/img]</td>
<td>[img]spacer.gif[/img]</td>
</tr>
</table>';
echo $record['pro'];
echo "
";
echo $record['contro'];
}
}else{
echo "<center><img src=\"errore_articolo.jpg\" border=\"0\" alt=\"Errore\"></center>";
}
}
//chiude la comunicazione con mysql
mysql_close($db);
}
?>
raga posso solo che contare su di voi