-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
52 lines (41 loc) · 1.15 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
// Esta deve ser a 1a chamada, não pode ter nenhum echo antes
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Captha feito em PHP</title>
</head>
<h4>Captha feito em PHP - Exemplo de Uso</h4>
<br>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Usuário: <input type="text" name="user"><br><br>
Senha: <input type="password" name="pass"><br><br>
<img src='captcha/gera.php' alt='código captcha' /><br>
<input type="text" name="captcha"
placeholder="Digite o código acima aqui" size="22"><br>
<br>
<br>
<input type="submit" name="send" value="Entrar" />
</form>
<?php
if (isset($_POST['send'])) {
if ($_SESSION['captcha']!= $_POST['captcha']) {
echo "<br>";
echo "O captha informado está inválido, digite novamente";
}
if ($_SESSION['captcha'] == $_POST['captcha']) {
echo "<br>";
echo "Tudo certo, vamos continuar...";
}
/*
Para alguma depuração
var_dump($_POST);
echo "<hr>";
var_dump($_SESSION);
*/
}
?>
</html>