Forum - Was kommt ins Cookie?

SilentWarrior

Erfahrenes Mitglied
Moin

Mal eine Frage: Wenn ich jetzt bei meinem Forum ein Cookie setze, durch das ich den Benutzer identifizieren will, wenn er erneut auf die Seite kommt - was speicher ich dann darin? Einfach den Benutzernamen? Oder die ID? Ist doch ziemlich unsicher, oder nicht? Der Benutzer kann doch einfach eine eigene Seite programmieren, die ihm so ein Cookie mit einem fremden Benutzernamen setzt - oder nicht?

Gr¨sse und so ;-)

SilentWarrior
 
hi,

also das vbulletinboard zum beispiel speichert unter anderem die userid, den timestamp des letzten besuchs, sowie das passwort des users (md5)

bye
 
Die meisten Foren schreiben sowohl den Usernamen als auch das md5(Passwort) ins Cookie.

//Edit: Zu langsam... :)

//Edit: Hey Blubber, neues Avatar? Nett... ;)
 
jop, auf die idee mit md5 bin ich auch gekommen, bis ich bei php.net das gelesen habe:
I must point out to all the people who read the notes this far that MD5 is _not_ encryption in a traditional sense. Creating an MD5 digest (or hash) of a message simply creates 128 bits that can be used to almost positively identify that message or object in the future. You use MD5 if you want to validate that information is true. For example, you may ask a user to submit a message through a browser POST and save an MD5 of that message in a database for a preview function. When the user submits it the second time, running the MD5 hash of the new version of the text and comparing it to the original MD5 in the database will tell you if the text has changed at all. This is how MD5 is used -- it is _not_ for encrypting things so as to get the data back afterward -- the MD5 hash version does _not_ contain the data of the original in a new form.
zu finden hier:

http://www.php.net/manual/de/function.md5.php

jetzt meine frage: wenn ich das passwort einfach bei einem erneuten aufruf aus der datenbank mit md5 nochmal verschlüsseln lasse, is das dann genau gleich wie das verschlüsselte im cookie? dann würde es ja gehen...
 
md5() verschlüsselt dir nichts. die funktion generiert dir einfach eine quersumme aus dem, was du der funktion übergibst. und die is bei gleichbleibendem übergabewert immer gleich.

matt
 

Neue Beiträge

Zurück