Jelajahi Sumber

Новая капча

vadeg_ne@mail.ru 1 tahun lalu
induk
melakukan
3658ae16a6
2 mengubah file dengan 2 tambahan dan 2 penghapusan
  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>