83 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?
 | 
						|
			session_name( "INFDJwebsite" );
 | 
						|
			$v1="user_id";
 | 
						|
			$v2="user_nick";
 | 
						|
			$v3="user_auth";
 | 
						|
			session_register($v1,$v2,$v3);
 | 
						|
			session_start();
 | 
						|
 | 
						|
 require("addons/open_db.php");
 | 
						|
 if ( isset( $mesg ) && !isset( $refresh ) )
 | 
						|
 {
 | 
						|
   $sql_upd = "INSERT INTO miniChat (fecha, hora, usr, msg) VALUES";
 | 
						|
   $umsg = urlencode( strip_tags($mesg) );
 | 
						|
   if( isset( $user_auth ) && $user_auth ) 
 | 
						|
	  $sql_upd = $sql_upd . "(CURDATE(), CURTIME(), '$user_nick', '$umsg')"; 
 | 
						|
   else
 | 
						|
	  $sql_upd = $sql_upd . "(CURDATE(), CURTIME(), 'anonymous', '$umsg')"; 
 | 
						|
  $res = mysql_query( $sql_upd, $conexion ) OR die("No puedo realizar las Inserciones Personales<br>$sql_upd<br>".mysql_error($conexion)); 
 | 
						|
 | 
						|
 }
 | 
						|
 | 
						|
 $consulta = "SELECT fecha, usr, msg FROM miniChat ORDER BY id DESC LIMIT 15"; 
 | 
						|
 $res = mysql_query( $consulta, $conexion ) OR die("No puedo realizar la consulta<br>$consulta<br>".mysql_error($conexion)); 
 | 
						|
 | 
						|
?>
 | 
						|
 | 
						|
<html>
 | 
						|
<head></head>
 | 
						|
 | 
						|
<body bgcolor="#2067BE" text="#FFFFFF" topmargin="0"
 | 
						|
leftmargin="0">
 | 
						|
 | 
						|
<!-- textarea readonly
 | 
						|
-->
 | 
						|
<div style="overflow: auto;
 | 
						|
background-color:#2067BE;
 | 
						|
LAYER-BACKGROUND-COLOR:#2067BE;
 | 
						|
color: #FFFACD;
 | 
						|
font-family: arial, serif;
 | 
						|
font-size: 8pt;
 | 
						|
line-height: 105%;
 | 
						|
top: 0px;
 | 
						|
left: 0px;
 | 
						|
position: absolute;
 | 
						|
font-weight: medium;
 | 
						|
 | 
						|
scrollbar-base-color: #000000; 
 | 
						|
scrollbar-arrow-color: #FFFFFF;
 | 
						|
scrollbar-face-color: #gray; 
 | 
						|
scrollbar-shadow-color: #444444;
 | 
						|
border: 0px solid black; height: 100px; width: 100%;
 | 
						|
CLIP: rect(0,100%,100,0)">
 | 
						|
<? 
 | 
						|
  $numrows = mysql_num_rows( $res ); 
 | 
						|
  if (  $numrows > 0 ) 
 | 
						|
  { 
 | 
						|
   while ( $datos = mysql_fetch_array($res) ) 
 | 
						|
   { 
 | 
						|
     echo "$datos[0] :: "; 
 | 
						|
     if ( isset( $user_nick ) && strcmp( $datos[1], $user_nick ) == 0 )
 | 
						|
	echo "<font color=\"#00FF00\">$datos[1]</font>";
 | 
						|
     else
 | 
						|
	echo "$datos[1]";
 | 
						|
     echo " ::<br>".urldecode($datos[2])."<br><br>";
 | 
						|
   } 
 | 
						|
  } else { 
 | 
						|
    echo "No hay mensajes en el sistema"; 
 | 
						|
  }
 | 
						|
  mysql_free_result($res);
 | 
						|
  mysql_close($conexion); 
 | 
						|
?> </div>
 | 
						|
<!--
 | 
						|
textarea
 | 
						|
-->
 | 
						|
<form action="miniChat.php" method=post>
 | 
						|
 | 
						|
<input type=text maxlength=60 name="mesg"
 | 
						|
style="width: 100%; top: 100px; position: absolute; font-family: arial, serif;font-size: 8pt;background-color: #5088CC;border: 1px solid #97B8E1;">
 | 
						|
</form>
 | 
						|
 | 
						|
</body>
 | 
						|
</html>
 |