file errors



I have a code, which seems to work properly, but after execution, the
text file created becomes uneditable. If i run the code again, there
are no errors, but if I try to edit the file in ftp or the web
interface, it does not change. What would make the new file
unchangeable except by the code?

Code:
<?php
include('../session.php');

$id = $_GET[id];

$query="select * from fileupload where id= $id";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

$row=mysql_fetch_assoc($result);

$id = $row["id"];


$random = rand();
$string = md5($random);
$file = "tmp.txt";

if (is_writable($file))
{
if(!$handle = fopen($file,"a+"))
{
print("error");
}
else
{
if(!fwrite($handle, $string . "," . $id . ","))
{
print("error");
}
if(!fclose($handle))
{
print("error");
}
}
}
else
{
echo "The file $file is not writable";
}
echo $string;

?>

.



Relevant Pages

  • Floating point exception
    ... I have a problem with Matlab Compiler and Linux 64bit ... Then i tried to run the same Function on a Linux cluster ... # script for execution of deployed applications ... echo Usage: ...
    (comp.soft-sys.matlab)
  • Re: Force Default input to the std-in
    ... The background of this problem is that i have an command line ... to just push it with this single echo command right? ... You pressed $inputval key" ... the execution output is as follows ...
    (comp.unix.shell)
  • Re: Force Default input to the std-in
    ... The background of this problem is that i have an command line ... to just push it with this single echo command right? ... You pressed $inputval key" ... the execution output is as follows ...
    (comp.unix.shell)
  • Re: Floating point exception
    ... Karl Voit wrote in message ... # script for execution of deployed applications ... echo Usage: ... echo Setting up environment variables ...
    (comp.soft-sys.matlab)
  • VB.Net Code to read File Names
    ... So I'm looking for sample code that will instantiate MS Access (one that ... only exists during the execution of the VB.Net program) and read and input ... Mark ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)