index.php
================
<html>
<body>
<form method="POST" action="flaf.php">
Navn <input type="text" name="bruger" size="20"></p>
<p>Kode <input type="password" name="kode" size="20"></p>
<p>Email <input type="text" name="email" size="20"></p>
<p><input type="submit" value="Send" name="B1"><input type="reset" value="Nulstil" name="B2"></p>
</form>
</body>
</html>
flaf.php
====================
<?
$regcode = md5(uniqid(rand(),2));
$del1 ="Hej\nBla bla bla";
$del2 ="
http://www.ETDOMÆNE.dk/aktiver.php?regcode=$regcode";$del3 ="\nMed Venlig hilsen\n\nHejhej";
$status = "off";
###################################################
## indsætter personen i databasen ##
###################################################
$conn = mysql_connect("localhost", "root", "XXXXXX");
mysql_select_db("test");
$insertSQL = "insert into flaf (bruger,kode,email,regcode,status)
values ('$bruger', '$kode', '$email', '$regcode', '$status')";
mysql_query($insertSQL);
mysql_close($conn);
mail("$email", "Oprettelse", $del1.$del2.$del3);
Echo"Der vil nu blive sendt en mail til dig";
echo"$email";
?>
aktiver.php
==================
<?php
$conn = mysql_connect("localhost", "root", "XXXXXXX");
mysql_select_db("test");
mysql_query("UPDATE flaf SET status = 'on' WHERE regcode = '$regcode' ");
mysql_close($conn);
Echo" din konto er nu aktiv";
?>
SQL DUMP
==============
CREATE TABLE flaf (
id int(11) NOT NULL auto_increment,
bruger text NOT NULL,
kode text NOT NULL,
email text NOT NULL,
regcode text NOT NULL,
status text NOT NULL,
PRIMARY KEY (id),
KEY id (id)
)