Writing to file
Posted: Tue Sep 09, 2003 11:06 am
I've been making this bit of .php to write variables passed from a form to a file on our web hosting server. For some reason, I can't ever seem to find the file even though I think everything is in line.
Feel free to make some suggestions...
Every time I run the script I get the "true" echo for readable...
So that's about all I know. Please help.
Thanks
Feel free to make some suggestions...
Code: Select all
<?
// VARIABLES from FORM //
$first=$_POSTї'firstname'];
$last=$_POSTї'lastname'];
$sitename=$_POSTї'client'];
$email=$_POSTї'adress'];
$sitetype=$_POSTї'group'];
$sitenum=$_POSTї'sites'];
$doctors=$_POSTї'doctors'];
$ris1=$_POSTї'RIS1'];
$ris2=$_POSTї'RIS2'];
$ris3=$_POSTї'RIS3'];
$location=$_POSTї'location'];
// MAKE FILE //
$dataї"1"]=$name;
$dataї"2"]=$email;
$dataї"3"]=$sitename;
$dataї"4"]=$sitetype;
$dataї"5"]=$sitenum;
$dataї"6"]=$doctors;
$dataї"7"]=$location;
$dataї"8"]=$ris1;
$dataї"9"]=$ris2;
$dataї"10"]=$ris3;
$data1=serialize($data);
$path="/tmp/client.txt";
if(is_writable ("$path"))
{
$file=fopen($path, "w") or die("The File $path could not be opened");
fwrite($file, $data1);
fclose($file);
}
if(is_readable ($path))
{
chmod ($path, 0660);
$file=fopen($path, "w") or die("You frigg'n idiot. Quit now!");
fwrite($file, $data1);
echo "true";
fclose($file);
}
?>So that's about all I know. Please help.
Thanks