Completed
Push — master ( 67c338...c7b167 )
by Wanderson
04:24
created

Captcha::isValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
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 isValid() {
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