Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
session_start();
3
 
4
require_once 'Text/CAPTCHA/Numeral.php';
5
$numcap = new Text_CAPTCHA_Numeral;
6
 
7
if (isset($_POST['captcha']) && isset($_SESSION['answer'])) {
8
    if ($_POST['captcha'] == $_SESSION['answer']) {
9
        $errors[] = 'Ok.. YOu might be human..';
10
    } else {
11
        $errors[] = 'You are or not human or dumb';
12
    }
13
}
14
    if (!empty($errors)) {
15
        foreach ($errors as $error) {
16
            print "<h1><font color='red'>$error</font></h1><br />";
17
        }
18
    }
19
 
20
 
21
    print '
22
        <form name="capter" action="'.$_SERVER['PHP_SELF'].'" method="post">
23
         <table>
24
          <tr>
25
           <th>What is this result pilgrim?: '.$numcap->getOperation().'</th>
26
           <td><input type="text" value="" name="captcha" /></td>
27
          </tr>
28
          <tr>
29
           <th/>
30
           <td><input type="submit" value="Let me prove you that I am human!" /></td>
31
          </tr>
32
        </form>
33
    ';
34
    $_SESSION['answer'] = $numcap->getAnswer();
35