本文整理匯總了PHP中CApi::getCsrfToken方法的典型用法代碼示例。如果您正苦於以下問題:PHP CApi::getCsrfToken方法的具體用法?PHP CApi::getCsrfToken怎麽用?PHP CApi::getCsrfToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CApi
的用法示例。
在下文中一共展示了CApi::getCsrfToken方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SystemSecurity
public function SystemSecurity()
{
$bDoSave = true;
if (CApi::getCsrfToken('p7admToken') === CPost::get('txtToken')) {
if (CPost::Has('txtNewPassword') && CPost::Has('txtConfirmNewPassword')) {
$oWebmailApi = CApi::Manager('webmail');
if (!$oWebmailApi->validateAdminPassword(trim(CPost::get('txtOldPassword')))) {
$bDoSave = false;
$this->LastError = CM_PASSWORDS_INVALID_OLD;
} else {
if ((string) CPost::get('txtNewPassword') !== (string) CPost::get('txtConfirmNewPassword')) {
$bDoSave = false;
$this->LastError = CM_PASSWORDS_NOT_MATCH;
} else {
if (AP_DUMMYPASSWORD !== (string) CPost::get('txtNewPassword')) {
$this->oSettings->SetConf('Common/AdminPassword', md5(trim(CPost::get('txtNewPassword'))));
}
}
}
if ($bDoSave) {
if (CPost::Has('txtUserName')) {
$this->oSettings->SetConf('Common/AdminLogin', CPost::get('txtUserName'));
}
$this->saveSettingsXmlWithMessage();
}
}
} else {
$this->LastError = CApi::I18N('API/INVALID_TOKEN');
}
}
示例2: SystemSecurity
public function SystemSecurity(ap_Standard_Screen &$oScreen)
{
$oScreen->Data->SetValue('txtUserName', $this->oSettings->GetConf('Common/AdminLogin'));
$oScreen->Data->SetValue('txtOldPassword', AP_DUMMYPASSWORD);
$oScreen->Data->SetValue('txtToken', CApi::getCsrfToken('p7admToken'));
$oScreen->Data->SetValue('txtNewPassword', AP_DUMMYPASSWORD);
$oScreen->Data->SetValue('txtConfirmNewPassword', AP_DUMMYPASSWORD);
}