ciao sto cercando di far funzionare questo code per inviare una comunicazione ho provato a modificarlo ma mi da errore title mysql_real_escape_string chiedo aiuto grazie
Codice PHP:
<?php
include('utility/config.php');
//We check if the user is logged
if(isset($_SESSION['username']))
{
$form = true;
$title = '';
$recip = '';
$message = '';
//We check if the form has been sent
if(isset($_POST['title'], $_POST['recip'], $_POST['message']))
{
$title = $_POST['title'];
$recip = $_POST['recip'];
$message = $_POST['message'];
//We remove slashes depending on the configuration
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$title = stripslashes($title);
$recip = stripslashes($recip);
$message = stripslashes($message);
}
//We check if all the fields are filled
if($_POST['title']!='' and $_POST['recip']!='' and $_POST['message']!='')
{
//We protect the variables
$title = mysql_real_escape_string($title); //da qui errore
$recip = mysql_real_escape_string($recip);
$message = mysql_real_escape_string($message);
//We check if the recipient exists
$dn1 = mysqli_fetch_array(mysqli_query($dbh,'select count(id) as recip, id as recipid, (select count(*) from pm) as npm from utenti where user_name="'.$recip.'"'));
if($dn1['recip']==1)
{
//We check if the recipient is not the actual user
if($dn1['recipid']!=$_SESSION['username'])
{
$id = $dn1['npm']+1;
//We send the message
if(mysqli_query($dbh,'insert into pm (id, id2, title, user1, user2, message, timestamp, user1read, user2read)values("'.$id.'", "1", "'.$title.'", "'.$_SESSION['username'].'", "'.$dn1['recipid'].'", "'.$message.'", "'.time().'", "yes", "no")'))
{
?>