file errors
- From: computerwolf8@xxxxxxxxx
- Date: 19 Jan 2006 21:51:41 -0800
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;
?>
.
- Prev by Date: Form results on the same page using XMLHTTPRequest?
- Next by Date: Re: Warning: imap_open(): Couldn't open stream error
- Previous by thread: Form results on the same page using XMLHTTPRequest?
- Next by thread: Passing array of objects in SOAP
- Index(es):
Relevant Pages
|