$fr = @fopen("data.txt", 'w');
if(!$fr) {
chmod("data.txt", 0722);
$fr = @fopen("data.txt", 'w');
if(!$fr) {
echo "Error: Couldn't open data.txt (chmod attempted)";
exit;
}
}
fputs($fr, "Write Successful!");
fclose($fr);
?>