<?php 
header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<?php 
/*	Users management for develooping flash chat.	        */
/*	version 1.6.5 Created by Juan Carlos PosŽ	            */
/*  corrected bug deleting users                            */
/*	juancarlos@develooping.com	                            */
error_reporting(7);
require ('required/config.php');
$chat_file_ok = "required/msg.txt";//message file

$users_file = "required/users.txt";//The file where you save users and passwords.


/*	check the user  */
/*	--------------- */
$text_string = join ('', file ($users_file));
$valid_user =  "valid";
if (ereg("$person\n kicked\n", $text_string)){
$valid_user = "kicked";
}
if (ereg("$person\n banned\n", $text_string)){
$valid_user = "banned";
}

if ($bye!="bye"){
$person = trim(str_replace("\r\n", "", $person));
echo "action=";
echo $action;
echo "&password=";
echo $password;
echo "&person=";

if ($action =="delete"){

//delete user and password
//------------------------

$text_string = join ('', file ($users_file));
$new_list= ereg_replace ("$person\n $password\n", "", $text_string);
$fusers = fopen($users_file, "w");
$fwusers = fwrite($fusers, $new_list);
fclose($fusers);


if((strval(trim($new_list))=="") and ($delete_empty_room=="yes")){//if not users delete messages
$fuchat = fopen($chat_file_ok, "w");
$blanktext="";
$fwuchat = fwrite($fuchat, $blanktext);
fclose($fchat);
}

}

if ($action =="add"){
$number_to_add = 1;
$number_to_rest = 1;
$save_person_temp = $person;

//kick inactive users and delete kicked and banned users
//------------------------------------------------------

$actual_hour= date ("H");
settype($actual_hour,"integer");
$actual_minute= date ("i");
settype($actual_minute,"integer");
$actual_timing= (3600*$actual_hour)+(60*$actual_minute)+$correct_time;
settype($actual_timing,"integer");

$lines = file($users_file);
$a = count($lines);

for($i = $a; $i >= 0 ;$i=$i-2){
$each_user = strval($lines[$i]);//each connected user
$each_user = str_replace ("\n","", $each_user);
$each_password = strval($lines[$i+1]);
$each_password = str_replace ("\n","", $each_password);
$each_password = trim($each_password);
if (($each_password=="kicked") or($each_password=="banned")){
$text_string = join ('', file ($users_file));
$new_list= ereg_replace ("$each_user\n $each_password\n", "", $text_string);//delete kicked users
$fusers1 = fopen($users_file, "w");
$fwusers1 = fwrite($fusers1, $new_list);
fclose($fusers1);
if((strval(trim($new_list))=="") and ($delete_empty_room=="yes")){//if not users delete messages
$fuchat1 = fopen($chat_file_ok, "w");
$blanktext="";
$fwuchat1 = fwrite($fuchat1, $blanktext);
fclose($fuchat1);
}
}

$message_lines = file($chat_file_ok);	
$message_count = count($message_lines);

for($j = $message_count; $j >= 0 ;$j--){	
$eachmessage= strval($message_lines[$j]);

if (ereg ("\((.*):(.*):..\) $each_user : ", $eachmessage, $thetime)){// the last message this user wrote
$last_hour=strval($thetime[1]);
settype($last_hour,"integer");
$last_minute=strval($thetime[2]);
settype($last_minute,"integer");
$last_timing= (3600*$last_hour)+(60*$last_minute);
settype($last_timing,"integer");
$j=0;// finish the loop for this user
//if the last message is more than x minutes old, delete user
if(!$minutes_to_delete){$minutes_to_delete=15;}
if ((($actual_timing - $last_timing) > ($minutes_to_delete*60)) or ($last_timing > $actual_timing and $last_timing < (86400-($minutes_to_delete*60)) and $actual_timing > ($minutes_to_delete*60))){
$text_string = join ('', file ($users_file));
$new_list= ereg_replace ("$each_user\n $each_password\n", "", $text_string);//delete inactive user
$fusers2 = fopen($users_file, "w");
$fwusers2 = fwrite($fusers2, $new_list);
fclose($fusers2);
if((strval(trim($new_list))=="") and ($delete_empty_room=="yes")){//if not users delete messages
$fuchat2 = fopen($chat_file_ok, "w");
$blanktext="";
$fwuchat2 = fwrite($fuchat2, $blanktext);
fclose($fuchat2);
}
}
}
}	
}

//correct existing name adding a number
//-------------------------------------

$text_string = join ('', file ($users_file));

while (ereg ("$person(\n)?", $text_string)){//repeat while name is taken
$last_character = substr($person, -$number_to_rest);//look for the last characters in the name
$test_last_character = $last_character;
settype($test_last_character,"integer");

if (strval($test_last_character) == $last_character) {// last character is a number;
$save_person_temp = substr($person, 0, strlen($person)-$number_to_rest);
}

$person = $save_person_temp.$number_to_add;// replace last character;
$number_to_add++;
$number_to_rest = strlen($number_to_add);
}

//write entering message
//----------------------

$text_to_write = date ("(H:i:s)",time()+$correct_time)." ".$person." : ".$enter_string."\n";//compound single message
$fuchat3 = fopen($chat_file_ok, "a");
$fwuchat3 = fwrite($fuchat3, "$text_to_write");// message is appended to the msg.txt file
fclose($fuchat3);

//add user and password
//---------------------

$fusers3 = fopen($users_file, "a");
$fwusers3 = fwrite($fusers3, "$person\n $password\n");
fclose($fusers3);
}

echo $person;
echo "&usuarios=";

$lines = file($users_file);
$a = count($lines);
/*	render user list	*/
/*	-------------------	*/
//for($i = $a; $i >= 0 ;$i=$i-2){
//no invert with this line, comment this and uncomment the previous one to invert
for($i = 0; $i<$a+1 ;$i=$i+2){
$estate_to_see=	trim(strval($lines[$i+1]));	
if(($estate_to_see!="kicked") and ($estate_to_see!="banned")){
//create link for private message
echo "<a href='private_message.php?person=".$person."%26password=".trim(strval($password))."%26dest=".trim(strval($lines[$i]))."' target='private_messages'>".$lines[$i]."</a>";}
	}
	
}else{

//write exit user message
//-----------------------
// if it's not written yet???

$chatlines = file($chat_file_ok);
$acount = count($chatlines);
$the_line_value= trim(strval($chatlines[$acount-1]));
$trimmed_bye = substr ($bye_user, 1, -1); 
if(!ereg("\(..:..:..\) $person : .$trimmed_bye.", $the_line_value)){
$text_to_write = date ("(H:i:s)",time()+$correct_time)." ".$person." : ".$bye_user."\n";//compound single message
$fuchat4 = fopen($chat_file_ok, "a");
$fwuchat4 = fwrite($fuchat4, "$text_to_write");// message is appended to the msg.txt file
fclose($fuchat4);

}
	
//delete user and password
//------------------------

$text_string = join ('', file ($users_file));
$new_list= ereg_replace ("$person\n $password\n", "", $text_string);
$fusers4 = fopen($users_file, "w");
$fwusers4 = fwrite($fusers4, $new_list);
fclose($fusers4);

if((strval(trim($new_list))=="") and ($delete_empty_room=="yes")){//if not users delete messages
$fuchat5 = fopen($chat_file_ok, "w");
$blanktext="";
$fwuchat5 = fwrite($fuchat5, $blanktext);
fclose($fuchat5);
}

// window for dimissed user
//-------------------------

if($valid_user == "kicked"){
$bye_string=$bye_kicked_user;
}	

if($valid_user == "banned"){
$bye_string=$bye_banned_user;
}
?>	
<html><head><title><?echo htmlentities($bye_string)." ".$person;?>
</title></head><body bgcolor="#EEEEEE">
<script language="JavaScript">
// Set the following variable to the number of seconds the browser
// will wait before closing the window.
var gWindowCloseWait = 3;

function SetupWindowClose()
{
	window.setTimeout("window.close()",gWindowCloseWait*1000);
}

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
	IEmac = ((document.all)&&(isMac)) ? true : false;
	IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

// Call the following with your function as the argument
SafeAddOnload(SetupWindowClose);

</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr><td align="center" valign="middle">
<center><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><?echo htmlentities($bye_string)." ".$person;?></center>
</font>
</td></tr></table>
</body></html>
<?
}
?>	
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
	<head>
            <title>e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.</title>

                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="Buscador de proyectos ETSI" />
<meta name="author" content="Daniel Callejo"/>
<meta name="author" content="Federico L&oacute;pez"/>
<meta name="author" content="Juli&aacute;n P&eacute;rez"/>
<meta name="author" content="Jos&eacute; Mar&iacute;a Vidal Vidal"/>
<base href="/bibing/proyectos/" /><link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="./publico/css/estructura.css" type="text/css" />
<link rel="stylesheet" href="./publico/css/bootstrap.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="./publico/css/enlaces-capas.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/pestanas.css" type="text/css"  /> 
<link rel="stylesheet" href="./publico/css/formularios.css" type="text/css" />
<link rel="stylesheet" href="./publico/css/lightbox.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/autocompleter.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/resultados.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/milista.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/explorador.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/ultimos.css" type="text/css"  />
<link rel="stylesheet" href="./publico/css/contactar.css" type="text/css"  />
<!-- <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> -->
<script src="./publico/javascript/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="./publico/javascript/bootstrap.js" type="text/javascript"></script>

<script src="./publico/javascript/mootools-1.2.4-core.js" type="text/javascript"></script>
<script src="./publico/javascript/mootools-1-1.2.4.2-more.js" type="text/javascript"></script>
<script src="./publico/javascript/targetbl.js" type="text/javascript"></script>
<script src="./publico/javascript/mensajes.js" type="text/javascript"></script>
<script src="./publico/javascript/form.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Observer.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Autocompleter.js" type="text/javascript"></script>
<script src="./publico/javascript/autocompleter/Autocompleter.Request.js" type="text/javascript"></script>
<script src="./publico/javascript/domready.js" type="text/javascript"></script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8T1TSNC1QY"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-8T1TSNC1QY');
</script>



<script type="text/javascript">
function seleccionar_todo(){
   for (i=0;i<document.formulario_marcados.elements.length;i++)
      if(document.formulario_marcados.elements[i].type == "checkbox")
         document.formulario_marcados.elements[i].checked=1
}
function deseleccionar_todo(){
   for (i=0;i<document.formulario_marcados.elements.length;i++)
      if(document.formulario_marcados.elements[i].type == "checkbox")
         document.formulario_marcados.elements[i].checked=0
} 
</script>
	</head>
    <body style="min-width: 960px; background-color: #e2e2e2; height: 100%">	
		<a name="arriba"></a>
<div>
<div id="header">
    <table id="Tabla_01" height="105" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <img src="./publico/imagenes/cabecera/banner_new2_01.jpg" width="3" height="105" alt="">
        </td>
        <td>
            <img src="./publico/imagenes/cabecera/banner_new2_02.jpg" width="100" height="105" alt="">
        </td>
        <td width="100%" align="right"  style="min-width: 613px; background-repeat: no-repeat; background-position: top right; font-size: medium; font-weight: bold; color: white;">
            <table width="100%" height="105" border="0">
                <tr>
                    <td style=" vertical-align: top; width: 547px">
                        <!-- <a style="text-decoration: none" href="./"><img src="./publico/imagenes/cabecera/banner_new2_03.jpg"alt=""></a> -->
                        <a style="text-decoration: none" href="/bibing/proyectos/"><img src="./publico/imagenes/cabecera/banner_new2_03.jpg"alt=""></a>
                     </td>
                     <td  background="./publico/imagenes/cabecera/banner_new2_04.jpg" style="background-repeat: no-repeat; background-color: #c6d4e8;"><br><br><br>
                         &nbsp;
                        </td>
                    </tr>
             </table>
        </td>
    </tr>
    <tr style="border-top: 1px solid #ffffff;">
        <td colspan="3" id="menu_sup" style="font-size: small; text-align: right; background-color: #9c1f2f; vertical-align: bottom">
             
					<a href="/bibing/proyectos/" class="enlace " style=" color: #ffffff">Inicio&nbsp;&nbsp;|</a>
					<a href="/bibing/proyectos/acerca/" style=" color: #ffffff" class="enlace ">&nbsp;&nbsp;Acerca de&nbsp;&nbsp;|</a>
					
					<a href="/bibing/proyectos/contactar/" style=" color: #ffffff" class="enlace ">&nbsp;&nbsp;Contactar&nbsp;&nbsp;</a>
			 <!--       <a href="/bibing/proyectos/ayuda/" style=" color: #ffffff" class="enlace  ">&nbsp;&nbsp;Ayuda&nbsp;&nbsp;|</a> -->
					<!-- <form id="idioma" class=""  method="post" action="">
					<div class="inline" style="color: white">
					<input type="submit" class="tipo_letra " style=" color: #ffffff"name="idioma" value="Castellanossss" />&nbsp;&nbsp;
					</div>	
					</form> -->
			        </td>

    </tr>
    </table>
</div>
<br><br>
<div class="colmask rightmenu">
<div class="panel panel-default" style="margin:20px">
            <div class="panel-heading"><h4>DISEÃ‘O DE HERRAMIENTAS PARA PORTAL DE GESTIÃ“N DE CENTROS DOCENTES</h4><h5 style="color:grey"><span class="glyphicon glyphicon-user""></span> : <b>LEIVA JIMÃ‰NEZ, ANDRÃ‰S</b><br><span class="glyphicon glyphicon-book""></span>  :<b> Ingenier&iacute;a TelecomunicaciÃ³n</b></h5></div><div class="panel-body"><div class="contenido_proyecto"><div class="titulo2_explorador">Contenido del proyecto:</div><div class="ruta"><a href="use/abreproy/11109">Directorio ra&iacute;z</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252F">proyecto</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252F">proyecto</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252F">chat</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252Fchat%252F">chat</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a href="use/abreproy/11109/direccion/proyecto%252Fproyecto%252Fchat%252Fchat%252Fusers.php%252F">users.php</a></div><div class="listing"></div></div></div></div>
</div>
</div>

        
	</body>
 
 
<!-- Inicio Google Analytics -->
<!--
	<script type="text/javascript">
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	</script>
	
	<script type="text/javascript">
		try {
		var pageTracker = _gat._getTracker("UA-7789620-1");
		pageTracker._trackPageview();
	} 
		catch(err) {}
	</script>
-->
<!-- Fin Google Analytics -->

</html>

