Log In · Register

 
notepad
Maccabee
post 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.
 
 
Start new topic
Replies
fixtatik
post 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'])
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: