本文整理汇总了PHP中General::getValidRandomKey方法的典型用法代码示例。如果您正苦于以下问题:PHP General::getValidRandomKey方法的具体用法?PHP General::getValidRandomKey怎么用?PHP General::getValidRandomKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General::getValidRandomKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgotPasswordMail
function forgotPasswordMail($argArrPOST)
{
$objTemplate = new EmailTemplate();
$objValid = new Validate_fields();
$objCore = new Core();
$objGeneral = new General();
$objValid->check_4html = true;
$_SESSION['sessForgotValues'] = array();
$objValid->add_text_field('Login ID', strip_tags($argArrPOST['frmUserName']), 'text', 'y', 255);
$objValid->add_text_field('Verification Code', strip_tags($argArrPOST['frmSecurityCode']), 'text', 'y', 255);
if (!$objValid->validation()) {
$errorMsg = $objValid->create_msg();
}
if ($errorMsg) {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg($errorMsg);
return false;
} else {
if ($_SESSION['security_code'] == $argArrPOST['frmSecurityCode'] && !empty($_SESSION['security_code'])) {
$varWhereCond = " AND ClientEmailAddress ='" . $argArrPOST['frmUserName'] . "'";
$userRecords = $this->getClientNumRows($varWhereCond);
$userInfo = $this->getClientInfo($varWhereCond);
if ($userRecords > 0) {
$varClientID = $userInfo['0']['pkClientID'];
$varMemberData = trim(strip_tags($argArrPOST['frmUserName']));
$varForgotPasswordCode = $objGeneral->getValidRandomKey(TABLE_CLIENTS, array('pkClientID'), 'ClientForgotPWCode', '25');
$varForgotPasswordLink = '<a href="' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '">' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '</a>';
$arrColumns = array('ClientForgotPWStatus' => 'Active', 'ClientForgotPWCode' => $varForgotPasswordCode);
$varWhereCondition = 'pkClientID = \'' . $varClientID . '\'';
$this->update(TABLE_CLIENTS, $arrColumns, $varWhereCondition);
$varClientEmail = $userInfo[0]['ClientEmailAddress'];
$varToUser = $varClientEmail;
$varFromUser = SITE_NAME . '<' . $varClientEmail . '>';
$varSiteName = SITE_NAME;
$varWhereTemplate = ' EmailTemplateTitle= \'Forgot password\' AND EmailTemplateStatus = \'Active\' ';
$arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);
$varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));
$varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));
$varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));
$varKeyword = array('{IMAGE_PATH}', '{MEMBER}', '{PROJECT_NAME}', '{USER_DATA}', '{FORGOT_PWD_LINK}', '{SITE_NAME}');
$varKeywordValues = array($varPathImage, 'Client', SITE_NAME, $varMemberData, $varForgotPasswordLink, SITE_NAME);
$varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);
$objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);
$_SESSION['sessForgotValues'] = '';
$objCore->setSuccessMsg(ADMIN_FORGOT_PASSWORD_CONFIRM_MSG);
return true;
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(EMAIL_NOT_EXIST_MSG);
return true;
}
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(INVALID_SECURITY_CODE_MSG);
return false;
}
}
}
示例2: forgotPasswordMail
function forgotPasswordMail($argArrPOST)
{
$objTemplate = new EmailTemplate();
$objValid = new Validate_fields();
$objCore = new Core();
$objGeneral = new General();
$objValid->check_4html = true;
$_SESSION['sessForgotValues'] = array();
$objValid->add_text_field('Username', strip_tags($argArrPOST['frmCustomerEmailID']), 'email', 'y', 255);
$objValid->add_text_field('Verification Code', strip_tags($argArrPOST['frmVerificationCode']), 'text', 'y', 255);
if ($objValid->validation()) {
$errorMsgFirst = 'Please enter required fields!';
} else {
$errorMsg = $objValid->create_msg();
}
if ($errorMsg) {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg($errorMsg);
return false;
} else {
if ($_SESSION['security_code'] == $argArrPOST['frmVerificationCode'] && !empty($_SESSION['security_code'])) {
$varWhereCond = " 1 AND CustomerEmailID = '" . $argArrPOST['frmCustomerEmailID'] . "'";
$argArray = array('pkCustomerID');
$userRecords = $this->getUserRow(TABLE_CUSTOMERS, $argArray, $varWhereCond);
$userInfo = $this->getUserInfo($varWhereCond);
//if($userRecords > 0 && $userInfo['0']['AdminForgotPWStatus'] == 'Inactive')
if ($userRecords > 0) {
$varUserID = $userInfo['0']['pkCustomerID'];
//memberdata contain member username
//$varUserEmail = $argArrPOST['frmUserUserName'];
$varPath = "<img src = " . SITE_ROOT_URL . 'common/images/logo.jpg' . ">";
$varMemberData = trim(strip_tags($argArrPOST['frmCustomerEmailID']));
$varForgotPasswordCode = $objGeneral->getValidRandomKey(TABLE_CUSTOMERS, array('pkCustomerID'), 'CustomerForgotPWCode', '25');
$varForgotPasswordLink = '<a href="' . SITE_ROOT_URL . 'reset_password.php?mid=' . $varUserID . '&code=' . $varForgotPasswordCode . '">' . SITE_ROOT_URL . '/resetpassword.php?mid=' . $varUserID . '&code=' . $varForgotPasswordCode . '</a>';
$arrColumns = array('CustomerForgotPWStatus' => 'Active', 'CustomerForgotPWCode' => $varForgotPasswordCode);
$varWhereCondition = 'pkCustomerID = \'' . $varUserID . '\'';
$this->update(TABLE_CUSTOMERS, $arrColumns, $varWhereCondition);
$varAdminEmail = $userInfo[0]['CustomerEmailID'];
$varToUser = $varAdminEmail;
//$varFromUser = SITE_NAME;
$varFromUser = SITE_NAME . '<' . $varAdminEmail . '>';
$varSiteName = SITE_NAME;
$varWhereTemplate = ' EmailTemplateTitle= \'Forgot password \' AND EmailTemplateStatus = \'Active\' ';
$arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);
//echo '<pre>';
//print_r($arrMailTemplate);
$varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));
$varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));
//$varProjectName = 'ceu_plus';
/********/
$varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));
$UserFirstName = $userInfo['0']['CustomerFirstName'];
$varKeyword = array('{IMAGE_PATH}', '{MEMBER}', '{FORGOT_PWD_LINK}', '{SITE_NAME}');
$varKeywordValues = array($varPath, $UserFirstName, $varForgotPasswordLink, SITE_NAME);
$varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);
// Calling mail function
//echo $varOutPutValues;die;
$objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);
$_SESSION['sessForgotValues'] = '';
$objCore->setSuccessMsg(ADMIN_FORGOT_PASSWORD_CONFIRM_MSG);
return true;
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(EMAIL_NOT_EXIST_MSG);
return true;
}
} else {
$_SESSION['sessForgotValues'] = $argArrPOST;
$objCore->setErrorMsg(INVALID_SECURITY_CODE_MSG);
return false;
}
}
}