summary refs log tree commit diff stats
path: root/pages/login.php
blob: 6270502645f7193536115cd3dd36b1656fed677f (plain) (blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
       444444444  
      4::::::::4  
     4:::::::::4  
    4::::44::::4  
   4::::4 4::::4   Four Island
  4::::4  4::::4  
 4::::4   4::::4   Written and maintained by Starla Insigna
4::::444444::::444
4::::::::::::::::4  pages/login.php
4444444444:::::444
          4::::4   Please do not use, reproduce or steal the
          4::::4   contents of this file without explicit
          4::::4   permission from Hatkirby.
        44::::::44
        4::::::::4
        4444444444
*/

if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}

require('headerproc.php');

$noMembers=1;

include('includes/recaptchalib.php');
$publickey = "6LfgvgEAAAAAAG_BJMkWk8sNcT1nBaGoXKJYb-JT";
$privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr";

if (!isset($_GET['submit']))
{
	$template = new FITemplate('login');
	$template->add('REDIRECT',$_GET['redirect']);

	$template->add('RECAPTCHA',recaptcha_get_html($publickey));
} else {
	$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
	if (!$resp->is_valid)
	{
		$template = new FITemplate('login');
		$template->add('REDIRECT',$_GET['redirect']);
		$template->adds_block('ERROR',array('msg' => "The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")"));

		$template->add('RECAPTCHA',recaptcha_get_html($publickey));
	} else {
		if (verifyUser($_POST['username'], $_POST['password']))
		{
			sess_set('uname',$_POST['username']);
			header('Location: ' . rawurldecode($_POST['redirect']));
			exit;
		} else {
			$template = new FITemplate('login');
			$template->add('REDIRECT',$_POST['redirect']);
			$template->adds_block('ERROR',array('MSG' => "The username/password pair didn't resolve to a real user. Try logging on again, spelling the password right, or making sure you actually have an a account."));

			$template->add('RECAPTCHA',recaptcha_get_html($publickey));
		}
	}
}

$template->display();

?>