A part of my coding
register.php
$name = $first . ' ' . $surname;
$actkey = mt_rand(1, 500) . 'f78dj899dd';
$act = sha1($actkey);
$query = mysql_query("INSERT INTO Users (Username, Password, Name, Email, Date, IP, Actkey) VALUES ('$username','$password','$name','$email','$date','$ip','$act')") or
die(mysql_error());
$send = mail($email, "Registration Confirmation",
"Thank you for registering with AvDose\n\nYour username and password is below, along with details on how to activate your account.\n\nUser: " .
$username . "\nPass: " . $pass . "\n\nClick the link below to activate your account:\nhttp://avateinfo.kh3.us/activate.php?id=" .
$act . "\n\nPlease do not reply, this is an automated mailer.\n\nThanks",
"FROM:
[email protected]");
if (($query) && ($send)) {
activate.php
<?php
include 'config.php';
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM Users WHERE Actkey = '$id' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) > 0){
$user = $row['id'];
$do = mysql_query("UPDATE Users SET Activated = 1 WHERE id = '$user' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Activation Confirmation" , "Thank you for activating your account, you are now fully registered and able to use our services.\n\nTo login, click the link below:\nhttp://avateinfo.kh3.us/members.avt" , "FROM:
[email protected]");
if(($do)&&($send))
{
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="success">
<p>Activation successful! A confirmation email has been dispatched. You can now login!</p>
<p><a href="login.php">Click here</a> to goto the login page.</p>
</div>';
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>We are sorry, there appears to be an error processing your activation. Please try again later.</p>
</div>';
}
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>Sorry, your activation code was incorrect. Please try again.</p>
</div>';
}
mysql_close($l);
?>