Skip to Main Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

17.6 Was tun bei verlorenen Passwörtern?

Problem

Sie wollen ein Passwort an einen Benutzer ausgeben, der angibt, sein Passwort verloren zu haben.

Lösung

Erzeugen Sie ein neues Passwort und senden Sie es an die E-Mail-Adresse des Benutzers (die Sie irgendwo hinterlegt haben sollten):

// Neues Passwort erzeugen. $neues_passwort = ''; $i = 8; while ($i--) { $neues_passwort .= chr(mt_rand(33,126)); } // Neues Passwort verschlüsseln. $verschluesseltes_passwort = crypt($neues_passwort); // Neues verschlüsseltes Passwort in der Datenbank speichern. $dbh->query('UPDATE benutzer SET passwort = ? WHERE benutzername = ?', array($verschluesseltes_passwort,$benutzername)); // Neues Klartext-Passwort per E-Mail an den Benutzer schicken. mail($email,"Neues Passwort","Ihr ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi
CSS Kochbuch, 3rd Edition

CSS Kochbuch, 3rd Edition

Joergen Lang, Christopher Schmitt

Publisher Resources

ISBN: 9783868993271Purchase book