-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Mer 09 Octobre 2013 à 23:52
-- Version du serveur: 5.5.32-log
-- Version de PHP: 5.5.0-pl0-gentoo

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

--
-- Base de données: `fic2014`
--

-- --------------------------------------------------------

--
-- Structure de la table `exercices`
--

CREATE TABLE IF NOT EXISTS `exercices` (
  `id` varchar(100) COLLATE utf16_unicode_ci NOT NULL,
  `id_theme` int(10) unsigned NOT NULL,
  `require` varchar(100) COLLATE utf16_unicode_ci NOT NULL,
  `level` tinyint(4) NOT NULL,
  `points` smallint(6) NOT NULL,
  `statement` text COLLATE utf16_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `exercice_files`
--

CREATE TABLE IF NOT EXISTS `exercice_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_exercice` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `exercice_keys`
--

CREATE TABLE IF NOT EXISTS `exercice_keys` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_exercice` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `format` enum('raw','md5','sha1','sha256','sha512','whirlpool') COLLATE utf8_unicode_ci NOT NULL,
  `value` varbinary(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `sessions`
--

CREATE TABLE IF NOT EXISTS `sessions` (
  `session` binary(32) NOT NULL,
  `uid` binary(16) NOT NULL,
  `time` int(11) NOT NULL,
  `ip` varbinary(16) NOT NULL,
  `var` varchar(9999) COLLATE utf8_unicode_ci NOT NULL,
  `level` tinyint(2) NOT NULL,
  `active` enum('1','0') COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`session`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Structure de la table `solved`
--

CREATE TABLE IF NOT EXISTS `solved` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_user` int(10) unsigned NOT NULL,
  `id_exercice` int(10) unsigned NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `themes`
--

CREATE TABLE IF NOT EXISTS `themes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filename` varchar(255) COLLATE utf16_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) COLLATE utf16_unicode_ci NOT NULL,
  `password` binary(64) NOT NULL,
  `auth_level` tinyint(1) NOT NULL,
  `firstname` varchar(255) COLLATE utf16_unicode_ci NOT NULL,
  `lastname` varchar(255) COLLATE utf16_unicode_ci NOT NULL,
  `company` varchar(255) COLLATE utf16_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_ci AUTO_INCREMENT=2 ;


INSERT INTO users (username, password, auth_level)
VALUES
("nemunaire", UNHEX('c1d050d16d8c90dae6fef376460299aa8d1cce7c5b299720a8e38952a77212f1019e2cd44ba58e0433c01cb4c81ab9a789c07df218b0b9f05af8d1198a3bd239'), 2);
