• User Attivo

    invia messaggio privato

    ciao e auguri di buona pasquetta in ritardo 🙂 ho prelevato un vecchio code per inviare un messaggio privato a l'utente registrato non riesco a capire perchè da errore ```
    <?php
    if(isset($_SESSION['username']))
    {
    $form = true;
    $title = '';
    $recip = '';
    $message = '';
    if(isset($_POST['title'], $_POST['recip'], $_POST['message']))
    {
    $title = $_POST['title'];
    $recip = $_POST['recip'];
    $message = $_POST['message'];
    if(get_magic_quotes_gpc()) //qui da errore
    {
    $title = stripslashes($title);
    $recip = stripslashes($recip);
    $message = stripslashes($message);
    }
    if($_POST['title']!='' and $_POST['recip']!='' and $_POST['message']!='')
    {
    $title = mysqli_real_escape_string($dbh, $title);
    $recip = mysqli_real_escape_string($dbh, $recip);
    $message = mysqli_real_escape_string($dbh, $message);
    $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)
    {
    if($dn1['recipid']!=$_SESSION['userid'])
    {
    $id = $dn1['npm']+1;
    if(mysqli_query($dbh, 'insert into pm (id, id2, title, user1, user2, message, timestamp, user1read, user2read)values("'.$id.'", "1", "'.$title.'", "'.$_SESSION['userid'].'", "'.$dn1['recipid'].'", "'.$message.'", "'.time().'", "yes", "no")'))
    {
    ?>