Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/03/2004, 11:42
Section1
 
Fecha de Ingreso: diciembre-2003
Mensajes: 173
Antigüedad: 20 años, 4 meses
Puntos: 1
Problema con un chat para bannear

Hola, necesito de vuestra ayuda una vez más. Estoy instalando un chat con php en mi web. Lo he sacado de Hotscripts.com. Pero la duda va halli, como hago para bannear a los usuarios? Me gustaria añadir esta funcion que el chat no posee. Para ello e intentado reproducir la funcion de logout pero sin que la haga el propio usuario, (porque seria tonto bannearse uno mismo). La question es que no lo consigo. Espero que podais ayudarme. Aqui abajo os indico el codigo para que los usuarios hagan logout del chat, por si os ayuda en algo.
Código PHP:
<?
function do_logout()
{
 global 
$dbh,$usersdb,$livedb,$livetable;

 
$uid  $_SESSION['MY_UID'];
 
$rand $_SESSION['MY_RAND'];

 
db_connect($livedb);

 
// Update basic info like time online, credits, etc:
 
list($handle,$creds,$time_online,$prefs) = user_update('','0',$uid,$rand);


 
// Update user stats about time online, number of logins, etc:

 
db_select($usersdb);

 
$day   date("j",time());
 
$month date("n",time());
 
$year  date("Y",time());

 
$result mysql_query("SELECT ID, day_$day FROM user_stats WHERE (uid = $uid) AND (month = $month) AND (type = 1) AND ( year = $year)") or die(mysql_error());
 
$row    mysql_fetch_row($result);
 
mysql_free_result($result);

 
// If there are exisiting stats, update them:

 
if ($row[0]){

  
$time_online $time_online $row[1];
  
mysql_query("UPDATE user_stats SET day_$day = '$time_online' WHERE (ID = $row[0])");


 
// Otherwise start a new set of stats:

 
}else{
  
mysql_query("INSERT INTO user_stats VALUES (NULL,'$uid','1','$month','$year','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')");
  
mysql_query("UPDATE user_stats SET day_$day = '$time_online' WHERE (uid = $uid) AND (month = $month) AND (type = 1) AND (year = $year)");
 }

  
// Remove them from the 'Live' database, and expire any cookies:


  
db_select($livedb);
  
mysql_query("DELETE from $livetable WHERE (uid = $uid)");
  
mysql_query("DELETE from user_messages WHERE (private_uid = $uid AND is_copy = 0 AND has_been_read = 1) OR (creator_uid = $uid AND (private_uid = '-1' OR is_copy = 1))");

  foreach (
$_SESSION as $name => $value){ unset($_SESSION[$name]); }

  
mysql_close();
  
welcome("logout"); // Return them to the welcome screen.
}
?>
Gracias de nuevo