Visualizzazione dei risultati da 1 a 10 su 13

Visualizzazione discussione

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2015
    Messaggi
    15

    Query di inserimento che non funziona interamente ..

    Ciao a tutti,
    ho una pagina php che riceve dati da form (e in parte legge altri dati da db) per l'invio di un sms.
    Ho fatto in modo che dopo l'invio viene loggata nel db tutta l'operazione.
    Lo script funziona, ma non mi memorizza nel db il valore nel campo desesitoinv_sms (dovrebbe scrivermi il valore di $esito). Eppure il contenuto me lo stampa a video prima della query.
    Qualcuno sa dirmi perchè???
    Grazie in anticipo

    Codice PHP:
    /* Leggo le impostazioni per l'invio degli SMS da Parametri Genarali  */
    $query "SELECT sms_gateway, sms_username, sms_password, sms_mittalf, sms_tsmscont FROM config_settings WHERE sett_id = 1";
    $result mysql_query($query);
    $number mysql_num_rows($result);

    /* Metto in una variabile i parametri di invio  letti dal DB */
    $record mysql_fetch_array($result);
    $sendgateway $record['sms_gateway'];
    $sendusername $record['sms_username'];
    $sendpassword $record['sms_password'];
    $sendcodute $record['sms_codute'];
    $sendstring $record['sms_mittalf'];
    $sendtiposms $record['sms_tsmscont'];

    // Recupero altri dati per eseguire la query di inserimento nel db
    $senderstring $_POST['sender_string'];
    $tiposms $_POST['tiposms'];
    $celldest $_POST['recipients']; // Per log e visualizzaione post invio
    $text $_POST['text'];
    $idrifmess $_POST['idrifmessaggio'];
    $nomedest $_POST['nomedest'];
    $iduser $_POST['idoperatore'];    // Id utente che esegue l'invio
    $username $_POST['username'];     // Nome utente che esegue l'invio
    $dtorainvio date ("Y-m-d H:i:s"); 

     
    var_dump(httpPost(array(
     
    'user' => $sendusername,
    'pass' => $sendpassword,
    'rcpt' => $celldest,
    'data' => $text,
    'sender' => $sendstring,
    'qty' => $tiposms,
    ),
    'app.smsend.it' 
    ));
    function 
    httpPost($fields$host 'app.smsend.it'$url =
     
    '/sms/send.php')
     { 
    $qs = array();
    foreach (
    $fields as $k => $v)
    $qs[] = $k.'='.urlencode($v);
    $qs join('&'$qs);
    $errno $errstr '';
    if (
    $fp = @fsockopen('app.smsend.it'80$errno$errstr,
     
    30))
    {
     
    fputs($fp"POST ".$url." HTTP/1.0\r\n");
    fputs($fp"Host: ".$host."\r\n"); 
    fputs($fp"User-Agent: PHP/".phpversion()."\r\n"); 
    fputs($fp"Content-Type:application/x-www-form-urlencoded\r\n"); 
    fputs($fp"Content-Length: ".strlen($qs)."\r\n"); 
    fputs($fp"Connection: close\r\n"); 
    fputs($fp"\r\n".$qs); 
    $content ''
    while (!
    feof($fp)) 
    $content .= fgets($fp1024); 
    fclose($fp);
     }

    // Metto in una nuova variabili il log completo dell'invio per memorizz nel db
    $esito $content

    //   visualizzo messaggio
    if (strpos($esito"KO")===FALSE
    echo 
    "MESSAGGIO INVIATO CON SUCCESSO! ";
    else
    print 
    "MESSAGGIO NON INVIATO! ";
    print 
    $esito;
    print 
    "<br>";
    print 
    "<br>";
    return 
    preg_replace("/^.*?\r\n\r\n/s"''$content);
    return 
    false;
    }

    //  Eseguo la query per inserire i dati del SMS nel DB
    $query1 mysql_query("INSERT INTO mod_contatti_sms (idrifmsg_sms, mittstring_sms, nomedest_sms, celldest_sms, testo_sms, dtorainv_sms, nomeuteinv_sms, iduteinv_sms, tipo_sms, esitoinv_sms, desesitoinv_sms) VALUES ('$idrifmess', '$sendstring', '$nomedest', '$celldest', '$text', '$dtorainvio', '$username', '$iduser', '$tiposms', ' ', '$esito')"); 
    Ultima modifica di ninext72; 31-07-2015 a 16:47

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.