script designed to write and read $array[chat]
Code: Select all
function WriteToFile($firstname){
$str= "{$arrayї'chat']}.txt";
$Open = fopen ($str,"a");
if($Open){
fwrite ($Open,"$firstname");
fclose($Open);
$Worked=True;
} else {
$Worked = False;
}
return $Worked;
}
function readfromfile(){
$str = "{$arrayї'chat']}.txt";
$Open = fopen ($str,"r");
if($Open){
print("<HR><B><font color=white><a href="#latest" style=text-decoration:none>Comments:(To see the latest comment click here)</B></A><BR>\n");
$data = file($str);
for($n = 0; $n<count($data); $n++){
$getline = explode("\t",$dataї$n]);
print("<B>$getlineї0]\t$getlineї1]<HR>\n");}
fclose($Open);
}else{
print("<font color=white><B>Unable to present previous comments!<HR><B><font color=white><a href="#latest" style=text-decoration:none>Comments:(To see the latest comment click here)</B></A><BR>\n");
}
}