Enter your Username"; } else { $statement = $pdo->prepare("SELECT * FROM users WHERE username = :username"); $result = $statement->execute(array('username' => $_POST['username'])); $user = $statement->fetch(); if($user === false) { $error = "no user found"; } else { //check if theres a code already $activationcode = random_string(); $statement = $pdo->prepare("UPDATE users SET activationcode = :activationcode, activationcode_time = NOW() WHERE id = :userid"); $result = $statement->execute(array('activationcode' => sha1($activationcode), 'userid' => $user['id'])); $mailrcpt = $user['email']; $mailsubject = "New password for your User"; $from = "From: Password Reset Service "; //place a real address if we use this in production $url_activationcode = 'https://loginpagefoo.td00.de/resetpass.php?userid='.$user['id'].'&code='.$activationcode; //this shouldnt be my domain in prod.. $text = 'Hallo '.$user['username'].', please use the following URL to activate your account in the next 24h: '.$url_activationcode.' If this mail comes unsolicited, please just ignore the mail. cheers loginpagefoo script'; mail($mailrcpt, $mailsubject, $text, $from); echo 'Link send. Going back to profile page. '; $showForm = false; } } } if($showForm): ?>

Activate user

Please enter your username so we can send you a link to activate your account.