<?php
/***************************************************************************
 *                           db_update.php
 *                          ---------------
 *   begin                : Tuesday, Aug 22, 2006
 *   copyright            : (C) 2005-2006 M.W.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';

$i = 0;
while ( !file_exists($phpbb_root_path . 'extension.inc') && ($i++ < 4) )
{
	$phpbb_root_path .= '../';
}
if ( $i > 4 )
{
   message_die(GENERAL_MESSAGE, 'Unable to find extension.inc, terminating. Please move this file into your main/"root" phpbb directory and try again.');
}

include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if( !$userdata['session_logged_in'] )
{
	redirect(append_sid("login.$phpEx?redirect=db_update.$phpEx", true));
}

if( $userdata['user_level'] != ADMIN )
{
   message_die(GENERAL_MESSAGE, 'You are not authorised to access this page');
}

$page_title = 'Installing Anti-Bot-Question Tables';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

print<<<DELIM
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">
  <tr>
    <th class="thHead">Updating the database</th>
  </tr>
  <tr>
    <td>
      <span class="genmed">
        <ul type="circle">

DELIM;

$current_time = time();

switch ( SQL_LAYER )
{
	case 'msaccess':
	break;

	case 'postgresql':
		$sql = array(
		"CREATE SEQUENCE {$table_prefix}anti_bot_quest_id_seq start 31 increment 1 maxvalue 2147483647 minvalue 1 cache 1;",

		"CREATE TABLE {$table_prefix}anti_bot_quest (
			id int DEFAULT nextval('{$table_prefix}anti_bot_quest_id_seq'::text) NOT NULL,
			question text NOT NULL,
			answer1 varchar(255) DEFAULT '' NOT NULL,
			answer2 varchar(255) DEFAULT '' NOT NULL,
			answer3 varchar(255) DEFAULT '' NOT NULL,
			answer4 varchar(255) DEFAULT '' NOT NULL,
			answer5 varchar(255) DEFAULT '' NOT NULL,
			anti_bot_img varchar(255) DEFAULT '' NOT NULL,
			lang varchar(255) DEFAULT '' NOT NULL,
			use_html char(1) DEFAULT '0' NOT NULL,
			CONSTRAINT {$table_prefix}anti_bot_quest_pkey PRIMARY KEY (id)
			);",

		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (1, 'Wobei handelt es sich um einen Planeten?<br />Amerika, Erde, Katze, Universitt', 'Erde', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (2, 'Wobei handelt es sich um ein Tier?<br />Auto, Berg, Europa, Pferd', 'Pferd', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (3, 'Drei mal drei ist? (Ergebnis ausschreiben, nicht als Zahl eingeben.)', 'neun', 'Neun', '', '', '', '', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (4, 'Ist auf dem Bild Feuer zu sehen? Ja oder Nein', 'Ja', 'ja', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (5, 'Welche Frucht ist auf dem Bild zu sehen?', 'Apfel', '', '', '', '', 'example5.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (6, 'Siehst du auf dem Bild ein Flugzeug?', 'Nein', 'nein', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (7, 'Wieviele blau Linien zhlst du auf dem Bild?', '4', 'vier', 'Vier', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (8, 'Wieviele rote Linien sind auf dem Bild zu sehen?', '5', 'fnf', 'fuenf', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (9, 'Das Ergebnis der Rechenaufgabe lautet?', '5', 'fnf', 'fuenf', '', '', 'example4.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (10, 'Wieviele Pfeile sind im Bild zu finden?', '6', 'sechs', 'Sechs', '', '', 'example1.jpg', 'german', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (11, 'What of these four is an planet?<br />America, Cat, Earth, University', 'Earth', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (12, 'What of these four is an animal?<br />Car, Europe, Horse, Mountain', 'Horse', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (13, 'What is the result of three multiplied by three? (Do not use numbers in your answer. e.g. If the result is 5, then write five.)', 'nine', 'Nine', '', '', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (14, 'Shows the picture fire? Yes or no', 'Yes', 'yes', '', '', '', 'example2.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (15, 'What kind of fruit is shown on the picture?', 'Appel', 'appel', '', '', '', 'example5.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (16, 'Can you see an airplane on the photo?', 'No', 'no', '', 'example2.jpg', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (17, 'How many blue lines can you count on the image?', '4', 'four', 'Four', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (18, 'How many red lines can you see on the image?', '5', 'five', 'Five', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (19, 'What is the result of...', '5', 'five', 'Five', '', '', 'example4.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (20, 'How many arrows can you find?', '6', 'six', 'Six', '', '', 'example1.jpg', 'english', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (21, 'Dans les choix suivants, o est la plante?<br />Amrique, Chat, Terre, Universit', 'Terre', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (22, 'Dans les choix suivants, o est l\'animal?<br />Voiture, Europe, Cheval, Montagne', 'Cheval', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (23, 'Combien font trois X trois? (n\'utilisez pas de nombre dans votre rponse. par ex. si le rsultat est 5, alors crivez cinq.)', 'neuf', 'Neuf', '', '', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (24, 'Montrer la photo du feu? Oui ou non', 'Oui', 'oui', '', '', '', 'example2.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (25, 'Quel sorte de fruit apparat sur cette photo?', 'Pomme', 'pomme', '', '', '', 'example5.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (26, 'Voyez-vous un avion sur cette photo?', 'Non', 'non', '', 'example2.jpg', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (27, 'Combien de lignes bleues comptez-vous sur cette image?', '4', 'quatre', 'Quatre', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (28, 'Combien de lignes rouges comptez-vous sur cette image?', '5', 'cinq', 'Cing', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (29, 'Quel est le rsultat de cette addition ?', '5', 'cinq', 'Cinq', '', '', 'example4.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (30, 'Combien comptez-vous de flches?', '6', 'six', 'Six', '', '', 'example1.jpg', 'french', '0');",

		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest', '0');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_guest', '0');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_get', 'abq_0001');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_casesen', '1');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_bild', '0');"
		);
	break;

	case 'mssql':
	case 'mssql-odbc':
		$sql = array(
		"CREATE TABLE [{$table_prefix}anti_bot_quest] (
			[id] [int] IDENTITY (1, 1) NOT NULL,
			[question] [varchar] (255) NOT NULL,
			[answer1] [varchar] (255) NOT NULL,
			[answer2] [varchar] (255) NOT NULL,
			[answer3] [varchar] (255) NOT NULL,
			[answer4] [varchar] (255) NOT NULL,
			[answer5] [varchar] (255) NOT NULL,
			[anti_bot_img] [varchar] (255) NOT NULL,
			[lang] [varchar] (255) NOT NULL,
			[use_html] [char] ( 1 ) NOT NULL
		) ON [PRIMARY];",

		"ALTER TABLE [{$table_prefix}anti_bot_quest] WITH NOCHECK ADD
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_answer1] DEFAULT ('') FOR [answer1],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_answer2] DEFAULT ('') FOR [answer2],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_answer3] DEFAULT ('') FOR [answer3],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_answer4] DEFAULT ('') FOR [answer4],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_answer5] DEFAULT ('') FOR [answer5],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_anti_bot_img] DEFAULT ('') FOR [anti_bot_img],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_lang] DEFAULT ('') FOR [lang],
			CONSTRAINT [DF_{$table_prefix}anti_bot_quest_use_html] DEFAULT ('0') FOR [use_html]",

		"SET IDENTITY_INSERT {$table_prefix}anti_bot_quest ON;",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (1, 'Wobei handelt es sich um einen Planeten?<br />Amerika, Erde, Katze, Universitt', 'Erde', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (2, 'Wobei handelt es sich um ein Tier?<br />Auto, Berg, Europa, Pferd', 'Pferd', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (3, 'Drei mal drei ist? (Ergebnis ausschreiben, nicht als Zahl eingeben.)', 'neun', 'Neun', '', '', '', '', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (4, 'Ist auf dem Bild Feuer zu sehen? Ja oder Nein', 'Ja', 'ja', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (5, 'Welche Frucht ist auf dem Bild zu sehen?', 'Apfel', '', '', '', '', 'example5.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (6, 'Siehst du auf dem Bild ein Flugzeug?', 'Nein', 'nein', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (7, 'Wieviele blau Linien zhlst du auf dem Bild?', '4', 'vier', 'Vier', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (8, 'Wieviele rote Linien sind auf dem Bild zu sehen?', '5', 'fnf', 'fuenf', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (9, 'Das Ergebnis der Rechenaufgabe lautet?', '5', 'fnf', 'fuenf', '', '', 'example4.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (10, 'Wieviele Pfeile sind im Bild zu finden?', '6', 'sechs', 'Sechs', '', '', 'example1.jpg', 'german', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (11, 'What of these four is an planet?<br />America, Cat, Earth, University', 'Earth', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (12, 'What of these four is an animal?<br />Car, Europe, Horse, Mountain', 'Horse', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (13, 'What is the result of three multiplied by three? (Do not use numbers in your answer. e.g. If the result is 5, then write five.)', 'nine', 'Nine', '', '', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (14, 'Shows the picture fire? Yes or no', 'Yes', 'yes', '', '', '', 'example2.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (15, 'What kind of fruit is shown on the picture?', 'Appel', 'appel', '', '', '', 'example5.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (16, 'Can you see an airplane on the photo?', 'No', 'no', '', 'example2.jpg', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (17, 'How many blue lines can you count on the image?', '4', 'four', 'Four', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (18, 'How many red lines can you see on the image?', '5', 'five', 'Five', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (19, 'What is the result of...', '5', 'five', 'Five', '', '', 'example4.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (20, 'How many arrows can you find?', '6', 'six', 'Six', '', '', 'example1.jpg', 'english', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (21, 'Dans les choix suivants, o est la plante?<br />Amrique, Chat, Terre, Universit', 'Terre', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (22, 'Dans les choix suivants, o est l\'animal?<br />Voiture, Europe, Cheval, Montagne', 'Cheval', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (23, 'Combien font trois X trois? (n\'utilisez pas de nombre dans votre rponse. par ex. si le rsultat est 5, alors crivez cinq.)', 'neuf', 'Neuf', '', '', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (24, 'Montrer la photo du feu? Oui ou non', 'Oui', 'oui', '', '', '', 'example2.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (25, 'Quel sorte de fruit apparat sur cette photo?', 'Pomme', 'pomme', '', '', '', 'example5.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (26, 'Voyez-vous un avion sur cette photo?', 'Non', 'non', '', 'example2.jpg', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (27, 'Combien de lignes bleues comptez-vous sur cette image?', '4', 'quatre', 'Quatre', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (28, 'Combien de lignes rouges comptez-vous sur cette image?', '5', 'cinq', 'Cing', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (29, 'Quel est le rsultat de cette addition ?', '5', 'cinq', 'Cinq', '', '', 'example4.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest (id, question, answer1, answer2, answer3, answer4, answer5, anti_bot_img, lang, use_html) VALUES (30, 'Combien comptez-vous de flches?', '6', 'six', 'Six', '', '', 'example1.jpg', 'french', '0');",
		"SET IDENTITY_INSERT {$table_prefix}anti_bot_quest OFF;",

		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest', '0');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_guest', '0');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_get', 'abq_0001');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_casesen', '1');",
		"INSERT INTO {$table_prefix}config (config_name, config_value) VALUES ('anti_bot_quest_bild', '0');"
		);
	break;

	case 'mysql':
	case 'mysql4':
	default:
		$sql = array(
		"CREATE TABLE {$table_prefix}anti_bot_quest (
			id mediumint(8) NOT NULL auto_increment,
			question text NOT NULL,
			answer1 varchar(255) NOT NULL default '',
			answer2 varchar(255) NOT NULL default '',
			answer3 varchar(255) NOT NULL default '',
			answer4 varchar(255) NOT NULL default '',
			answer5 varchar(255) NOT NULL default '',
			anti_bot_img varchar(255) NOT NULL default '',
			lang varchar(255) NOT NULL default '',
			use_html CHAR( 1 ) DEFAULT '0' NOT NULL,
			PRIMARY KEY (id)
			) TYPE=MyISAM AUTO_INCREMENT=1;",

		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Wobei handelt es sich um einen Planeten?<br />Amerika, Erde, Katze, Universitt', 'Erde', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Wobei handelt es sich um ein Tier?<br />Auto, Berg, Europa, Pferd', 'Pferd', '', '', '', '', '', 'german', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Drei mal drei ist? (Ergebnis ausschreiben, nicht als Zahl eingeben.)', 'neun', 'Neun', '', '', '', '', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Ist auf dem Bild Feuer zu sehen? Ja oder Nein', 'Ja', 'ja', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Welche Frucht ist auf dem Bild zu sehen?', 'Apfel', '', '', '', '', 'example5.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Siehst du auf dem Bild ein Flugzeug?', 'Nein', 'nein', '', '', '', 'example2.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Wieviele blau Linien zhlst du auf dem Bild?', '4', 'vier', 'Vier', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Wieviele rote Linien sind auf dem Bild zu sehen?', '5', 'fnf', 'fuenf', '', '', 'example3.gif', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Das Ergebnis der Rechenaufgabe lautet?', '5', 'fnf', 'fuenf', '', '', 'example4.jpg', 'german', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Wieviele Pfeile sind im Bild zu finden?', '6', 'sechs', 'Sechs', '', '', 'example1.jpg', 'german', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'What of these four is an planet?<br />America, Cat, Earth, University', 'Earth', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'What of these four is an animal?<br />Car, Europe, Horse, Mountain', 'Horse', '', '', '', '', '', 'english', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'What is the result of three multiplied by three? (Do not use numbers in your answer. e.g. If the result is 5, then write five.)', 'nine', 'Nine', '', '', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Shows the picture fire? Yes or no', 'Yes', 'yes', '', '', '', 'example2.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'What kind of fruit is shown on the picture?', 'Appel', 'appel', '', '', '', 'example5.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Can you see an airplane on the photo?', 'No', 'no', '', 'example2.jpg', '', '', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'How many blue lines can you count on the image?', '4', 'four', 'Four', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'How many red lines can you see on the image?', '5', 'five', 'Five', '', '', 'example3.gif', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'What is the result of...', '5', 'five', 'Five', '', '', 'example4.jpg', 'english', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'How many arrows can you find?', '6', 'six', 'Six', '', '', 'example1.jpg', 'english', '0');",

		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Dans les choix suivants, o est la plante?<br />Amrique, Chat, Terre, Universit', 'Terre', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Dans les choix suivants, o est l\'animal?<br />Voiture, Europe, Cheval, Montagne', 'Cheval', '', '', '', '', '', 'french', '1');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Combien font trois X trois? (n\'utilisez pas de nombre dans votre rponse. par ex. si le rsultat est 5, alors crivez cinq.)', 'neuf', 'Neuf', '', '', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Montrer la photo du feu? Oui ou non', 'Oui', 'oui', '', '', '', 'example2.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Quel sorte de fruit apparat sur cette photo?', 'Pomme', 'pomme', '', '', '', 'example5.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Voyez-vous un avion sur cette photo?', 'Non', 'non', '', 'example2.jpg', '', '', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Combien de lignes bleues comptez-vous sur cette image?', '4', 'quatre', 'Quatre', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Combien de lignes rouges comptez-vous sur cette image?', '5', 'cinq', 'Cing', '', '', 'example3.gif', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Quel est le rsultat de cette addition ?', '5', 'cinq', 'Cinq', '', '', 'example4.jpg', 'french', '0');",
		"INSERT INTO {$table_prefix}anti_bot_quest VALUES ('', 'Combien comptez-vous de flches?', '6', 'six', 'Six', '', '', 'example1.jpg', 'french', '0');",

		"INSERT INTO {$table_prefix}config (`config_name`, `config_value`) VALUES ('anti_bot_quest', '0');",
		"INSERT INTO {$table_prefix}config (`config_name`, `config_value`) VALUES ('anti_bot_quest_guest', '0');",
		"INSERT INTO {$table_prefix}config (`config_name`, `config_value`) VALUES ('anti_bot_quest_get', 'abq_0001');",
		"INSERT INTO {$table_prefix}config (`config_name`, `config_value`) VALUES ('anti_bot_quest_casesen', '1');",
		"INSERT INTO {$table_prefix}config (`config_name`, `config_value`) VALUES ('anti_bot_quest_bild', '0');"
		);
	break;
}

foreach ( $sql AS $query )
{
   if ( !($result = $db->sql_query($query)) )
   {
      $error = $db->sql_error();
      print('<li>' . nl2br($query) . '<br /> +++ <font color="#FF0000"><b>Error:</b></font> ' . $error['message'] . '</li><br />');
   }
   else
   {
      print('<li>' . nl2br($query) . '<br /> +++ <font color="#00AA00"><b>Successfull</b></font></li><br />');
   }
}

$forum_url = append_sid($phpbb_root_path . "index.$phpEx");
$phpbb_url = "http://phpbb.mwegner.de/";

print<<<DELIM
        </ul>
      </span>
    </td>
  </tr>
  <tr>
    <td class="catBottom" height="28">&nbsp;</td>
  </tr>
  <tr>
    <td class="catBottom" colspan="2" align="center">Finished</td>
  </tr>
</table>

<br />
<br />

<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">
  <tr>
    <th class="thHead">SQL Installation complete</th>
  </tr>
  <tr>
    <td>
      <span class="genmed">Please delete this file (db_update.{$phpEx}).<br />
      If you have any problems, please visit <a href="{$phpbb_url}" target="_new">{$phpbb_url}</a> and ask for help.</span>
    </td>
  </tr>
  <tr>
    <td class="catBottom" height="28" align="center">
      <span class="genmed"><a href="{$forum_url}">Click Here to return to your forum.</a>
      </span>
    </td>
  </tr>
</table>

DELIM;

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>