Browse Source

Новая капча

vadeg_ne@mail.ru 1 year ago
parent
commit
3658ae16a6
2 changed files with 2 additions and 2 deletions
  1. 1 1
      controllers/NewsController.php
  2. 1 1
      views/news/view/comments/list.php

+ 1 - 1
controllers/NewsController.php

@@ -194,7 +194,7 @@ class NewsController extends Controller
 		}
 
         if(\Yii::$app->request->isPost){
-            $capcha_result = ceil(base64_decode(\Yii::$app->request->post('capcha_salt'))*3.14);
+            $capcha_result = base64_decode(\Yii::$app->request->post('capcha_salt'))/3.14;
             if(
                 \Yii::$app->request->post('capcha')=="" ||
                 \Yii::$app->request->post('capcha')!= $capcha_result

+ 1 - 1
views/news/view/comments/list.php

@@ -100,7 +100,7 @@ $query = $model->getCommentsAll()->orderBy(['created_at'=>SORT_ASC])->andWhere([
                     $b = rand(1,9);
 
                 ?>
-                <input type="hidden" name="capcha_salt" value="<?=base64_encode(($a+$b)/3.14);?>">
+                <input type="hidden" name="capcha_salt" value="<?=base64_encode(($a+$b)*3.14);?>">
                 <label for="capcha">Решите пример: <i style="opacity: 0;">1</i><?=$a?><i style="opacity: 0;">0</i>+<i style="opacity: 0;">2</i><?=$b?><i style="opacity: 0;">0</i>=</label>
                 <input type="text" name="capcha" style="outline: none;border: 1px solid #212529;width: 25px;" aria-label="capcha">
             </div>