It shows that you are unregistered. Please register with us by clicking Here
![]() |
|
![]() |
![]() | Register - FAQ - Today's Posts - New Posts - Support - Search | ![]() |
|
|
#1 (permalink) |
|
Posts: n/a
|
Im sure there are people here who like to code php. There has to be, because Im one of them.
Anyway, to my point. Im a very busy stressfull and mostly lazy man and I need a very simple php notepad to store notes on line. Sure, I could just use my forum, except I dont want to for miscelaneous reasons. Hell, I could do it, but right now I dont want to see any code untill I feel a little better. Anyone up for it? Ill applaud them continously for the next week or so while I do my rounds. And of course, Im not a greedy man, Im sure we could all share. |
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Jul 2006
Location: Swansea, Wales, UK
Age: 20
Posts: 239
|
ok....this is entirly untested since im writing it as i go along....
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="english"> <head> <title>Jamie Lewis - Notepad</title> <meta name="author" content="Jamie Lewis" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="main.css"/> </head> <body> <?php if(isset($_POST["notes"])){ $file = fopen("note.txt",'w'); if(fwrite($file,$_POST["notes"])){ echo "File Written Successfully"; } fclose($file); } $file = fopen("note.txt",'r'); $content = fread($file,filesize("note.txt")); echo "<form action='notes.php' method='post'>"; echo "<fieldset>"; echo "<legend>Notepad</legend>"; echo "<label for='notes'>Notes:</label><br/>"; echo "<textarea name='notes' id='notes' cols='50' rows='3'>".htmlentities($content)."</textarea>"; echo "<input type='submit' value='Save'/>"; echo "</fieldset>"; echo "</form>"; ?> </body> </html> Jamie
__________________
|
|
|
|
|
|
#6 (permalink) | |
|
Junior Member
|
Quote:
just so if he needs to store more notes in the same file it doesn't overwrite it because the file pointer starts at the end.
__________________
http://einhanderspad.com/blog/Einhan...EFOIWEFOJI.jpg |
|
|
|
|
|
|
#8 (permalink) |
|
Senior Member
Join Date: Jul 2006
Location: Swansea, Wales, UK
Age: 20
Posts: 239
|
There we go its tested and it works. The reason i didnt append was because the entire file gets rewritten to help preserve edits etc. And for a script written in two minutes I dont think its half bad.
Jamie
__________________
|
|
|
|
|
|
#9 (permalink) |
|
Junior Member
|
No he doesn't...he has two IF statements so he only needs two closing brackets.
__________________
http://einhanderspad.com/blog/Einhan...EFOIWEFOJI.jpg |
|
|
|
|
|
#10 (permalink) | |
|
Posts: n/a
|
Dude, its awsomeness.
Quote:
edit- for your enjoyment. Warning: fopen(note.txt): failed to open stream: Permission denied in /home/ankindus/public_html/anman/notes.php on line 12 Warning: fwrite(): supplied argument is not a valid stream resource in /home/ankindus/public_html/anman/notes.php on line 13 Warning: fclose(): supplied argument is not a valid stream resource in /home/ankindus/public_html/anman/notes.php on line 16 Warning: fread(): Length parameter must be greater than 0. in /home/ankindus/public_html/anman/notes.php on line 20 edit- whoa.. forget that.. my ftp didnt save my cmod. edit- http://www.ankindustries.com/anman/notes.php YEEHAW!! edit- Just editing for fun. |
|
|