Foros del Web » Programando para Internet » PHP »

Por favor ayuda con este php

Estas en el tema de Por favor ayuda con este php en el foro de PHP en Foros del Web. Hola: Les cuanto, estoy haciendo un chat en flash, tengo un php que me graba las personas que entran en online.txt, yo necesito que cada ...
  #1 (permalink)  
Antiguo 01/05/2010, 13:46
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Por favor ayuda con este php

Hola:
Les cuanto, estoy haciendo un chat en flash, tengo un php que me graba las personas que entran en online.txt, yo necesito que cada 160 minutos se borre el usuario.
¿Se entiende?

El codigo php es:
<?
header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
// If you are using an old version of php, remove the next set of lines.
// or use $HTTP_POST_VARS["..."] instead.
$Enter = $_POST["Enter"];
$Name = $_POST["who"];


##The first 3 lines use a regular expression to match a pattern then replace it with nothing. The only reason for this is so we only allow necessary characters to be entered into the dxc_chat. This also takes out slashes which are sometimes added in the post headers to make the string friendly. You can erase or take these lines out if you want.

$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Name = stripslashes($Name);
$Name = ereg_replace("&", "and", $Name);
$Name = ereg_replace("<", "", $Name);
$Name = ereg_replace(">", "", $Name);
$Name = ereg_replace(".:::.", "", $Name);

/* cuss word filter
just comment out to get rid of it as you
would in a multi-line comment in SwishMax
and as I have in this comment.
Or you can add more words to the list*/

$Name = ereg_replace("shit", "s**t", $Name);
$Name = ereg_replace("fuck", "f**k", $Name);
$Name = ereg_replace("nigger", "******", $Name);
$Name = ereg_replace("piss", "****", $Name);
$Name = ereg_replace("pussy", "****", $Name);
$Name = ereg_replace("cocksucker", "****", $Name);
$Name = ereg_replace("dick", "****", $Name);

################################################## ##################################
########### Reading and Writing the new data to the online Database #############

if ($Enter == "Yes") {
#Next line tells the script which Text file to open.
$filename1 = "online.txt";

#Opens up the file declared above for reading

$fp = fopen( $filename1,"r");
$OldData = fread($fp, 2000);
fclose( $fp );


#Puts the recently added data into html format that can be read into the SwishMax Movie.
$date = date( "H:i");
$Input = "<font color=\"#666666\"><b>$Name</b> joined $date</font><br>.:::.";


#This Line adds the 'online=' part to the front of the data that is stored in the text file.

$New = "$Input$OldData";

#Opens and writes the file.

$fp = fopen( $filename1,"w+");
fwrite($fp, $New, 2000);
fclose( $fp );
}
################################################## ##################################
########## Formatting and Printing the Data from 'the online' to the SwishMax Movie ##

#Next line tells the script which Text file to open.
$filename1 = "online.txt";

#Opens up the file declared above for reading

$fp = fopen( $filename1,"r");
$Data = fread($fp, 2000);
fclose( $fp );

#Splits the Old data into an array anytime it finds the pattern .:::.
$DataArray = split (".:::.", $Data);


#Play with this, and cut what is not needed.
#Counts the Number of entries in the dxc_chat
$NumEntries = count($DataArray) - 1;

print "&TotalOnline=$NumEntries&online=";
for ($n = 0; $n < 27 ; $n++) {

print $DataArray[$n];
if (!$DataArray[$n]) {
Print "";
exit;
}
}



################################################## ##################################
############### End online Script
?>

Gracias.
  #2 (permalink)  
Antiguo 01/05/2010, 13:50
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Por favor ayuda con este php

Cita:
Iniciado por guillermo90 Ver Mensaje
Hola:
Les cuanto, estoy haciendo un chat en flash, tengo un php que me graba las personas que entran en online.txt, yo necesito que cada 160 minutos se borre el usuario.
¿Se entiende? [...]
claro que se entiende!!

pero... ¿que esperas? ¿que alguien lo haga por ti??
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 01/05/2010, 14:07
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Por favor ayuda con este php

Cita:
Iniciado por pateketrueke Ver Mensaje
claro que se entiende!!

pero... ¿que esperas? ¿que alguien lo haga por ti??
Es un foro de ayuda y pido ayuda porque no lo se hacer
  #4 (permalink)  
Antiguo 01/05/2010, 14:18
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Por favor ayuda con este php

Despues de tanta busqueda de ayuda pude hacer esto:
<?
header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
// If you are using an old version of php, remove the next set of lines.
// or use $HTTP_POST_VARS["..."] instead.
$Enter = $_POST["Enter"];
$Name = $_POST["who"];


##The first 3 lines use a regular expression to match a pattern then replace it with nothing. The only reason for this is so we only allow necessary characters to be entered into the dxc_chat. This also takes out slashes which are sometimes added in the post headers to make the string friendly. You can erase or take these lines out if you want.

$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Name = stripslashes($Name);
$Name = ereg_replace("&", "and", $Name);
$Name = ereg_replace("<", "", $Name);
$Name = ereg_replace(">", "", $Name);
$Name = ereg_replace(".:::.", "", $Name);

/* cuss word filter
just comment out to get rid of it as you
would in a multi-line comment in SwishMax
and as I have in this comment.
Or you can add more words to the list*/

$Name = ereg_replace("shit", "s**t", $Name);
$Name = ereg_replace("fuck", "f**k", $Name);
$Name = ereg_replace("nigger", "******", $Name);
$Name = ereg_replace("piss", "****", $Name);
$Name = ereg_replace("pussy", "****", $Name);
$Name = ereg_replace("cocksucker", "****", $Name);
$Name = ereg_replace("dick", "****", $Name);

################################################## ##################################
########### Reading and Writing the new data to the online Database #############

if ($Enter == "Yes") {
#Next line tells the script which Text file to open.
$filename1 = "online.txt";

#Opens up the file declared above for reading

$fp = fopen( $filename1,"r");
$OldData = fread($fp, 2000);
fclose( $fp );


#Puts the recently added data into html format that can be read into the SwishMax Movie.
$date = date( "H:i");
$Input = "<font color=\"#666666\"><b>$Name</b> joined $date</font><br>.:::.";


#This Line adds the 'online=' part to the front of the data that is stored in the text file.

$New = "$Input$OldData";

#Opens and writes the file.

$fp = fopen( $filename1,"w+");
fwrite($fp, $New, 2000);
fclose( $fp );
}
################################################## ##################################
########## Formatting and Printing the Data from 'the online' to the SwishMax Movie ##

#Next line tells the script which Text file to open.
$filename1 = "online.txt";

#Opens up the file declared above for reading

$fp = fopen( $filename1,"r");
$Data = fread($fp, 2000);
fclose( $fp );

#Splits the Old data into an array anytime it finds the pattern .:::.
$DataArray = split (".:::.", $Data);


#Play with this, and cut what is not needed.
#Counts the Number of entries in the dxc_chat
$NumEntries = count($DataArray) - 1;

print "&TotalOnline=$NumEntries&online=";
for ($n = 0; $n < 27 ; $n++) {

print $DataArray[$n];
if (!$DataArray[$n]) {
Print "";
exit;
}
}



################################################## ##################################
############### End online Script
?>
Pero no logro hacer que cada 160 minutos se borre el usuario que entro.
  #5 (permalink)  
Antiguo 01/05/2010, 14:37
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Por favor ayuda con este php

<?
//Al usar el boton se cierra la sesion
if ($_POST['CerrarSesion'])
{
session_destroy();

//Y redirecciona
header("Location: index2.php");
}


//Formulario con el boton
?>

algo asi, pero automatico, es decir cada 160 minutos se borre de la lista online el usuario

Etiquetas: favor
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:43.