Hello guys! I'm making a guestbook in php and it's working pretty well until it writes in a file on server.I'll post here the code that makes me crazy. I have declared this variables on my script: $fisier ="slay"; $nrfisier=0; and the script with the problem is this: $f = fopen($fisier.$nrfisier.".usr", "at"); if ( (!$f) || ((filesize($fisier.$nrfisier.".usr")>100000) )) { $nrfisier++; $f=fopen($fisier.$nrfisier.".usr","w"); fwrite($f, sprintf("%s\t%s\t%s\r\n", $month,$day,$year)); chmod ($fisier.$nrfisier.".usr",0777); } else { fwrite($f, sprintf("%s\t%s\t%s\r\n", $month, $day, $year)); } fclose($f); chmod ($fisier.$nrfisier.".usr",0777); } } What I want to do is to write variables month day year in a file with the name slay01.usr and if this file is greater than 100k to write in another file slay02.usr and so on.For some reason this is not working on http server where is hosted my guestbook.Can you help me on this.Sorry that I've not posted all of my script but I think you'll understand me.Thank yo
keep in mind the filesize can only be checked of localfiles also i see the chmod command after writing to it, try to put it before the fwrite
Did you chmod the directory where you write the files, so that it is writable by the webserver? If not, it won't be apble fto create files in that directory.