Buongiorno a tutti

Utilizzo uno script mysql php per inviare messaggi privati
all'interno del mio sito.

Tramite una casella di testo in amministrazione (message.php vedi codice
pagine in basso) inserisco un messaggio (testo + link) che viene inserito
in mysql e dopo recapitato ai singoli utenti.

************************************************** *********
PROBLEMA: quando invio un messaggio l'utente che lo riceve
vede solo testo e non collegamenti e immagini html cliccabili
dunque non mi accetta il codice html anche se invio un
messaggio con puro codice html (esempio:
Countries )
************************************************** *********

Arriva sempre solo codice di testo e mai codice html dunque non
arriva un messaggio con un collegamento cliccabile.

Ho notato che quando i messaggi inviati dall'amministazione
vengono inseriti in mysql vengono modificati e dunque il codice
html risulta alterato e dunque perde le sue funzioni nel momento
in cui utente riceve il messaggio.

esempio di messaggio salvato nel mysql (alterato da mysql)
(&lt A href=&quot http://google.it&quot &gt Google&lt /A&gt )

Chiedo un aiuto, se potete spiegatemi come poter risolvere in
modo semplice, sono alle prime armi con mysql.

Postatemi per favore una possibile soluzione al mio problema per
poter cosi inviare sempre tramite mysql messaggi con codice html
che risulta funzionante e i link cliccabili ai singoli utenti alla
ricezione del messaggio.

Grazie mille.

-------------------------------------------------------------------
codice pagina invio messaggi pannello amministratore (message.php)
-------------------------------------------------------------------

<?php
require ('config.php');
$user=$_COOKIE["usNick"];

$sql = "SELECT * FROM tb_users WHERE username='$user'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

mysql_close($con);
if ($row['account'] !="premium"){
echo"


Only Admin Can Send Messages To Members</p>
";
include ('footer.php');
exit();
}
?>

<script type="text/javascript">

/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

</script>


<?

if (isset($_POST["sendto"])) {


if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
echo "SECURITY CODE ERROR... ";


exit();
}
$sendfrom=$_COOKIE["usNick"];
$sendto=limpiar($_POST["sendto"]);
$comments=limpiar($_POST["comments"]);

if ($sendto==""){echo "Error"; exit();}
if ($comments==""){echo "Error"; exit();}

$eltiempo=time();
$lafecha=date("d-m-y H:i",$eltiempo);
require('config.php');
$query = "INSERT INTO tb_messenger (sendfrom, sendto, date, comments) VALUES('$sendfrom','$sendto','$lafecha','$comments ')";
mysql_query($query) or die(mysql_error());
mysql_close($con);
echo "

Your Message Has Been Sent Correctly";

?>
</font>

<?
exit();
}
?>

Use the form below to contact a member (for admin only).




<div align="center"><div id="form">
<fieldset>
<legend>All Fields Required</legend>

<form method="POST" action="index.php?op=3">


<table width="400" border="0" align="center">
<tr>
<td width="150" align="left"><label>Member</label></td>
<td width="250" align="left"><select name="sendto" class="combo" tabindex="1">
<option value=""></option>



<?
require('config.php');
$sendfrom=$_COOKIE["usNick"];
$tabla = mysql_query("SELECT * FROM tb_users ORDER BY username ASC"); // selecciono todos los registros de la tabla usuarios, ordenado por nombre
mysql_close($con);
while ($row = mysql_fetch_array($tabla)) {

echo "<option value='".$row["username"]."'>".$row["username"]."</option>

";

}
?>

</select></td>
</tr>
<tr>
<td width="150" align="left"><label>Comments</label></td>
<td width="250" align="left"><textarea name="comments" rows="20" maxlength="1000" onkeyup="return ismaxlength(this)" tabindex="2"></textarea></td>
</tr>

<tr>
<td width="150" align="left"></td>
<td width="250" align="right"><input type="submit" value="Submit" class="submit" tabindex="3" />
</td>
</tr>
</table>

</form>
</fieldset>
</div></div>

-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------
codice pagina ricezione messaggi dell'utente (readmessage.php)
-------------------------------------------------------------------
<?
session_start();
?>

<? include('header.php');?>

<? include('up_banner_468x60.php');?>

<?
require ('config.php');

function limpiare($mensaje)
{$mensaje = htmlentities(stripslashes(trim($mensaje)));
$mensaje = str_replace("'"," ",$mensaje);
$mensaje = str_replace(";"," ",$mensaje);
$mensaje = str_replace("$"," ",$mensaje);
return $mensaje;}
$id=limpiare($_GET["id"]);
$lole=$_COOKIE["usNick"];
$sql = "SELECT * FROM tb_messenger where id='$id' and sendto='$lole'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$query = "UPDATE tb_messenger SET status='read' where id='$id'"; mysql_query($query) or die(mysql_error());
mysql_close($con);
?>


<div align="center"><div id="form">
<fieldset>
<legend>Read Message</legend>

<form method="POST" action="replysms.php?to=<?= $row["sendfrom"] ?>">
<table width="400" border="0" align="center">
<tr>
<td width="150" align="left"><label>Date</label></td>
<td width="250" align="left"><? echo $row["date"]; ?></td>
</tr>
<tr>
<td width="150" align="left"><label>From</label></td>
<td width="250" align="left"><? echo $row["sendfrom"]; ?></td>
</tr>
<tr>
<td width="150" align="left"><label>Message</label></td>
<div style= width: 250px; height: 400px;

<? echo $row["comments"]; ?></div>
</tr>
<tr>
<td width="150" align="left"></td>
<td width="250" align="right"><input type="submit" value="Reply" class="submit" tabindex="4" />
</td>
</tr>
</table>
</form>
</fieldset>
</div></div>

<? include('down_banner_468x60.php');?>

<? include('footer.php'); ?>
-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------
struttura mysql parte di gestione dei messaggi inviati
-- --------------------------------------------------------

--
-- Table structure for table `tb_messenger`
--

CREATE TABLE IF NOT EXISTS `tb_messenger` (
`id` int(11) NOT NULL auto_increment,
`sendfrom` varchar(11) collate latin1_general_ci NOT NULL,
`sendto` varchar(11) collate latin1_general_ci NOT NULL,
`date` varchar(35) collate latin1_general_ci NOT NULL,
`comments` varchar(150) collate latin1_general_ci NOT NULL,
`status` varchar(11) collate latin1_general_ci NOT NULL default 'unread',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=22026 ;

-------------------------------------------------------------------------