Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Initialize an array for filtered data. */
- $clean = array();
- /* Define a salt. */
- define('SALT', 'flyingturtle');
- /* Encrypt the password. */
- $encrypted_password = md5(SALT . $_POST['password']);
- /* Allow alphanumeric usernames. */
- if (ctype_alnum($_POST['username'])) {
- $clean['username'] = $_POST['username'];
- } else {
- /* Error */
- }
- /* Store user in the database. */
- $st = $db->prepare('INSERT
- INTO
- users (username, password)
- VALUES (?, ?)');
- $st->execute(array($clean['username'], $encrypted_password));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement