Файл: ajax/users/email/post.php
Строк: 40
<?php
/**
* post new email
*
* @package Sngine
* @author Zamblek
*/
// fetch kernal
$depth = '../../../';
require($depth.'kernal.php');
// check AJAX Request
if(!IsAJAX()) {
header('Location: '.SITE_URL);
}
// check user verified
if($userArray['Verified'] == "Y") {
exit(PopupError('Your account already verified.', 'Thanks'));
}
// check email
if(!ValidEmail($_POST['email']) || $user->checkUserEmail($_POST['email'])) {
exit(PopupError('Please enter a valid email address.', 'Invalid Email'));
}
// create activation code
$code = md5(time()*rand(1, 9999));
// update user
$updateUser = $db->query(sprintf("UPDATE users SET ActivationCode = %s, UserEmail = %s WHERE UserID = %s", Secure($code), Secure($_POST['email']), Secure($userArray['UserID']) ));
if(!$updateUser) {
exit(PopupError('There is some thing wrong happened. Try again later.', 'Error'));
}
// prepare to send activation email
$subject = "Just one more step to get started on ".SITE_TITLE."";
$body = "Hi ".$userArray['UserFirstName'].",";
$body .= "rnrnTo complete the sign-up process, please follow this link:";
$body .= "rnrnhttp://".SITE_URL."/confirm.php?id=".$userArray['UserID']."&code=".$code;
$body .= "rnrnWelcome to ".SITE_TITLE."!";
$body .= "rnr".SITE_TITLE." Team";
// send activation email
if(!SendMail($_POST['email'], $subject, $body)) {
exit(PopupError('There is some thing wrong happened. Try again later.', 'Error'));
}
?>