per il secondo:

Codice PHP:
<?php
@set_time_limit(10000);

         
mysql_connect($mysql_hostname,$mysql_use
r
,$mysql_password);
        
mysql_select_db($mysql_database);


        
$query"INSERT INTO dir_pages (ric, title, ing, cat) VALUES ('{$dat}' , '{$title}', '{$ing}', '{$cat}')";
        
mysql_query(addslashes($query)) or die(mysql_error());




header("Location: ins.php?ok=1"); 
?>
http://it2.php.net/manual/it/function.addslashes.php

quando estrai i dati dal database fai uno stripslashes() su quello che leggi


il primo problema detto così non è chiaro...