Código PHP:
<?
ob_start();
require("functions.php");
nocache();
if((isset($action))&&($action=="singin")){
include('includes/class.jabber.php');
$jab = new Jabber();
$jab->username = $_POST['login'];
$jab->password = $_POST['passwd'];
$jab->resource = "JabberWeb";
//$jab->enable_logging = TRUE;
$jab->log_filename = 'logs/logjabb.log';
$jab->Connect() or die("No me he podido conectar la Servidor de Jabber: ".$_POST['server']."");
$jab->SendAuth() or die("No me he podido autentificar");
$jab->SendPresence("available", "online");
if($jab->connected){
echo "<html>
<title>Jabber Web</title>
</head>
<script language=JavaScript src='includes/mx.js' ></script>
<link href='includes/mx.css' rel='stylesheet' type='text/css'>
<body bgcolor='#a2aace' topmargin='3'>
<div align='center'>
<center>
<table width='351' border='1' align='left' cellpadding='0' cellspacing='0' bordercolor='#111111' id='AutoNumber1' style='border-collapse: collapse'>
<tr>
<td valign='top'><form action='jabbermain.php?action=send' method='post' name='jabberform' id='jabberform'>
<table width='350' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='299'><textarea name='content' cols='50' rows='7' wrap='VIRTUAL' class='txt' id='content'></textarea></td>
<td width='51' rowspan='2' valign='top' class='txtcn'>Usuarios</td>
</tr>
<tr>
<td><input name='sendtxt' type='text' class='txt' id='sendtxt' size='45' value=''>
<input name='send' type='submit' class='txtcn' id='send' value='Enviar'></td>
</tr>
<tr>
<td colspan='2' class='txtcn'>Confeccionado por: MX Portal System. </td>
</tr>
</table>
</form></td>
</tr>
</table>
</center>
</div>
</body>
</html>";
}else{
echo "No conectado";
}
if((isset($_GET['action']))&&($_GET['action']=="send")&&($jab->connected)){
$contenido = $_POST['sendtxt'];
$cadena = explode("'",$contenido);
list($jid,$texto) = $cadena;
$jab->SendMessage($jid,"chat",NULL,array("body"=>$texto));
}
//$jab->SendMessage("[email protected]", "chat", NULL, array("body" => "Esto está OK"));
//$jab->Disconnect();
}
ob_end_flush();
?>