本文整理汇总了PHP中CCaptcha::CheckCodeCrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP CCaptcha::CheckCodeCrypt方法的具体用法?PHP CCaptcha::CheckCodeCrypt怎么用?PHP CCaptcha::CheckCodeCrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCaptcha
的用法示例。
在下文中一共展示了CCaptcha::CheckCodeCrypt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkCaptcha
private function checkCaptcha()
{
if (is_object($this->captcha)) {
$code = $this->request->getPost("captcha_code");
$word = $this->request->getPost("captcha_word");
if (strlen($code) > 0 && !$this->captcha->CheckCodeCrypt($word, $code, COption::GetOptionString("main", "captcha_password", "")) || strlen($code) <= 0 && !$this->captcha->CheckCode($word, 0)) {
return false;
}
}
return true;
}
示例2: CCaptcha
if (check_bitrix_sessid()) {
$strErrorMessage = '';
if (empty($arResult["Blog"])) {
$arBlog = CBlog::GetByUrl($arParams["BLOG_URL"], $arParams["GROUP_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
$arResult["Blog"] = $arBlog;
}
if ($_POST["act"] != "edit") {
if ($arResult["use_captcha"]) {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
$captcha_code = $_POST["captcha_code"];
$captcha_word = $_POST["captcha_word"];
$cpt = new CCaptcha();
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if (strlen($captcha_code) > 0) {
if (!$cpt->CheckCodeCrypt($captcha_word, $captcha_code, $captchaPass)) {
$strErrorMessage .= GetMessage("B_B_PC_CAPTCHA_ERROR") . "<br />";
}
} else {
$strErrorMessage .= GetMessage("B_B_PC_CAPTCHA_ERROR") . "<br />";
}
}
$UserIP = CBlogUser::GetUserIP();
$arFields = array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "TITLE" => trim($_POST["subject"]), "POST_TEXT" => trim($_POST["comment"]), "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]);
if ($arResult["Perm"] == BLOG_PERMS_PREMODERATE) {
$arFields["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_READY;
}
if (!$bUseTitle) {
unset($arFields["TITLE"]);
}
if (IntVal($user_id) > 0) {
示例3: KeepVoting
public static function KeepVoting()
{
global $DB, $VOTING_LAMP, $USER_ALREADY_VOTE, $USER_GROUP_PERMISSION, $USER;
$err_mess = CAllVote::err_mess() . "<br>Function: KeepVoting<br>Line: ";
$VOTING_LAMP = "green";
$USER_ALREADY_VOTE = "N";
$PUBLIC_VOTE_ID = intval($_REQUEST["PUBLIC_VOTE_ID"]);
$aMsg = array();
$VOTE_ID = 0;
$arVote = array();
$arQuestions = array();
if (!(!empty($_REQUEST["vote"]) && $PUBLIC_VOTE_ID > 0 && check_bitrix_sessid())) {
$aMsg[] = array("id" => "bad_params", "text" => GetMessage("VOTE_NOT_FOUND"));
} elseif (($VOTE_ID = intVal(GetVoteDataByID($PUBLIC_VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N"))) && ($VOTE_ID <= 0 || $arVote["LAMP"] != "green")) {
$VOTING_LAMP = "red";
if ($VOTE_ID <= 0) {
$aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("VOTE_NOT_FOUND"));
} else {
$aMsg[] = array("id" => "LAMP", "text" => GetMessage("VOTE_RED_LAMP"));
}
} elseif ($arChannel["USE_CAPTCHA"] == "Y" && !$USER->IsAuthorized()) {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
$cpt = new CCaptcha();
if (!empty($_REQUEST["captcha_word"])) {
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if (!$cpt->CheckCodeCrypt($_REQUEST["captcha_word"], $_REQUEST["captcha_code"], $captchaPass)) {
$GLOBALS["BAD_CAPTCHA"] = "Y";
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA"));
}
} else {
if (!$cpt->CheckCode($_REQUEST["captcha_word"], 0)) {
$GLOBALS["NO_CAPTCHA"] = "Y";
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA"));
}
}
}
if (empty($aMsg)) {
// get user id
$_SESSION["VOTE_USER_ID"] = CVote::SetVoteUserID();
$GLOBALS["VOTING_ID"] = $VOTE_ID;
// check: can user vote
$UNIQUE_TYPE = $arVote["UNIQUE_TYPE"];
$KEEP_IP_SEC = $arVote["KEEP_IP_SEC"];
$CHANNEL_ID = $arVote["CHANNEL_ID"];
$StatusVote = CVote::UserAlreadyVote($VOTE_ID, $_SESSION["VOTE_USER_ID"], $UNIQUE_TYPE, $KEEP_IP_SEC, $USER->GetID());
$USER_ALREADY_VOTE = $StatusVote != false ? "Y" : "N";
$USER_GROUP_PERMISSION = CVote::UserGroupPermission($CHANNEL_ID);
// if user can vote that
if (($USER_ALREADY_VOTE == "N" || $StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) && $USER_GROUP_PERMISSION >= 2) {
$arSqlAnswers = array();
// check answers
foreach ($arQuestions as $qID => $arQuestion) {
$arSqlAnswers[$arQuestion["ID"]] = array();
$bIndicators = array();
foreach ($arQuestion["ANSWERS"] as $arAnswer) {
switch ($arAnswer["FIELD_TYPE"]) {
case 0:
// radio
// radio
case 2:
// dropdown list
$fieldName = ($arAnswer["FIELD_TYPE"] == 0 ? "vote_radio_" : "vote_dropdown_") . $qID;
$aID = intval($GLOBALS[$fieldName]);
if (!isset($bIndicators[$fieldName]) && array_key_exists($aID, $arQuestion["ANSWERS"])) {
if (!empty($arAnswer['MESSAGE'])) {
$arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID);
}
$bIndicators[$fieldName] = "Y";
}
break;
case 1:
// checkbox
// checkbox
case 3:
// multiselect list
$fieldName = ($arAnswer["FIELD_TYPE"] == 1 ? "vote_checkbox_" : "vote_multiselect_") . $qID;
$res = $GLOBALS[$fieldName];
if (!isset($bIndicators[$fieldName]) && is_array($res) && !empty($res)) {
reset($res);
foreach ($res as $aID) {
if (array_key_exists($aID, $arQuestion["ANSWERS"])) {
$arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID);
}
}
$bIndicators[$fieldName] = "Y";
}
break;
case 4:
// field
// field
case 5:
// text
$aID = $arAnswer["ID"];
$fieldName = ($arAnswer["FIELD_TYPE"] == 4 ? "vote_field_" : "vote_memo_") . $aID;
$MESSAGE = trim($GLOBALS[$fieldName]);
if ($MESSAGE != "") {
$arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID, "MESSAGE" => "'" . $DB->ForSql(trim($MESSAGE), 2000) . "'");
}
break;
}
//.........这里部分代码省略.........
示例4: trim
/********************************************************************
/Default params
********************************************************************/
/********************************************************************
Action
********************************************************************/
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["ACTION"] == "SEND" && check_bitrix_sessid()) {
$userSend["FULL_NAME"] = trim(empty($userSend["FULL_NAME"]) ? $_POST["NAME"] : $userSend["FULL_NAME"]);
$userSend["E-MAIL"] = trim(empty($userSend["E-MAIL"]) ? $_POST["EMAIL"] : $userSend["E-MAIL"]);
// Use captcha
if ($arParams["SEND_" . strToUpper($arParams["TYPE"])] < "Y" && !$USER->IsAuthorized()) {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
$cpt = new CCaptcha();
if (strlen($_REQUEST["captcha_code"]) > 0) {
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if (!$cpt->CheckCodeCrypt($_REQUEST["captcha_word"], $_REQUEST["captcha_code"], $captchaPass)) {
$arError[] = array("id" => "BAD_CAPTCHA", "text" => GetMessage("F_BAD_CAPTCHA"));
}
} else {
if (!$cpt->CheckCode($_REQUEST["captcha_word"], 0)) {
$arError[] = array("id" => "NO_CAPTCHA", "text" => GetMessage("F_BAD_CAPTCHA"));
}
}
}
if (empty($userSend["FULL_NAME"])) {
$arError[] = array("id" => "NO_NAME", "text" => GetMessage("F_NO_NAME"));
}
if (empty($userSend["E-MAIL"])) {
$arError[] = array("id" => $arParams["TYPE"] == "ICQ" ? "NO_ICQ" : "NO_MAIL", "text" => GetMessage("F_NO_EMAIL1") . " " . ($arParams["TYPE"] == "ICQ" ? GetMessage("F_NO_EMAIL2") : GetMessage("F_NO_EMAIL3")));
} elseif ($arParams["TYPE"] != "ICQ" && !check_email($userSend["E-MAIL"])) {
$arError[] = array("id" => "BAD_MAIL", "text" => GetMessage("F_BAD_EMAIL"));
示例5: ForumAddMessage
function ForumAddMessage($MESSAGE_TYPE, $FID, $TID, $MID, $arFieldsG, &$strErrorMessage, &$strOKMessage, $iFileSize = false, $captcha_word = "", $captcha_sid = 0, $captcha_code = "")
{
global $USER, $DB, $APPLICATION;
$APPLICATION->ResetException();
$aMsg = array();
$bUpdateTopic = False;
$bAddEditNote = $MESSAGE_TYPE == "EDIT";
$arParams = array("PERMISSION" => false);
$arUserGroups = $USER->GetUserGroupArray();
// ************ External Permission *********************************
if (!empty($arFieldsG["PERMISSION_EXTERNAL"])) {
$arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
$arParams["PERMISSION"] = $arParams["PERMISSION"] < "Q" ? $arFieldsG["PERMISSION_EXTERNAL"] : $arParams["PERMISSION"];
unset($arFieldsG["PERMISSION_EXTERNAL"]);
} elseif (!empty($arFieldsG["SONET_PERMS"])) {
$arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
if ($arParams["PERMISSION"] < "Q") {
if ($arFieldsG["SONET_PERMS"]["bCanFull"] === true) {
$arParams["PERMISSION"] = "Y";
} elseif ($arFieldsG["SONET_PERMS"]["bCanNew"] === true) {
$arParams["PERMISSION"] = "M";
} elseif ($arFieldsG["SONET_PERMS"]["bCanWrite"] === true) {
$arParams["PERMISSION"] = "I";
} else {
$arParams["PERMISSION"] = "A";
}
}
unset($arFieldsG["SONET_PERMS"]);
}
$DB->StartTransaction();
if (!in_array($MESSAGE_TYPE, array("NEW", "EDIT", "REPLY"))) {
$aMsg[] = array("id" => "MESSAGE_TYPE", "text" => GetMessage("ADDMES_NO_TYPE") . ".");
}
$MID = intval($MID);
$TID = intval($TID);
$FID = intval($FID);
$arFieldsG["EDIT_ADD_REASON"] = $arFieldsG["EDIT_ADD_REASON"] == "Y" ? "Y" : "N";
if ($MID > 0) {
$arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
if ($arMessage) {
$TID = IntVal($arMessage["TOPIC_ID"]);
$FID = IntVal($arMessage["FORUM_ID"]);
}
}
$arTopic = array();
if ($TID > 0) {
$arTopic = CForumTopic::GetByID($TID);
if ($arTopic) {
$FID = IntVal($arTopic["FORUM_ID"]);
}
}
$arForum = CForumNew::GetByID($FID);
//************************* Input params **************************************************************************
if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $arUserGroups, $USER->GetID(), $arForum, $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2NEW") . ".");
} elseif ($MESSAGE_TYPE == "EDIT" && !CForumMessage::CanUserUpdateMessage($MID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2EDIT") . ".");
} elseif ($MESSAGE_TYPE == "REPLY" && !CForumMessage::CanUserAddMessage($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2REPLY") . ".");
}
if ($MESSAGE_TYPE == "NEW" || $MESSAGE_TYPE == "EDIT" && array_intersect_key($arFieldsG, array("TITLE" => "", "DESCRIPTION" => "", "ICON" => "", "TAGS" => "", "OWNER_ID" => "", "SOCNET_GROUP_ID" => "")) && CForumTopic::CanUserUpdateTopic($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$bUpdateTopic = True;
}
if ($MESSAGE_TYPE == "EDIT" && (ForumCurrUserPermissions($FID, $arParams) > "Q" && $arFieldsG["EDIT_ADD_REASON"] == "N")) {
$bAddEditNote = false;
}
//*************************!CAPTCHA********************************************************************************
if (!$USER->IsAuthorized() && $arForum["USE_CAPTCHA"] == "Y") {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
$cpt = new CCaptcha();
if (strlen($captcha_code) > 0) {
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if (!$cpt->CheckCodeCrypt($captcha_word, $captcha_code, $captchaPass)) {
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
}
} else {
if (!$cpt->CheckCode($captcha_word, $captcha_sid)) {
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
}
}
}
//*************************!CAPTCHA********************************************************************************
$arFieldsG["POST_MESSAGE"] = trim($arFieldsG["POST_MESSAGE"]);
if (empty($arFieldsG["POST_MESSAGE"])) {
$aMsg[] = array("id" => "POST_MESSAGE", "text" => GetMessage("ADDMESS_INPUT_MESSAGE") . ".");
}
if ($bUpdateTopic && is_set($arFieldsG, "TITLE")) {
$arFieldsG["TITLE"] = trim($arFieldsG["TITLE"]);
if (empty($arFieldsG["TITLE"])) {
$aMsg[] = array("id" => "TITLE", "text" => GetMessage("ADDMESS_INPUT_TITLE") . ".");
}
}
//*************************!QUOTA**********************************************************************************
/* if (empty($aMsg))
{
$quota = new CDiskQuota();
if ($MESSAGE_TYPE=="EDIT")
{
if (!$quota->checkDiskQuota(strLen($arFieldsG["POST_MESSAGE"]) - strLen($arMessage["POST_MESSAGE"])))
{
//.........这里部分代码省略.........
示例6: CForumTmpCaptcha
if ($code != $userCode) {
return False;
}
return True;
}
}
}
$cpt = new CForumTmpCaptcha();
} else {
$cpt = new CCaptcha();
}
if (strlen($_REQUEST["captcha_code"]) <= 0) {
if (!$cpt->CheckCode($_POST["captcha_word"], 0)) {
$arError[] = array("code" => "captcha is empty", "title" => GetMessage("POSTM_CAPTCHA"));
}
} elseif (!$cpt->CheckCodeCrypt($_POST["captcha_word"], $_POST["captcha_code"], $captchaPass)) {
$arError[] = array("code" => "bad captcha", "title" => GetMessage("POSTM_CAPTCHA"));
}
}
// First exit point
if (!empty($arError)) {
return false;
}
// 1.5 Create Property
$needProperty = array();
$PRODUCT_IBLOCK_ID = intVal($arResult["ELEMENT"]["IBLOCK_ID"]);
$PRODUCT_NAME = Trim($arResult["ELEMENT"]["~NAME"]);
$FORUM_TOPIC_ID = intVal($arResult["ELEMENT"]["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
$FORUM_MESSAGE_CNT = intVal($arResult["ELEMENT"]["PROPERTY_FORUM_MESSAGE_CNT_VALUE"]);
if ($FORUM_TOPIC_ID <= 0) {
$db_res = CIBlockElement::GetProperty($arResult["ELEMENT"]["IBLOCK_ID"], $arResult["ELEMENT"]["ID"], false, false, array("CODE" => "FORUM_TOPIC_ID"));
示例7: CForumTmpCaptcha
if ($code != $userCode) {
return False;
}
return True;
}
}
}
$cpt = new CForumTmpCaptcha();
} else {
$cpt = new CCaptcha();
}
if (strlen($post["captcha_code"]) <= 0) {
if (!$cpt->CheckCode($post["captcha_word"], 0)) {
$arError[] = array("code" => "captcha is empty", "title" => GetMessage("POSTM_CAPTCHA"));
}
} elseif (!$cpt->CheckCodeCrypt($post["captcha_word"], $post["captcha_code"], $captchaPass)) {
$arError[] = array("code" => "bad captcha", "title" => GetMessage("POSTM_CAPTCHA"));
}
}
$arPost = array('MESSAGE' => trim($post["REVIEW_TEXT"]));
foreach (GetModuleEvents('forum', 'OnCommentAdd', true) as $arEvent) {
$result = ExecuteModuleEventEx($arEvent, array($arParams['ENTITY_TYPE'], $arParams['ENTITY_ID'], &$arPost));
if ($result === false) {
break;
}
}
if ($result === false && isset($arPost['ERROR'])) {
// validation failed
$arError[] = array('title' => $arPost['ERROR']);
}
// First exit point