<?php // $Id: install_db.inc.php,v 1.95.2.1 2005/07/28 09:55:36 roane Exp $
/*
==============================================================================
	Dokeos - elearning and course management software

	Copyright (c) 2004 Dokeos S.A.
	Copyright (c) 2003 Ghent University (UGent)
	Copyright (c) 2001 Universite catholique de Louvain (UCL)

	For a full list of contributors, see "credits.txt".
	The full license can be read in "license.txt".

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	See the GNU General Public License for more details.

	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
	Mail: info@dokeos.com
==============================================================================
*/
/**
==============================================================================
*	Install the Dokeos database
*	Notice : This script has to be included by index.php
*
*	@package dokeos.install
==============================================================================
*/

if(defined('DOKEOS_INSTALL'))
{
	@mysql_connect($dbHostForm,$dbUsernameForm,$dbPassForm);

	if(mysql_errno() > 0)
	{
		$no=mysql_errno();
		$msg=mysql_error();

		echo '<hr>['.$no.'] - '.$msg.'<hr>
		The mySQL server doesn\'t work or login / pass is bad.<br><br>
		Please check these values :<br><br>
	    <b>host</b> : '.$dbHostForm.'<br>
		<b>user</b> : '.$dbUsernameForm.'<br>
		<b>password</b> : '.$dbPassForm.'<br><br>
		Please go back to step 3.
	    <p><input type="submit" name="step3" value="&lt; Back"></p>
	    </td></tr></table></form></body></html>';

	    exit();
	}

	if($urlForm[strlen($urlForm)-1] != '/')
	{
		$urlForm=$urlForm.'/';
	}

	if($encryptPassForm)
	{
		$passToStore=md5($passForm);
	}
	else
	{
		$passToStore=($passForm);
	}

	$dbPrefixForm=eregi_replace('[^a-z0-9_-]','',$dbPrefixForm);

	$dbNameForm=eregi_replace('[^a-z0-9_-]','',$dbNameForm);
	$dbStatsForm=eregi_replace('[^a-z0-9_-]','',$dbStatsForm);
	$dbScormForm=eregi_replace('[^a-z0-9_-]','',$dbScormForm);
	$dbUserForm=eregi_replace('[^a-z0-9_-]','',$dbUserForm);

	if(!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm,$dbNameForm))
	{
		$dbNameForm=$dbPrefixForm.$dbNameForm;
	}

	if(!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm,$dbStatsForm))
	{
		$dbStatsForm=$dbPrefixForm.$dbStatsForm;
	}

	if(!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm,$dbScormForm))
	{
		$dbScormForm=$dbPrefixForm.$dbScormForm;
	}

	if(!empty($dbPrefixForm) && !ereg('^'.$dbPrefixForm,$dbUserForm))
	{
		$dbUserForm=$dbPrefixForm.$dbUserForm;
	}

	$mysqlMainDb=$dbNameForm;
	$mysqlStatsDb=$dbStatsForm;
	$mysqlScormDb=$dbScormForm;
	$mysqlUserDb=$dbUserForm;

	if(empty($mysqlMainDb) || $mysqlMainDb == 'mysql' || $mysqlMainDb == $dbPrefixForm)
	{
		$mysqlMainDb=$dbPrefixForm.'main';
	}

	if(empty($mysqlStatsDb) || $mysqlStatsDb == 'mysql' || $mysqlStatsDb == $dbPrefixForm)
	{
		$mysqlStatsDb=$dbPrefixForm.'stats';
	}

	if(empty($mysqlScormDb) || $mysqlScormDb == 'mysql' || $mysqlScormDb == $dbPrefixForm)
	{
		$mysqlScormDb=$dbPrefixForm.'scorm';
	}

	if(empty($mysqlUserDb) || $mysqlUserDb == 'mysql' || $mysqlUserDb == $dbPrefixForm)
	{
		$mysqlUserDb=$dbPrefixForm.'user';
	}

	$result=mysql_query("SHOW VARIABLES LIKE 'datadir'") or die(mysql_error());

	$mysqlRepositorySys=mysql_fetch_array($result);
	$mysqlRepositorySys=$mysqlRepositorySys['Value'];

	mysql_query("DROP DATABASE IF EXISTS `$mysqlMainDb`") or die(mysql_error());
	mysql_query("CREATE DATABASE `$mysqlMainDb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or die(mysql_error());

	if($mysqlStatsDb == $mysqlMainDb && $mysqlScormDb == $mysqlMainDb && $mysqlUserDb == $mysqlMainDb)
	{
		$singleDbForm=true;
	}

	/**
	* CREATING THE STATISTICS DATABASE
	*/
	if($mysqlStatsDb != $mysqlMainDb)
	{
		if(!$singleDbForm)
		{
			// multi DB mode AND tracking has its own DB so create it
			mysql_query("DROP DATABASE IF EXISTS `$mysqlStatsDb`") or die(mysql_error());
			mysql_query("CREATE DATABASE `$mysqlStatsDb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or die(mysql_error());
		}
		else
		{
			// single DB mode so $mysqlStatsDb MUST BE the SAME than $mysqlMainDb
			$mysqlStatsDb=$mysqlMainDb;
		}
	}

	/**
	* CREATING THE SCORM DATABASE
	*/
	if($mysqlScormDb != $mysqlMainDb)
	{
		if(!$singleDbForm)
		{
			// multi DB mode AND scorm has its own DB so create it
			mysql_query("DROP DATABASE IF EXISTS `$mysqlScormDb`") or die(mysql_error());
			mysql_query("CREATE DATABASE `$mysqlScormDb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or die(mysql_error());
		}
		else
		{
			// single DB mode so $mysqlScormDb MUST BE the SAME than $mysqlMainDb
			$mysqlScormDb=$mysqlMainDb;
		}
	}

	/**
	* CREATING THE USER DATABASE
	*/
	if($mysqlUserDb != $mysqlMainDb)
	{
		if(!$singleDbForm)
		{
			// multi DB mode AND user data has its own DB so create it
			mysql_query("DROP DATABASE IF EXISTS `$mysqlUserDb`") or die(mysql_error());
			mysql_query("CREATE DATABASE `$mysqlUserDb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or die(mysql_error());
		}
		else
		{
			// single DB mode so $mysqlUserDb MUST BE the SAME than $mysqlMainDb
			$mysqlUserDb=$mysqlMainDb;
		}
	}

	include("../lang/english/create_course.inc.php");

	if($languageForm != 'english')
	{
		include("../lang/$languageForm/create_course.inc.php");
	}

	/**
	* creating the tables of the main database
	 */
	mysql_select_db($mysqlMainDb) or die(mysql_error());

	mysql_query("CREATE TABLE `admin` (
				`user_id` int unsigned NOT NULL,
				UNIQUE KEY `user_id` (`user_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `class` (
				`id` mediumint unsigned NOT NULL auto_increment,
				`code` varchar(40) default '',
				`name` text NOT NULL,
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `class_user` (
				`class_id` mediumint unsigned NOT NULL,
				`user_id` int unsigned NOT NULL,
				PRIMARY KEY  (`class_id`,`user_id`)
				) TYPE=MyISAM") or die(mysql_error());

	# in the course table, the course_language field should later be
	# made a reference to a "language" table - YW
	mysql_query("CREATE TABLE `course` (
				`code` varchar(40) NOT NULL,
				`directory` varchar(40) default NULL,
				`db_name` varchar(40) default NULL,
				`course_language` varchar(20) default NULL,
				`title` varchar(250) default NULL,
				`description` text,
				`category_code` varchar(40) default NULL,
				`visibility` tinyint default 0,
				`show_score` int NOT NULL default 1,
				`tutor_name` varchar(200) default NULL,
				`visual_code` varchar(40) default NULL,
				`department_name` varchar(30) default NULL,
				`department_url` varchar(180) default NULL,
				`disk_quota` int unsigned default NULL,
				`last_visit` datetime default NULL,
				`last_edit` datetime default NULL,
				`creation_date` datetime default NULL,
				`expiration_date` datetime default NULL,
				`target_course_code` varchar( 40 ) DEFAULT NULL,
				`subscribe` tinyint DEFAULT 1 NOT NULL,
				`unsubscribe` tinyint DEFAULT 1 NOT NULL,
				PRIMARY KEY  (`code`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `course_rel_class` (
				`course_code` char(40) NOT NULL,
				`class_id` mediumint unsigned NOT NULL,
				PRIMARY KEY  (`course_code`,`class_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `course_rel_user` (
				`course_code` varchar(40) NOT NULL,
				`user_id` int unsigned NOT NULL,
				`status` tinyint NOT NULL default 5,
				`role` varchar(60) default NULL,
				`group_id` int NOT NULL default 0,
				`tutor_id` int unsigned NOT NULL default 0,
				`sort` int,
				`user_course_cat` int default 0,
				PRIMARY KEY  (`course_code`,`user_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `course_category` (
				`id` int unsigned NOT NULL auto_increment,
				`name` varchar(100) NOT NULL default '',
				`code` varchar(40) NOT NULL default '',
				`parent_id` varchar(40) default NULL,
				`tree_pos` int unsigned default NULL,
				`children_count` smallint default NULL,
				`auth_course_child` enum('TRUE','FALSE') default 'TRUE',
				`auth_cat_child` enum('TRUE','FALSE') default 'TRUE',
				PRIMARY KEY  (`id`),
				UNIQUE KEY `code` (`code`),
				KEY `parent_id` (`parent_id`),
				KEY `tree_pos` (`tree_pos`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `user` (
				 `user_id` int unsigned NOT NULL auto_increment,
				 `lastname` varchar(60) default NULL,
				 `firstname` varchar(60) default NULL,
				 `username` varchar(20) NOT NULL default '',
				 `password` varchar(50) NOT NULL default '',
				 `auth_source` varchar(50) default 'claroline',
				 `email` varchar(100) default NULL,
				 `status` tinyint NOT NULL default '5',
				 `official_code` varchar(40) default NULL,
				 `phone` varchar(30) default NULL,
				 `picture_uri` varchar(250) default NULL,
				 `creator_id` int unsigned default NULL,
				 `competences` text,
				 `diplomas` text,
				 `openarea` text,
				 `teach` text,
				 `productions` varchar(250) default NULL,
				 `chatcall_user_id` int unsigned NOT NULL default '0',
				 `chatcall_date` datetime NOT NULL default '0000-00-00 00:00:00',
				 `chatcall_text` varchar(50) NOT NULL default '',
				 PRIMARY KEY  (`user_id`),
				 UNIQUE KEY `username` (`username`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `session` (
				 `sess_id` varchar(32) NOT NULL default '',
				 `sess_name` varchar(10) NOT NULL default '',
				 `sess_time` int NOT NULL default 0,
				 `sess_start` int NOT NULL default 0,
				 `sess_value` text NOT NULL,
				 PRIMARY KEY  (`sess_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `course_module` (
				`id` int unsigned NOT NULL auto_increment,
				`name` varchar(100) NOT NULL,
				`link` varchar(255) NOT NULL,
				`image` varchar(100) default NULL,
				`row` int unsigned NOT NULL default 0,
				`column` int unsigned NOT NULL default 0,
				`position` varchar(20) NOT NULL default 'basic',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `sys_announcement` (
  				`id` int unsigned NOT NULL auto_increment,
  				`date_start` datetime NOT NULL default '0000-00-00 00:00:00',
  				`date_end` datetime NOT NULL default '0000-00-00 00:00:00',
  				`visible_teacher` enum('true','false') NOT NULL default 'false',
  				`visible_student` enum('true','false') NOT NULL default 'false',
  				`visible_guest` enum('true','false') NOT NULL default 'false',
  				`title` varchar(250) NOT NULL default '',
  				`content` text NOT NULL,
  				PRIMARY KEY  (`id`)
				) TYPE=MyISAM;") or die(mysql_error());

	// creating the table for the language dropdown box
	mysql_query("CREATE TABLE `language` (
  				`id` tinyint unsigned NOT NULL auto_increment,
  				`original_name` varchar(255) default NULL,
				`english_name` varchar(255) default NULL,
				`isocode` varchar(10) default NULL,
				`dokeos_folder` varchar(250) default NULL,
				`available` tinyint NOT NULL default 1,
				PRIMARY KEY `id` (`id`)
				) TYPE=MyISAM;") or die(mysql_error());

	// filling the language table with all the available languages
	mysql_query("INSERT INTO `language` VALUES (18, 'Melayu (Bahasa M.)', 'malay', 'ms', 'malay', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (17, 'Nihongo', 'japanese', 'ja', 'japanese', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (16, 'Italiano', 'italian', 'it', 'italian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (14, 'Magyar', 'hungarian', 'hu', 'hungarian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (13, 'Ellinika', 'greek', 'el', 'greek', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (12, 'Deutsch', 'german', 'de', 'german', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (11, 'Galego', 'galician', 'gl', 'galician', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (15, 'Indonesia (Bahasa I.)', 'indonesian', 'id', 'indonesian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (10, 'Fran&ccedil;ais', 'french', 'fr', 'french', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (9, 'Suomi', 'finnish', 'fi', 'finnish', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (8, 'English', 'english', 'en', 'english', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (7, 'Nederlands', 'dutch', 'nl', 'dutch', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (6, 'Dansk', 'danish', 'da', 'danish', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (5, 'Hrvatski', 'croatian', 'hr', 'croatian', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (4, 'Catal&agrave;', 'catalan', 'ca', 'catalan', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (3, 'Balgarski', 'bulgarian', 'bg', 'bulgarian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (2, 'Portugu&ecirc;s (Brazil)', 'brazilian', 'pt-BR', 'brazilian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (1, 'Arabija (el)', 'arabic', 'ar', 'arabic', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (19, 'Polski', 'polish', 'pl', 'polish', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (20, 'Portugu&ecirc;s (Portugal)', 'portuguese', 'pt', 'portuguese', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (21, 'Russkij', 'russian', 'ru', 'russian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (22, 'Chinese (simplified)', 'simpl_chinese', 'zh', 'simpl_chinese', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (23, 'Slovenscina', 'slovenian', 'sl', 'slovenian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (24, 'Espa&ntilde;ol', 'spanish', 'es', 'spanish', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (25, 'Svenska', 'swedish', 'sv', 'swedish', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (26, 'Thai', 'thai', 'th', 'thai', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (27, 'T&uuml;rk&ccedil;e', 'turkce', 'tr', 'turkce', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (28, 'Vi&ecirc;t (Ti&ecirc;ng V.)', 'vietnamese', 'vi', 'vietnamese', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (29, 'Norsk', 'norwegian', 'no', 'norwegian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (30, 'Farsi', 'persian', 'fa', 'persian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (31, 'Srpski', 'serbian', 'sr', 'serbian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (32, 'Bosanski', 'bosnian', NULL, 'bosnian', 1);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (33, 'Swahili (kiSw.)', 'swahili', 'sw', 'swahili', 0);") or die(mysql_error());
	mysql_query("INSERT INTO `language` VALUES (34, 'Esperanto', 'esperanto', 'es', 'esperanto', 1);") or die(mysql_error());

	// create the table that stores all the configuration settings
	mysql_query("CREATE TABLE `settings_current` (
					  `id` int unsigned NOT NULL auto_increment,
					  `variable` varchar(255) default NULL,
					  `subkey` varchar(255) default NULL,
					  `type` varchar(255) default NULL,
					  `category` varchar(255) default NULL,
					  `selected_value` varchar(255) default NULL,
					  `title` varchar(255) NOT NULL default '',
					  `comment` varchar(255) default NULL,
					  `scope` varchar(50) default NULL,
					  `subkeytext` varchar(255) default NULL,
					  UNIQUE KEY `id` (`id`)
				) TYPE=MyISAM;") or die(mysql_error());

	// Fill the table with the configuration settings
	mysql_query("INSERT INTO `settings_current` VALUES (1, 'Institution', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$institutionForm)."', 'InstitutionTitle', 'InstitutionComment', 'platform', NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (2, 'InstitutionUrl', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$institutionUrlForm)."', 'InstitutionUrlTitle', 'InstitutionUrlComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (3, 'siteName', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$campusForm)."', 'SiteNameTitle', 'SiteNameComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (4, 'emailAdministrator', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$emailForm)."', 'emailAdministratorTitle', 'emailAdministratorComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (5, 'administratorSurname', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$adminLastName)."', 'administratorSurnameTitle', 'administratorSurnameComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (6, 'administratorName', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$adminFirstName)."', 'administratorNameTitle', 'administratorNameComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (7, 'show_administrator_data', NULL, 'radio', 'Platform', 'true', 'ShowAdministratorDataTitle', 'ShowAdministratorDataComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (8, 'homepage_view', NULL, 'radio', 'Course', 'default', 'HomepageViewTitle', 'HomepageViewComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (9, 'show_toolshortcuts', NULL, 'radio', 'Course', 'false', 'ShowToolShortcutsTitle', 'ShowToolShortcutsComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (10, 'show_student_view', NULL, 'radio', 'Course', 'true', 'ShowStudentViewTitle', 'ShowStudentViewComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (11, 'allow_group_categories', NULL, 'radio', 'Course', 'false', 'AllowGroupCategories', 'AllowGroupCategoriesComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (12, 'server_type', NULL, 'radio', 'Platform', 'production', 'ServerStatusTitle', 'ServerStatusComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (13, 'platformLanguage', NULL, 'link', 'Languages', '".$languageForm."', 'PlatformLanguageTitle', 'PlatformLanguageComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (14, 'showonline', NULL, 'radio', 'Platform', 'true', 'ShowOnlineTitle', 'ShowOnlineComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (15, 'profile', 'name', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'name');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (16, 'profile', 'officialcode', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'officialcode');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (17, 'profile', 'email', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'Email');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (18, 'profile', 'picture', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'UserPicture');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (19, 'profile', 'login', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'Login');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (20, 'profile', 'password', 'checkbox', 'User', 'false', 'ProfileChangesTitle', 'ProfileChangesComment', NULL, 'UserPassword');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (21, 'default_document_quotum', NULL, 'textfield', 'Course', '50000000', 'DefaultDocumentQuotumTitle', 'DefaultDocumentQuotumComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (22, 'registration', 'officialcode', 'checkbox', 'User', 'true', 'RegistrationRequiredFormsTitle', 'RegistrationRequiredFormsComment', NULL, 'OfficialCode');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (23, 'registration', 'email', 'checkbox', 'User', 'true', 'RegistrationRequiredFormsTitle', 'RegistrationRequiredFormsComment', NULL, 'Email');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (24, 'default_group_quotum', NULL, 'textfield', 'Course', '5000000', 'DefaultGroupQuotumTitle', 'DefaultGroupQuotumComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (25, 'allow_registration', NULL, 'radio', 'Platform', '".trueFalse($allowSelfReg)."', 'AllowRegistrationTitle', 'AllowRegistrationComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (26, 'allow_registration_as_teacher', NULL, 'radio', 'Platform', '".trueFalse($allowSelfRegProf)."', 'AllowRegistrationAsTeacherTitle', 'AllowRegistrationAsTeacherComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (27, 'allow_lostpassword', NULL, 'radio', 'Platform', 'true', 'AllowLostPasswordTitle', 'AllowLostPasswordComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (28, 'allow_user_headings', NULL, 'radio', 'Course', 'false', 'AllowUserHeadings', 'AllowUserHeadingsComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (29, 'course_create_active_tools', 'course_description', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'CourseDescription');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (30, 'course_create_active_tools', 'agenda', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Agenda');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (31, 'course_create_active_tools', 'documents', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Documents');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (32, 'course_create_active_tools', 'learning_path', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'LearningPath');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (33, 'course_create_active_tools', 'links', 'checkbox', 'Tools', 'true', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Links');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (34, 'course_create_active_tools', 'announcements', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Announcements');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (35, 'course_create_active_tools', 'forums', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Forums');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (36, 'course_create_active_tools', 'dropbox', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Dropbox');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (37, 'course_create_active_tools', 'quiz', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Quiz');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (38, 'course_create_active_tools', 'users', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Users');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (39, 'course_create_active_tools', 'groups', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Groups');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (40, 'course_create_active_tools', 'chat', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'Chat');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (41, 'course_create_active_tools', 'online_conference', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'OnlineConference');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (42, 'course_create_active_tools', 'student_publications', 'checkbox', 'Tools', 'false', 'CourseCreateActiveToolsTitle', 'CourseCreateActiveToolsComment', NULL, 'StudentPublications');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (43, 'allow_personal_agenda', NULL, 'radio', 'User', 'false', 'AllowPersonalAgendaTitle', 'AllowPersonalAgendaComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (44, 'display_coursecode_in_courselist', NULL, 'radio', 'Platform', 'true', 'DisplayCourseCodeInCourselistTitle', 'DisplayCourseCodeInCourselistComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (45, 'display_teacher_in_courselist', NULL, 'radio', 'Platform', 'true', 'DisplayTeacherInCourselistTitle', 'DisplayTeacherInCourselistComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (46, 'use_document_title', NULL, 'radio', 'Tools', 'false', 'UseDocumentTitleTitle', 'UseDocumentTitleComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (47, 'permanently_remove_deleted_files', NULL , 'radio', 'Tools', 'false', 'PermanentlyRemoveFilesTitle', 'PermanentlyRemoveFilesComment', NULL , NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (48, 'dropbox_allow_overwrite', NULL, 'radio', 'Tools', 'true', 'DropboxAllowOverwriteTitle', 'DropboxAllowOverwriteComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (49, 'dropbox_max_filesize', NULL, 'textfield', 'Tools', '100000000', 'DropboxMaxFilesizeTitle', 'DropboxMaxFilesizeComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (50, 'dropbox_allow_just_upload', NULL, 'radio', 'Tools', 'true', 'DropboxAllowJustUploadTitle', 'DropboxAllowJustUploadComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (51, 'dropbox_allow_student_to_student', NULL, 'radio', 'Tools', 'true', 'DropboxAllowStudentToStudentTitle', 'DropboxAllowStudentToStudentComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (52, 'dropbox_allow_group', NULL, 'radio', 'Tools', 'true', 'DropboxAllowGroupTitle', 'DropboxAllowGroupComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (53, 'dropbox_allow_mailing', NULL, 'radio', 'Tools', 'false', 'DropboxAllowMailingTitle', 'DropboxAllowMailingComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (54, 'administratorTelephone', NULL, 'textfield', 'Platform', '".str_replace('"','\"',$adminPhoneForm)."', 'administratorTelephoneTitle', 'administratorTelephoneComment', NULL, NULL);") or die(mysql_error());
	mysql_query("INSERT INTO `settings_current` VALUES (55, 'extended_profile', NULL , 'radio', 'User', 'false', 'ExtendedProfileTitle', 'ExtendedProfileComment', NULL , NULL);") or die(mysql_error());

	// create the table that holds all the available options for the settings (if it is not a text field)
	mysql_query("CREATE TABLE `settings_options` (
				  `id` int unsigned NOT NULL auto_increment,
				  `variable` varchar(255) default NULL,
				  `value` varchar(255) default NULL,
				  `display_text` varchar(255) NOT NULL default '',
				  PRIMARY KEY  (`id`),
				  UNIQUE KEY `id` (`id`)
				) TYPE=MyISAM;") or die(mysql_error());

	// Fill the table with the configuration options
	mysql_query("INSERT INTO `settings_options` VALUES (11, 'show_administrator_data', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (12, 'show_administrator_data', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (13, 'homepage_view', 'default', 'HomepageViewDefault');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (14, 'homepage_view', 'basic_tools_fixed', 'HomepageViewFixed');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (15, 'show_toolshortcuts', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (16, 'show_toolshortcuts', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (17, 'show_student_view', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (18, 'show_student_view', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (19, 'allow_group_categories', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (20, 'allow_group_categories', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (22, 'server_type', 'production', 'ProductionServer');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (23, 'server_type', 'test', 'TestServer');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (24, 'showonline', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (25, 'showonline', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (26, 'allow_name_change', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (27, 'allow_name_change', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (28, 'allow_officialcode_change', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (29, 'allow_officialcode_change', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (30, 'allow_registration', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (31, 'allow_registration', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (32, 'allow_registration_as_teacher', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (33, 'allow_registration_as_teacher', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (34, 'allow_lostpassword', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (35, 'allow_lostpassword', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (36, 'allow_user_headings', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (37, 'allow_user_headings', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (38, 'allow_personal_agenda', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (39, 'allow_personal_agenda', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (40, 'display_coursecode_in_courselist', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (41, 'display_coursecode_in_courselist', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (42, 'display_teacher_in_courselist', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (43, 'display_teacher_in_courselist', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (44, 'use_document_title', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (45, 'use_document_title', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (46, 'permanently_remove_deleted_files', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (47, 'permanently_remove_deleted_files', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (48, 'dropbox_allow_overwrite', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (49, 'dropbox_allow_overwrite', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (50, 'dropbox_allow_just_upload', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (51, 'dropbox_allow_just_upload', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (52, 'dropbox_allow_student_to_student', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (53, 'dropbox_allow_student_to_student', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (54, 'dropbox_allow_group', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (55, 'dropbox_allow_group', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (56, 'dropbox_allow_mailing', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (57, 'dropbox_allow_mailing', 'false', 'No');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (58, 'extended_profile', 'true', 'Yes');") or die(mysql_error());
	mysql_query("INSERT INTO `settings_options` VALUES (59, 'extended_profile', 'false', 'No');") or die(mysql_error());

	mysql_query("INSERT INTO `course_category` (`id`, `code`, `parent_id`, `tree_pos`, `children_count`, `auth_course_child`, `auth_cat_child`, `name`)
				VALUES 	(1, 'LANG', NULL, 1, 0, 'TRUE', 'TRUE', 'Language skills'),
				(2, 'PC', NULL, 2, 0, 'TRUE', 'TRUE', 'PC Skills'),
				(3, 'PROJ', NULL, 3, 0, 'TRUE', 'TRUE', 'Projects')") or die(mysql_error());

	mysql_query("INSERT INTO `course_module` (`name`,`link`,`image`,`row`,`column`,`position`) VALUES
				('".TOOL_CALENDAR_EVENT."', 'calendar/agenda.php', 'agenda.gif', 1, 1, 'basic'),
				('".TOOL_LINK."', 'link/link.php', 'liens.gif', 4, 1, 'basic'),
				('".TOOL_DOCUMENT."', 'document/document.php', 'documents.gif', 3, 1, 'basic'),
				('".TOOL_STUDENTPUBLICATION."', 'work/work.php', 'works.gif', 3, 2, 'basic'),
				('".TOOL_ANNOUNCEMENT."', 'announcements/announcements.php', 'valves.gif', 2, 1, 'basic'),
				('".TOOL_USER."', 'user/user.php', 'membres.gif', 2, 3, 'basic'),
				('".TOOL_BB_FORUM."', 'phpbb/index.php', 'forum.gif', 1, 2, 'basic'),
				('".TOOL_QUIZ."', 'exercice/exercice.php', 'quiz.gif', 2, 2, 'basic'),
				('".TOOL_GROUP."', 'group/group.php', 'group.gif', 3, 3, 'basic'),
				('".TOOL_COURSE_DESCRIPTION."', 'course_description/', 'info.gif', 1, 3, 'basic'),
				('".TOOL_CHAT."', 'chat/chat.php', 'chat.gif', 0, 0, 'external'),
				('".TOOL_DROPBOX."', 'dropbox/index.php', 'dropbox.gif', 4, 2, 'basic'),
				('".TOOL_TRACKING."', 'tracking/courseLog.php', 'statistiques.gif', 1, 3, 'courseadmin'),
				('".TOOL_HOMEPAGE_LINK."', 'link/link.php?action=addlink', 'npage.gif', 1, 1, 'courseadmin'),
				('".TOOL_COURSE_SETTING."', 'course_info/infocours.php', 'referencement.gif', 1, 2, 'courseadmin'),
				('External', NULL, 'external.gif', 0, 0, 'external'),
				('AddedLearnpath', NULL, 'scormbuilder.gif', 0, 0, 'external'),
				('".TOOL_CONFERENCE."', 'online/online.php' , 'conf.gif', 0, 0, 'external'),
				('".TOOL_BACKUP."', 'coursecopy/backup.php' , 'backup.gif', 2, 1, 'courseadmin'),
				('".TOOL_COPY_COURSE_CONTENT."', 'coursecopy/copy_course.php' , 'copy.gif', 2, 2, 'courseadmin'),
				('".TOOL_RECYCLE_COURSE."', 'coursecopy/recycle_course.php' , 'recycle.gif', 2, 3, 'courseadmin'),
				('".TOOL_LEARNPATH."', 'scorm/scormdocument.php' , 'scorm.gif', 5, 1, 'basic')") or die(mysql_error());

	mysql_query("INSERT INTO `user` (`lastname`, `firstname`, `username`, `password`, `email`, `status`) VALUES ( '".addslashes($adminLastName)."', '".addslashes($adminFirstName)."', '$loginForm','$passToStore','$emailForm','1')") or die(mysql_error());

	$idOfAdmin=mysql_insert_id();

	mysql_query("INSERT INTO `admin` VALUES ('".$idOfAdmin."')") or die(mysql_error());

    /**
	* creating the tables of the tracking database
	*/

	mysql_select_db($mysqlStatsDb) or die(mysql_error());

	mysql_query("CREATE TABLE `track_c_browsers` (
				`id` int(11) NOT NULL auto_increment,
				`browser` varchar(255) NOT NULL default '',
				`counter` int(11) NOT NULL default '0',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_c_countries` (
				`id` int(11) NOT NULL auto_increment,
				`code` varchar(40) NOT NULL default '',
				`country` varchar(50) NOT NULL default '',
				`counter` int(11) NOT NULL default '0',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_c_os` (
				`id` int(11) NOT NULL auto_increment,
				`os` varchar(255) NOT NULL default '',
				`counter` int(11) NOT NULL default '0',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_c_providers` (
				`id` int(11) NOT NULL auto_increment,
				`provider` varchar(255) NOT NULL default '',
				`counter` int(11) NOT NULL default '0',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_c_referers` (
				`id` int(11) NOT NULL auto_increment,
				`referer` varchar(255) NOT NULL default '',
				`counter` int(11) NOT NULL default '0',
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_access` (
				`access_id` int(11) NOT NULL auto_increment,
				`access_user_id` int unsigned default NULL,
				`access_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`access_cours_code` varchar(40) NOT NULL default '0',
				`access_tool` varchar(30) default NULL,
				PRIMARY KEY  (`access_id`),
				KEY `access_user_id` (`access_user_id`),
				KEY `access_cours_code` (`access_cours_code`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_lastaccess` (
				`access_id` int(11) NOT NULL auto_increment,
				`access_user_id` int unsigned default NULL,
				`access_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`access_cours_code` varchar(40) NOT NULL default '0',
				`access_tool` varchar(30) default NULL,
				PRIMARY KEY  (`access_id`),
				KEY `access_user_id` (`access_user_id`),
				KEY `access_cours_code` (`access_cours_code`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_default` (
				`default_id` int(11) NOT NULL auto_increment,
				`default_user_id` int unsigned NOT NULL default '0',
				`default_cours_code` varchar(40) NOT NULL default '',
				`default_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`default_event_type` varchar(20) NOT NULL default '',
				`default_value_type` varchar(20) NOT NULL default '',
				`default_value` tinytext NOT NULL,
				PRIMARY KEY  (`default_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_downloads` (
				`down_id` int(11) NOT NULL auto_increment,
				`down_user_id` int unsigned default NULL,
				`down_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`down_cours_id` varchar(20) NOT NULL default '0',
				`down_doc_path` varchar(255) NOT NULL default '0',
				PRIMARY KEY  (`down_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_exercices` (
				`exe_id` int(11) NOT NULL auto_increment,
				`exe_user_id` int unsigned default NULL,
				`exe_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`exe_cours_id` varchar(40) NOT NULL default '',
				`exe_exo_id` mediumint unsigned NOT NULL default '0',
				`exe_result` smallint NOT NULL default '0',
				`exe_weighting` smallint NOT NULL default '0',
				PRIMARY KEY  (`exe_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_hotpotatoes` (
				`exe_name` VARCHAR( 255 ) NOT NULL ,
				`exe_user_id` int unsigned DEFAULT NULL ,
				`exe_date` DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL ,
				`exe_cours_id` varchar(40) NOT NULL ,
				`exe_result` smallint DEFAULT '0' NOT NULL ,
				`exe_weighting` smallint DEFAULT '0' NOT NULL
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_links` (
				`links_id` int NOT NULL auto_increment,
				`links_user_id` int unsigned default NULL,
				`links_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`links_cours_id` varchar(20) NOT NULL default '0',
				`links_link_id` int(11) NOT NULL default '0',
				PRIMARY KEY  (`links_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_login` (
				`login_id` int NOT NULL auto_increment,
				`login_user_id` int unsigned NOT NULL default '0',
				`login_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`login_ip` varchar(39) NOT NULL default '',
				PRIMARY KEY  (`login_id`),
				KEY `login_user_id` (`login_user_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_online` (
				`login_id` int NOT NULL auto_increment,
				`login_user_id` int unsigned NOT NULL default '0',
				`login_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`login_ip` varchar(39) NOT NULL default '',
				PRIMARY KEY  (`login_id`),
				KEY `login_user_id` (`login_user_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_open` (
				`open_id` int(11) NOT NULL auto_increment,
				`open_remote_host` tinytext NOT NULL,
				`open_agent` tinytext NOT NULL,
				`open_referer` tinytext NOT NULL,
				`open_date` datetime NOT NULL default '0000-00-00 00:00:00',
				PRIMARY KEY  (`open_id`)
				) TYPE=MyISAM") or die(mysql_error());

	mysql_query("CREATE TABLE `track_e_uploads` (
				`upload_id` int NOT NULL auto_increment,
				`upload_user_id` int unsigned default NULL,
				`upload_date` datetime NOT NULL default '0000-00-00 00:00:00',
				`upload_cours_id` varchar(20) NOT NULL default '0',
				`upload_work_id` int(11) NOT NULL default '0',
				PRIMARY KEY  (`upload_id`)
				) TYPE=MyISAM") or die(mysql_error());

    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (1, 'ac', 'Ascension (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (2, 'ad', 'Andorre', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (3, 'ae', 'Emirats  Arabes Unis', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (4, 'af', 'Afghanistan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (5, 'ag', 'Antigua et Barbuda', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (6, 'ai', 'Anguilla', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (7, 'al', 'Albanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (8, 'am', 'Arménie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (9, 'an', 'Antilles Neerlandaises', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (10, 'ao', 'Angola', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (11, 'aq', 'Antarctique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (12, 'ar', 'Argentine', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (13, 'as', 'American Samoa', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (14, 'au', 'Australie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (15, 'aw', 'Aruba', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (16, 'az', 'Azerbaijan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (17, 'ba', 'Bosnie Herzegovine', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (18, 'bb', 'Barbade', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (19, 'bd', 'Bangladesh', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (20, 'be', 'Belgique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (21, 'bf', 'Burkina Faso', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (22, 'bg', 'Bulgarie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (23, 'bh', 'Bahrain', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (24, 'bi', 'Burundi', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (25, 'bj', 'Benin', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (26, 'bm', 'Bermudes', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (27, 'bn', 'Brunei Darussalam', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (28, 'bo', 'Bolivie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (29, 'br', 'Brésil', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (30, 'bs', 'Bahamas', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (31, 'bt', 'Bhoutan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (32, 'bv', 'Bouvet (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (33, 'bw', 'Botswana', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (34, 'by', 'Biélorussie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (35, 'bz', 'Bélize', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (36, 'ca', 'Canada', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (37, 'cc', 'Cocos (Keeling) iles', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (38, 'cd', 'Congo, (République démocratique du)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (39, 'cf', 'Centrafricaine (République )', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (40, 'cg', 'Congo', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (41, 'ch', 'Suisse', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (42, 'ci', 'Cote d\'Ivoire', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (43, 'ck', 'Cook (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (44, 'cl', 'Chili', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (45, 'cm', 'Cameroun', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (46, 'cn', 'Chine', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (47, 'co', 'Colombie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (48, 'cr', 'Costa Rica', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (49, 'cu', 'Cuba', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (50, 'cv', 'Cap Vert', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (51, 'cx', 'Christmas (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (52, 'cy', 'Chypre', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (53, 'cz', 'Tchéque (République)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (54, 'de', 'Allemagne', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (55, 'dj', 'Djibouti', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (56, 'dk', 'Danemark', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (57, 'dm', 'Dominique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (58, 'do', 'Dominicaine (république)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (59, 'dz', 'Algérie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (60, 'ec', 'Equateur', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (61, 'ee', 'Estonie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (62, 'eg', 'Egypte', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (63, 'eh', 'Sahara Occidental', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (64, 'er', 'Erythrée', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (65, 'es', 'Espagne', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (66, 'et', 'Ethiopie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (67, 'fi', 'Finlande', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (68, 'fj', 'Fiji', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (69, 'fk', 'Falkland (Malouines) iles', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (70, 'fm', 'Micronésie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (71, 'fo', 'Faroe (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (72, 'fr', 'France', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (73, 'ga', 'Gabon', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (74, 'gd', 'Grenade', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (75, 'ge', 'Géorgie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (76, 'gf', 'Guyane Française', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (77, 'gg', 'Guernsey', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (78, 'gh', 'Ghana', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (79, 'gi', 'Gibraltar', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (80, 'gl', 'Groenland', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (81, 'gm', 'Gambie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (82, 'gn', 'Guinée', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (83, 'gp', 'Guadeloupe', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (84, 'gq', 'Guinée Equatoriale', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (85, 'gr', 'Grèce', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (86, 'gs', 'Georgie du sud et iles Sandwich du sud', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (87, 'gt', 'Guatemala', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (88, 'gu', 'Guam', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (89, 'gw', 'Guinée-Bissau', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (90, 'gy', 'Guyana', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (91, 'hk', 'Hong Kong', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (92, 'hm', 'Heard et McDonald (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (93, 'hn', 'Honduras', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (94, 'hr', 'Croatie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (95, 'ht', 'Haiti', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (96, 'hu', 'Hongrie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (97, 'id', 'Indonésie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (98, 'ie', 'Irlande', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (99, 'il', 'Israël', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (100, 'im', 'Ile de Man', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (101, 'in', 'Inde', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (102, 'io', 'Territoire Britannique de l\'Océan Indien', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (103, 'iq', 'Iraq', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (104, 'ir', 'Iran', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (105, 'is', 'Islande', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (106, 'it', 'Italie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (107, 'je', 'Jersey', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (108, 'jm', 'Jamaïque', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (109, 'jo', 'Jordanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (110, 'jp', 'Japon', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (111, 'ke', 'Kenya', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (112, 'kg', 'Kirgizstan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (113, 'kh', 'Cambodge', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (114, 'ki', 'Kiribati', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (115, 'km', 'Comores', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (116, 'kn', 'Saint Kitts et Nevis', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (117, 'kp', 'Corée du nord', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (118, 'kr', 'Corée du sud', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (119, 'kw', 'Koweït', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (120, 'ky', 'Caïmanes (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (121, 'kz', 'Kazakhstan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (122, 'la', 'Laos', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (123, 'lb', 'Liban', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (124, 'lc', 'Sainte Lucie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (125, 'li', 'Liechtenstein', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (126, 'lk', 'Sri Lanka', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (127, 'lr', 'Liberia', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (128, 'ls', 'Lesotho', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (129, 'lt', 'Lituanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (130, 'lu', 'Luxembourg', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (131, 'lv', 'Latvia', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (132, 'ly', 'Libyan Arab Jamahiriya', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (133, 'ma', 'Maroc', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (134, 'mc', 'Monaco', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (135, 'md', 'Moldavie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (136, 'mg', 'Madagascar', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (137, 'mh', 'Marshall (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (138, 'mk', 'Macédoine', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (139, 'ml', 'Mali', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (140, 'mm', 'Myanmar', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (141, 'mn', 'Mongolie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (142, 'mo', 'Macao', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (143, 'mp', 'Mariannes du nord (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (144, 'mq', 'Martinique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (145, 'mr', 'Mauritanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (146, 'ms', 'Montserrat', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (147, 'mt', 'Malte', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (148, 'mu', 'Maurice (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (149, 'mv', 'Maldives', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (150, 'mw', 'Malawi', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (151, 'mx', 'Mexique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (152, 'my', 'Malaisie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (153, 'mz', 'Mozambique', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (154, 'na', 'Namibie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (155, 'nc', 'Nouvelle Calédonie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (156, 'ne', 'Niger', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (157, 'nf', 'Norfolk (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (158, 'ng', 'Nigéria', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (159, 'ni', 'Nicaragua', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (160, 'nl', 'Pays Bas', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (161, 'no', 'Norvège', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (162, 'np', 'Népal', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (163, 'nr', 'Nauru', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (164, 'nu', 'Niue', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (165, 'nz', 'Nouvelle Zélande', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (166, 'om', 'Oman', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (167, 'pa', 'Panama', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (168, 'pe', 'Pérou', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (169, 'pf', 'Polynésie Française', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (170, 'pg', 'Papouasie Nouvelle Guinée', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (171, 'ph', 'Philippines', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (172, 'pk', 'Pakistan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (173, 'pl', 'Pologne', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (174, 'pm', 'St. Pierre et Miquelon', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (175, 'pn', 'Pitcairn (ile)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (176, 'pr', 'Porto Rico', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (177, 'pt', 'Portugal', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (178, 'pw', 'Palau', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (179, 'py', 'Paraguay', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (180, 'qa', 'Qatar', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (181, 're', 'Réunion (ile de la)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (182, 'ro', 'Roumanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (183, 'ru', 'Russie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (184, 'rw', 'Rwanda', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (185, 'sa', 'Arabie Saoudite', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (186, 'sb', 'Salomon (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (187, 'sc', 'Seychelles', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (188, 'sd', 'Soudan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (189, 'se', 'Suède', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (190, 'sg', 'Singapour', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (191, 'sh', 'St. Hélène', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (192, 'si', 'Slovénie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (193, 'sj', 'Svalbard et Jan Mayen (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (194, 'sk', 'Slovaquie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (195, 'sl', 'Sierra Leone', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (196, 'sm', 'Saint Marin', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (197, 'sn', 'Sénégal', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (198, 'so', 'Somalie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (199, 'sr', 'Suriname', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (200, 'st', 'Sao Tome et Principe', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (201, 'sv', 'Salvador', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (202, 'sy', 'Syrie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (203, 'sz', 'Swaziland', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (204, 'tc', 'Turks et Caïques (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (205, 'td', 'Tchad', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (206, 'tf', 'Territoires Français du sud', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (207, 'tg', 'Togo', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (208, 'th', 'Thailande', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (209, 'tj', 'Tajikistan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (210, 'tk', 'Tokelau', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (211, 'tm', 'Turkménistan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (212, 'tn', 'Tunisie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (213, 'to', 'Tonga', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (214, 'tp', 'Timor Oriental', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (215, 'tr', 'Turquie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (216, 'tt', 'Trinidad et Tobago', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (217, 'tv', 'Tuvalu', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (218, 'tw', 'Taiwan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (219, 'tz', 'Tanzanie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (220, 'ua', 'Ukraine', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (221, 'ug', 'Ouganda', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (222, 'uk', 'Royaume Uni', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (223, 'gb', 'Royaume Uni', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (224, 'um', 'US Minor Outlying (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (225, 'us', 'Etats Unis', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (226, 'uy', 'Uruguay', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (227, 'uz', 'Ouzbékistan', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (228, 'va', 'Vatican', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (229, 'vc', 'Saint Vincent et les Grenadines', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (230, 've', 'Venezuela', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (231, 'vg', 'Vierges Britaniques (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (232, 'vi', 'Vierges USA (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (233, 'vn', 'Viêt Nam', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (234, 'vu', 'Vanuatu', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (235, 'wf', 'Wallis et Futuna (iles)', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (236, 'ws', 'Western Samoa', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (237, 'ye', 'Yemen', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (238, 'yt', 'Mayotte', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (239, 'yu', 'Yugoslavie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (240, 'za', 'Afrique du Sud', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (241, 'zm', 'Zambie', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (242, 'zr', 'Zaïre', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (243, 'zw', 'Zimbabwe', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (244, 'com', '.COM', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (245, 'net', '.NET', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (246, 'org', '.ORG', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (247, 'edu', 'Education', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (248, 'int', '.INT', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (249, 'arpa', '.ARPA', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (250, 'at', 'Autriche', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (251, 'gov', 'Gouvernement', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (252, 'mil', 'Militaire', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (253, 'su', 'Ex U.R.S.S.', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (254, 'reverse', 'Reverse', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (255, 'biz', 'Businesses', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (256, 'info', '.INFO', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (257, 'name', '.NAME', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (258, 'pro', '.PRO', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (259, 'coop', '.COOP', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (260, 'aero', '.AERO', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (261, 'museum', '.MUSEUM', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (262, 'tv', '.TV', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (263, 'ws', 'Web site', 0)") or die(mysql_error());
    mysql_query("INSERT INTO `track_c_countries` (`id`, `code`, `country`, `counter`) VALUES (264, '--', 'Unknown', 0)") or die(mysql_error());

    /**
	* creating the tables of the SCORM database
	*/

    mysql_select_db($mysqlScormDb) or die(mysql_error());

    mysql_query("CREATE TABLE `scorm_main` (
				`contentId` int(5) unsigned NOT NULL auto_increment,
				`contentTitle` varchar(100) default NULL,
				`dokeosCourse` varchar(100) default NULL,
				PRIMARY KEY  (`contentId`)
				) TYPE=MyISAM") or die(mysql_error());

    mysql_query("CREATE TABLE `scorm_sco_data` (
				`contentId` int(5) default NULL,
				`scoId` int(5) NOT NULL auto_increment,
				`scoIdentifier` varchar(100) default NULL,
				`scoTitle` varchar(100) default NULL,
				`status` varchar(100) default NULL,
				`studentId` int(10) default NULL,
				`score` int(10) default NULL,
				`time` varchar(20) default NULL,
				KEY `scoId` (`scoId`)
				) TYPE=MyISAM") or die(mysql_error());

    /**
	* creating the tables of the USER database
	* this is where the personal agenda items are storen, the user defined course categories (sorting of my courses)
	*/

    mysql_select_db($mysqlUserDb) or die(mysql_error());

    // creating the table where the personal agenda items are stored
    mysql_query("CREATE TABLE `personal_agenda` (
				`id` int NOT NULL auto_increment,
				`user` int unsigned,
				`title` text,
				`text` text,
				`date` datetime default NULL,
				`enddate` datetime default NULL,
				`course` varchar(255),
				UNIQUE KEY `id` (`id`))
				TYPE=MyISAM") or die(mysql_error());

    // creating the table that is used for the user defined course categories
    mysql_query("CREATE TABLE `user_course_category` (
			  	`id` int unsigned NOT NULL auto_increment,
			  	`user_id` int unsigned NOT NULL default '0',
			  	`title` text NOT NULL,
			  	PRIMARY KEY  (`id`)
				) TYPE=MyISAM") or die(mysql_error());
}
else
{
	echo 'You are not allowed here !';
}
?>
