El tema es este.
El AJAX chat tiene un archivo (users.php) que es así:
Código PHP:
<?php
/*
* @package AJAX_Chat
* @author Sebastian Tschan
* @copyright (c) Sebastian Tschan
* @license Modified MIT License
* @link https://blueimp.net/ajax/
*/
// List containing the registered chat users:
$users = array();
// Default guest user (don't delete this one):
$users[0] = array();
$users[0]['userRole'] = AJAX_CHAT_GUEST;
$users[0]['userName'] = null;
$users[0]['password'] = null;
$users[0]['channels'] = array(0);
// Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_CHAT_ADMIN;
$users[1]['userName'] = 'admin';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1);
// Sample moderator user:
$users[2] = array();
$users[2]['userRole'] = AJAX_CHAT_MODERATOR;
$users[2]['userName'] = 'moderator';
$users[2]['password'] = 'moderator';
$users[2]['channels'] = array(0,1);
// Sample registered user:
$users[3] = array();
$users[3]['userRole'] = AJAX_CHAT_USER;
$users[3]['userName'] = 'user';
$users[3]['password'] = 'user';
$users[3]['channels'] = array(0,1);
?>
Código PHP:
<?php
/*
* @package AJAX_Chat
* @author Sebastian Tschan
* @copyright (c) Sebastian Tschan
* @license Modified MIT License
* @link https://blueimp.net/ajax/
*/
// List containing the registered chat users:
$users = array();
// Default guest user (don't delete this one):
$users[0] = array();
$users[0]['userRole'] = AJAX_CHAT_GUEST;
$users[0]['userName'] = null;
$users[0]['password'] = null;
$users[0]['channels'] = array(0);
include '../../../config.php';
@mysql_query("SET NAMES 'utf8'");
$queEmp = "SELECT * FROM ava_users WHERE activate=1 ORDER BY id DESC";
$resEmp = mysql_query($queEmp, $con) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp> 0) {
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$id = $rowEmp['id'];
if ($rowEmp['admin'] == 1) {
$role = AJAX_CHAT_ADMIN;
}
else {
$role = AJAX_CHAT_USER;
}
echo "// Usuarios:<br />";
echo "$users[".$id."] = array();<br />";
echo "$users[".$id."]['userRole'] = ".$role.";<br />";
echo "$users[".$id."]['userName'] = '".$rowEmp['username']."';<br />";
echo "$users[".$id."]['password'] = '".$rowEmp['clavechat']."';<br />";
echo "$users[".$id."]['channels'] = array(0,1);<br /><br /><br />";
}
}
?>
Pero obviamente, y como esperaba, no funciona. Me da un error tal que así:
Código HTML:
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/habborev/public_html/chat/lib/data/users.php on line 39
A ver si podéis ayudarme a hacerlo bien o mediante otro método. Gracias de antemano. ^^