-
Активация по Email
Код Активации
if(isset($_GET['email']) &&!empty($_GET['email']) AND isset($_GET['activation']) &&!empty($_GET['activation'])){
// Verify data
$email = ($_GET['email']); // Set email variable
$activation = ($_GET['activation']); // Set hash variable
$search = ("SELECT email, activation, status FROM user WHERE email='".$email."' AND activation='".$activation."' AND status='0'") or die(mysql_error());
$match = $search ->fetch();
if($match > 0){
// We have a match, activate the account
("UPDATE user SET status='1' WHERE email='".$email."' AND activation='".$activation."' AND status='0'") or die(mysql_error());
echo '<div class="statusmsg">Your account has been activated, you can now login</div>';
}else{
// No match -> invalid url or account has already been activated.
echo '<div class="statusmsg">The url is either invalid or you already have activated your account.</div>';
}
}else{
// Invalid approach
echo '<div class="statusmsg">Invalid approach, please use the link that has been send to your email.</div>';
}
Отправка смс
$activation=md5(rand(0,1000));
$sql = "INSERT INTO user ( `name`, `email`, `password`, `activation`)"."VALUES ('$name','$email','$password','$activation');";
$to = $email;
$subject = 'Signup | Verification';
$message = '
Thanks for signing up!
Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below.
Username: '.$name.'
Password: '.$password.'
------------------------
Please click this link to activate your account:
http://gamebox.mcdir.ru/user/activation/email='.$email.'&activation='.$activation.'
';
$headers = 'From:gamebox.mcdir.ru' . "rn";
mail($to, $subject, $message, $headers);
У меня какая-то ошибка ,я думаю с линком , но какая хз. Помогите!