Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/05/2010, 13:46
guillermo90
 
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.