Hello i'm trying to create a script that writes to a file but i get this error at "$stringtowrite=". Can anyone see whats wrong?? Thanx in advance.
"Parse error: parse error in test.php on line 51"
<?php
if (!file_exists("test.dat")) {
print "oops, this file doesn't exist.";
exit;
}
//if we've gotten to this point, we know the file is readable
if (!is_writeable("test.dat")) {
print "This file is not writeable!";
exit;
}
//if we've gotten to this point, we know the file is writeable.
?>
<?php
$login = 'login';
$password1 = 'password1';
$password2 = 'password2';
$name2 = 'name2';
$email2 = 'email2';
$country = 'country';
$age = 'age';
$state = 'state';
$age = 'age';
$sex = 'sex';
$status = 'status';
$occupation = 'occupation';
$edid = 'edid';
$quote = 'quote';
$hobbies = 'hobbies';
$news = 'news';
$notes = 'notes';
$fp = fopen("test.dat","a");
flock ($fp2,2);
if(!$fp) {
print "error! The file could not be opened";
exit;
}
$stringtowrite= $login'|'$password1'|'$password2'|'$name2'|'$email2'|'$country'|'$age'|'$state'|'$age'|'$sex'|'$status'|'$occupation'|'$edid'|'$quote'|'$hobbies'|'$news'|'$notes;
fwrite($fp, $stringtowrite);
sleep(20);
flock($fp2,3);
fclose($fp);
?>