Create new folder and .TXT file
Code:
<?
if($_POST['Submit']){
$open = fopen("$username/$topurl.txt","w+");
$text = $_POST['update'];
fwrite($open, $text);
fclose($open);
echo "My notes:<br />";
$file = file("$username/$topurl.txt");
foreach($file as $text) {
echo $text."<br />";
}
}else{
$file = file("$username/$topfilename.txt");
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">";
foreach($file as $text) {
echo $text;
}
echo "</textarea>";
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
</form>";
}
?>
Hello, its me again. I have gotten a working login and registration system on my site and I would like to make it so that when a new user logs in and views a page, a new subdirectory is created named after the visitors username, if it does not already exist;
Simeltaniously creating a new .TXT file named after the filename of whatever webpage they are on, if it does not already exist; if it does exist than the file contents are to be loaded into the TEXTAREA for further appending by the user.
I know of the fcreate function, but I am not familiar with its paremeters or how to 'work it' :)