On forums I tend to say things without the other persons feelings in mind (probably this is is because its not a face to face conversation). I didn't realize how rude that sounded until after I read again. For that, I apologize.
To make up for it, I will tell you exactly what to do.
On your registration page you need to create the link, email it, and save the random string in the database. I usually use a column named 'active' for this.
//this is after form validates and you are about to insert the data into the database
function randString( $length ) {
$array = array("b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z","B","C","D","F","G","H","J","K","L","M","N","P","Q","R","S","T","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9");
$i = 0;
$code = '';
while ( $i < $length ) {
$rand = rand( 0,( count( $array ) - 1 ) );
$code .= $array[$rand];
$i++;
}
return $code;
}
$code = randString(50);
mysql_query("INSERT INTO `members` (....column names....,'active') VALUES (....values here....,'{$code}')") or die(mysql_error()); //shows how you insert the code
$message = "Welcome to something.com,\n\nTo activate your account click the link below:\n\nhttp://www.something.com/activate.php?id=" . mysql_insert_id() . "&code={$code}\n\nBest regards,\n\nAdmin\nSomething.com (info@something.com)";
mail('email of user from form','Email Confirmation',$message,"From: Something.net<no-reply@something.net>"); //sends the activation email with the id of the user and activation code.
On activate.php, we use the id and the code the id the user and set them to active.
In your login script all you need to do is add ' AND `active` = 1' in your query.