notepad |
notepad |
Oct 24 2009, 12:39 AM
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 |
im wanting to make an online notepad for personal use. ive got a server. it could be like the one cb uses or this.
http://jumk.de/notepad/ i use that all the time but it sucks. haha. i figured the best way to do this would be with a database as opposed to cookies or something so that way you can always access it from any pc. how would i go about this? i only started learning database stuff recently. fanks. its also just for the learning experience. |
|
|
|
![]() |
Oct 24 2009, 02:19 AM
Post
#2
|
|
|
Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 1,237 Joined: May 2008 Member No: 648,123 |
Haha, it could have been a challenge for you if you picked a challenging thing to do. Entering text is easy.
If you're doing it where users don't have separate notes, then you need only one table. There's a unique ID (which increments up 1 when someone makes a new user), a username limited to 15 characters, a password at 32 characters (all words hashed in md5 end up being 32 characters, the time they signed up, the time they last edited their notepad, and the memo text itself. When they type in a textarea, then push submit, the query updates the memo that's linked to that user's ID. The table looks something like this: CODE +----------------------------------------------------------------------------------+ | id | user | pass | date | last | memo | +----------------------------------------------------------------------------------+ | 1 | name | b36e... | 2009-10-23 18:25:30 | 2009-10-24 18:20:30 | text | | 2 | name2 | g57n... | 2009-10-23 18:26:30 | 2009-10-24 02:25:30 | text | +----------------------------------------------------------------------------------+ Once they sign up, the only thing that will be changed is the "last" column and the "memo" column (unless they have an option to change their username/password). If you're following the basic example I used for the queries, the textarea could look something like this: CODE <textarea name="memo" cols="50" rows="10"><?php echo $memo; ?></textarea> The fourth code up there (^) defines what the $memo variable is, by gathering the text from the "memo" column in your database, in the row that has an ID that matches the cookie on a user's computer. I don't think that site you posted uses cookies (didn't check, maybe they do). I don't think they do, because they make you enter your password on every new page. If you didn't use cookies, then instead of running this query: CODE "SELECT memo FROM memo WHERE id = $id" You'd use this one: CODE "SELECT memo FROM memo WHERE user = '$user' AND pass = '$pass'" Where $pass = md5($_POST['pass'])
|
|
|
|
jcp notepad Oct 24 2009, 12:39 AM
JonHMChan I don't think this should be too hard if you k... Oct 24 2009, 12:46 AM
jcp ya i watched those. im also going through this.
ht... Oct 24 2009, 12:56 AM
fixtatik Do you know about logins, too? Assuming you do, so... Oct 24 2009, 01:02 AM
jcp wow. i understand most of that code but i dont rea... Oct 24 2009, 01:07 AM
jcp ok so basically each time a user signs up it creat... Oct 24 2009, 09:27 AM
fixtatik Yup, that's the script to insert new users. It... Oct 24 2009, 11:42 AM
jcp so how does the file layout work? I have never don... Oct 27 2009, 01:46 PM
JonHMChan When you're running MySQL to create a table, y... Oct 30 2009, 01:03 PM
fixtatik If you're running it as-is, you'll have pr... Oct 30 2009, 02:38 PM
jcp so could you just give me like step by step instru... Nov 17 2009, 02:16 PM
fixtatik Do it for you, or explain a part better? What do y... Nov 17 2009, 08:00 PM
jcp I mean, what order do I make the files and which c... Nov 17 2009, 09:02 PM
fixtatik File order doesn't matter, because you're ... Nov 18 2009, 12:21 PM![]() ![]() |