Completed
Push — master ( 659231...788af6 )
by Wanderson
05:06
created

Captcha::isCorrect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
namespace Win\Widget;
4
5
use Win\Request\Input;
6
7
/**
8
 * Valida Captcha
9
 */
10
class Captcha {
11
12
	/**
13
	 * Retorna True se captcha está correto
14
	 * @return boolean
15
	 */
16
	public static function isCorrect() {
17
		if (isset($_SESSION['captcha'])) {
18
			$captcha = strtolower(Input::post('captcha'));
19
			$sessionCaptcha = strtolower(filter_var($_SESSION['captcha']));
20
			unset($_SESSION['captcha']);
21
			return ($captcha == $sessionCaptcha);
22
		}
23
		return false;
24
	}
25
26
}
27