- Home
- Categorie
- Coding e Sistemistica
- Coding
- form doppio^_^
-
form doppio^_^
ciao ragazzi questo è un file che mi invia un messaggio il problema è che vorrei che se nella mia barra di testo MSG_POSTA se inserisco
tizio, caio, sempronio
il messaggio venga inviato sia a tizio sia a caio sia a sempronio è possibile? thx^_^[php]
<html><?PHP
session_start();
include "../controlla_login.php";
include "../config.inc.php";
/PASSAGGIO DELLE VARIABILI INIZIALI/
$TO_POSTA=$_POST['TO_POSTA'];
$OBJ_POSTA=$_POST['OBJ_POSTA'];
$MSG_POSTA=$_POST['MSG_POSTA'];
//LANCIO LA QUERY PER VERIFICARE L'ESISTENZA DELL'UTENTE
$sqlver = "SELECT * FROM USERS WHERE USERNAME = '$TO_POSTA'";
$queryver = @mysql_query ($sqlver, $connessione) or die(mysql_error());
$num_user = mysql_num_rows($queryver);
//SE ESISTE PROCEDO CON L'INVIO DEL MESSAGGIO
if ($num_user == "1") {
$MSG_POSTA = str_replace("<", "<", $MSG_POSTA);
$MSG_POSTA = str_replace(">", ">", $MSG_POSTA);
$MSG_POSTA = str_replace("'", "'", $MSG_POSTA);
$MSG_POSTA = nl2br($MSG_POSTA);
//$DATA_POSTA = date ("d/m/Y H:i:s");
//formattazione data
// setto data e ora in base alla linga locale
setlocale (LC_TIME,"it_IT");
// metto data e ora in un array
$DATAORIG = time();
$date_time_array = getdate($DATAORIG);
$hours = $date_time_array['hours'];
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];
$DATAORIG = mktime($hours,$minutes,$seconds);
//fine formattazione data
$DATA_POSTA = strftime('%H : %M - %A %d %B %Y',$DATAORIG);
$sql = "INSERT INTO POSTA (FROM_POSTA,TO_POSTA,OBJ_POSTA,MSG_POSTA,DATA_POSTA,NEW_POSTA) VALUES ('$_SESSION[USERNAME]','$TO_POSTA','$OBJ_POSTA','$MSG_POSTA','$DATA_POSTA','1')";
$query = @mysql_query ($sql, $connessione) or die(mysql_error());
?>
<?
/REDIRECT ALLE PAGINE/echo "<link rel='stylesheet' href='../stile.css' type='text/css'>";
echo "<div align=center class=RedTit>Messaggio di posta inviato.</div>";
}
?>
<script language="JavaScript">
function Go() {
top.location.href='posta.php';
}
</script>
<noscript></noscript>
<body onLoad="setTimeout('Go()',1000);">
<? //SE NON ESISTE PROCEDO COL REDIRECT ALLA PAGINA DELLA POSTA
if ($num_user == "0") {
echo "<link rel='stylesheet' href='../stile.css' type='text/css'>";
echo "<div align=center class=RedTit>Il destinatario non esiste.</div>";
?>
<script language="JavaScript">
function Go() {
top.location.href='posta.php';
}
</script>
<noscript></noscript>
<body onload="setTimeout('Go()',1000);">
<?
}
@mysql_close ($connessione);
?>
[/php]
-
uppatina ed help^_^
-
ho trovato la soluzione da solo^^ la posto per chi volesse ^^
uso explode() per la stringa con i nomi e poi con un ciclo foreach lo faccio fungere^^