"); /*echo("$limitedtextarea");*/ $file_name = "/usr/local/apache2.2/htdocs/take-away/adverts/" + $account_no + ".txt"; $sbuf = stat("$file_name"); if (#$sbuf > 0) { system(": > $file_name");/*truncates the file to zero length without changing permissions or date created or modified*/ } $fd = open("$file_name", ">"); if ($fd < 0) { $result = system("echo '$limitedtextarea' > $file_name"); } else { $result = fprintf($fd,"$limitedtextarea"); close($fd); } if ($limitedtextarea == "") { system("rm $file_name"); system("echo 'advert deleted for account $account_no' | mail -n -s'take-away.com.au advert deleted' brad@austbiz.com.au"); if (msqlQuery($sock,"update take_away_account set advert_active_flag='N' where account_no=$account_no") <0) { fatal("Error : $ERRMSG\n"); } } else { if (msqlQuery($sock,"update take_away_account set advert_active_flag='Y' where account_no=$account_no") <0) { fatal("Error : $ERRMSG\n"); } system("echo 'advert created for account $account_no \n $limitedtextarea' | mail -n -s'take-away.com.au advert added' brad@austbiz.com.au"); } echo(""); msqlClose($sock); >