aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_confirm.php
blob: 087a186fa7e5ed465e064d6108aceaacb6a1ef91 (plain)
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
65
66
67
68
69
70
71
72
<?php
/** 
*
* @package VC
* @version $Id$
* @copyright (c) 2005 phpBB Group 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* ucp_confirm
* Visual confirmation
*
* Note to potential users of this code ...
*
* Remember this is released under the _GPL_ and is subject
* to that licence. Do not incorporate this within software 
* released or distributed in any way under a licence other
* than the GPL. We will be watching ... ;)
*
* @package VC
*/
class ucp_confirm
{
	var $u_action;

	function main($id, $mode)
	{
		global $db, $user, $phpbb_root_path, $config, $phpEx;

		// Do we have an id? No, then just exit
		$confirm_id = request_var('id', '');
		$type = request_var('type', 0);

		if (!$confirm_id || !$type)
		{
			exit;
		}

		// Try and grab code for this id and session
		$sql = 'SELECT code  
			FROM ' . CONFIRM_TABLE . " 
			WHERE session_id = '" . $db->sql_escape($user->session_id) . "' 
				AND confirm_id = '" . $db->sql_escape($confirm_id) . "'
				AND confirm_type = $type";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		// If we have a row then grab data else create a new id
		if (!$row)
		{
			exit;
		}

		if ($config['captcha_gd'])
		{
			include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
		}
		else
		{
			include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
		}

		$captcha = new captcha();
		$captcha->execute($row['code']);
		exit;
	}
}

?>