本文整理匯總了PHP中utility::generateUID方法的典型用法代碼示例。如果您正苦於以下問題:PHP utility::generateUID方法的具體用法?PHP utility::generateUID怎麽用?PHP utility::generateUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utility
的用法示例。
在下文中一共展示了utility::generateUID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lostPasswordConfirmEmail
public static function lostPasswordConfirmEmail($email)
{
global $lC_Database, $lC_Language;
$lC_Language->loadIniFile('login.php');
// check for email
$Qadmin = $lC_Database->query('select * from :table_administrators where user_name = :user_name limit 1');
$Qadmin->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
$Qadmin->bindValue(':user_name', $email);
$Qadmin->execute();
$admin = $Qadmin->toArray();
// if email exists we continue
if ($Qadmin->numberOfRows() > 0) {
$lC_Database->startTransaction();
$verify_key = utility::generateUID();
// set the key to be verified from the resulting email
$Qsetkey = $lC_Database->query('update :table_administrators set verify_key = :verify_key where user_name = :user_name');
$Qsetkey->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
$Qsetkey->bindValue(':user_name', $email);
$Qsetkey->bindValue(':verify_key', $verify_key);
$Qsetkey->setLogging($_SESSION['module'], $email);
$Qsetkey->execute();
if (!$lC_Database->isError()) {
$lC_Database->commitTransaction();
$_SESSION['user_not_exists'] = null;
$_SESSION['user_confirmed_email'] = $email;
// set email contents
$email_text = '';
$email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_1'), $admin['first_name']) . "\n\n";
$email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_2'), $admin['user_name']) . "\n\n";
$email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_3'), lc_href_link_admin(FILENAME_DEFAULT, 'login&action=lost_password&email=' . $admin['user_name'] . '&key=' . $verify_key)) . "\n\n";
$email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_4'), $verify_key) . "\n\n";
$email_text .= $lC_Language->get('text_lost_password_verification_body_line_5') . "\n\n";
$email_text .= $lC_Language->get('text_lost_password_verification_body_line_6') . "\n\n";
$email_text .= sprintf($lC_Language->get('text_lost_password_verification_body_line_7'), STORE_NAME) . "\n\n";
// send verification email
lc_email($Qadmin->valueProtected('first_name') . ' ' . $Qadmin->valueProtected('last_name'), $Qadmin->valueProtected('user_name'), sprintf($lC_Language->get('text_lost_password_verification_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
return true;
} else {
$lC_Database->rollbackTransaction();
$_SESSION['user_not_exists'] = true;
$_SESSION['user_confirmed_email'] = null;
return false;
}
} else {
$_SESSION['user_not_exists'] = true;
$_SESSION['user_confirmed_email'] = null;
return false;
}
}