query("SELECT COUNT(*) FROM students WHERE mnumber = $mnumber")->fetch(PDO::FETCH_NUM)[0] == 1) {
print "
";
print "user already registered |
---|
";
print "
";
break;
}
$db->query("INSERT INTO students (mnumber,firstname,lastname,email,password)
VALUES (\"$mnumber\",\"$firstname\",\"$lastname\",\"$email\",\"$password\")");
print "";
print "registration successfull |
---|
";
print "
";
echo "$firstname $lastname was successfully registered.
";
// send password-email //
$lec_lines = file('var/lecture.txt');
foreach ($lec_lines as $line_num => $line) {
$lecture[$line_num] = $line;
}
$nachricht = "Hello $firstname($mnumber)!\nYou registered for " . trim($lecture[0]) . " " . trim($lecture[1]) . ".\nRemember your password: $password\n\nYours,\nBanana.";
//$nachricht = wordwrap($nachricht,70);
$empfaenger = 'niemand@example.com';
$betreff = 'Der Betreff';
$header = 'From: banana@treefish.org' . "\r\n" .
'Reply-To: noreply@treefish.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, "Banana Registration: " . trim($lecture[0]) . " " . trim($lecture[1]), $nachricht, $header);
break;
}
?>