Fix user->team
This commit is contained in:
parent
ffe0c2a7c4
commit
61965f79a8
288
db/fic_dump.sql
288
db/fic_dump.sql
@ -1,288 +0,0 @@
|
|||||||
-- phpMyAdmin SQL Dump
|
|
||||||
-- version 4.0.6deb1
|
|
||||||
-- http://www.phpmyadmin.net
|
|
||||||
--
|
|
||||||
-- Host: localhost
|
|
||||||
-- Generation Time: Nov 08, 2013 at 05:24 PM
|
|
||||||
-- Server version: 5.5.34-0ubuntu0.13.10.1
|
|
||||||
-- PHP Version: 5.5.3-1ubuntu2
|
|
||||||
|
|
||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
SET time_zone = "+00:00";
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Database: `fic`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `exercices`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `exercices` (
|
|
||||||
`id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`id_theme` int(10) unsigned NOT NULL,
|
|
||||||
`require` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`level` tinyint(4) NOT NULL,
|
|
||||||
`points` smallint(6) NOT NULL,
|
|
||||||
`statement` text COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `exercices`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `exercices` (`id`, `id_theme`, `require`, `level`, `points`, `statement`) VALUES
|
|
||||||
('1', 1, '', 1, 1, 'Description 1'),
|
|
||||||
('10', 2, '9', 5, 40, 'Description 10'),
|
|
||||||
('11', 3, '', 1, 1, 'Description 11'),
|
|
||||||
('12', 3, '11', 2, 5, 'Description 12'),
|
|
||||||
('13', 3, '12', 3, 10, 'Description 13'),
|
|
||||||
('14', 3, '13', 4, 20, 'Description 14'),
|
|
||||||
('15', 3, '14', 5, 40, 'Description 15'),
|
|
||||||
('16', 4, '', 1, 1, 'Description 16'),
|
|
||||||
('17', 4, '16', 2, 5, 'Description 17'),
|
|
||||||
('18', 4, '17', 3, 10, 'Description 18'),
|
|
||||||
('19', 4, '18', 4, 20, 'Description 19'),
|
|
||||||
('2', 1, '1', 2, 5, 'Description 2'),
|
|
||||||
('20', 4, '19', 5, 40, 'Description 20'),
|
|
||||||
('21', 5, '', 1, 1, 'Description 21'),
|
|
||||||
('22', 5, '21', 2, 5, 'Description 22'),
|
|
||||||
('23', 5, '22', 3, 10, 'Description 23'),
|
|
||||||
('24', 5, '23', 4, 20, 'Description 24'),
|
|
||||||
('25', 5, '24', 5, 40, 'Description 25'),
|
|
||||||
('26', 6, '', 1, 1, 'Description 26'),
|
|
||||||
('27', 6, '26', 2, 5, 'Description 27'),
|
|
||||||
('28', 6, '27', 3, 10, 'Description 28'),
|
|
||||||
('29', 6, '28', 4, 20, 'Description 29'),
|
|
||||||
('3', 1, '2', 3, 10, 'Description 3'),
|
|
||||||
('30', 6, '29', 5, 40, 'Description 30'),
|
|
||||||
('31', 7, '', 1, 1, 'Description 31'),
|
|
||||||
('32', 7, '31', 2, 5, 'Description 32'),
|
|
||||||
('33', 7, '32', 3, 10, 'Description 33'),
|
|
||||||
('34', 7, '33', 4, 20, 'Description 34'),
|
|
||||||
('35', 7, '34', 5, 40, 'Description 35'),
|
|
||||||
('36', 8, '', 1, 1, 'Description 36'),
|
|
||||||
('37', 8, '35', 2, 5, 'Description 37'),
|
|
||||||
('38', 8, '36', 3, 10, 'Description 38'),
|
|
||||||
('39', 8, '37', 4, 20, 'Description 39'),
|
|
||||||
('4', 1, '3', 4, 20, 'Description 4'),
|
|
||||||
('40', 8, '38', 5, 40, 'Description 40'),
|
|
||||||
('5', 1, '4', 5, 40, 'Description 5'),
|
|
||||||
('6', 2, '', 1, 1, 'Description 6'),
|
|
||||||
('7', 2, '6', 2, 5, 'Description 7'),
|
|
||||||
('8', 2, '7', 3, 10, 'Description 8'),
|
|
||||||
('9', 2, '8', 4, 20, 'Description 9');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for 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,
|
|
||||||
`sha1` binary(32) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for 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 ;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for 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;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for 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=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `solved`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `solved` (`id`, `id_user`, `id_exercice`, `time`) VALUES
|
|
||||||
(1, 1, 1, '2013-10-09 00:01:00'),
|
|
||||||
(2, 1, 2, '2013-10-09 00:05:00'),
|
|
||||||
(3, 2, 3, '2013-10-09 00:10:00'),
|
|
||||||
(4, 6, 4, '2013-10-09 00:30:00'),
|
|
||||||
(5, 3, 6, '2013-10-09 00:05:00'),
|
|
||||||
(6, 6, 7, '2013-10-09 00:10:00'),
|
|
||||||
(7, 10, 8, '2013-10-09 00:30:00'),
|
|
||||||
(8, 11, 9, '2013-10-09 00:40:00'),
|
|
||||||
(9, 4, 10, '2013-10-09 00:50:00'),
|
|
||||||
(10, 5, 11, '2013-10-09 00:01:00'),
|
|
||||||
(11, 1, 16, '2013-10-09 00:01:00'),
|
|
||||||
(12, 10, 21, '2013-10-09 00:01:00'),
|
|
||||||
(13, 9, 22, '2013-10-09 00:05:00'),
|
|
||||||
(14, 5, 23, '2013-10-09 00:15:00'),
|
|
||||||
(15, 3, 24, '2013-10-09 00:35:00'),
|
|
||||||
(16, 8, 25, '2013-10-09 00:45:00'),
|
|
||||||
(17, 7, 26, '2013-10-09 00:01:00'),
|
|
||||||
(18, 7, 31, '2013-10-09 00:01:00'),
|
|
||||||
(19, 10, 32, '2013-10-09 00:05:00'),
|
|
||||||
(20, 2, 33, '2013-10-09 00:10:00'),
|
|
||||||
(21, 11, 36, '2013-10-09 00:01:00'),
|
|
||||||
(22, 14, 37, '2013-10-09 00:05:00'),
|
|
||||||
(23, 9, 38, '2013-10-09 00:15:00'),
|
|
||||||
(24, 9, 39, '2013-10-09 00:35:00');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `teams`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `teams` (
|
|
||||||
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`team_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`key_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`auth_level` tinyint(1) NOT NULL,
|
|
||||||
`slogan` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `teams`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `teams` (`id`, `team_name`, `key_hash`, `auth_level`, `slogan`) VALUES
|
|
||||||
(1, 'Team1', '2134s65df423sdf132sdg431dsg', 1, 'Epita'),
|
|
||||||
(2, 'Team2', '2134s65df423sef132sdg431dsg', 1, 'Epita'),
|
|
||||||
(3, 'Team3', '2134s45df423sdf132sdg431dsg', 1, 'Epita'),
|
|
||||||
(4, 'Team4', '2134s65df423sdf131sdg431dsg', 1, 'Epita'),
|
|
||||||
(5, 'Team5', '2134s65df423sdf132sdg431dfg', 1, 'Epita'),
|
|
||||||
(6, 'Team6', '2134s65df423shf132sdg431dsg', 1, 'Epita'),
|
|
||||||
(7, 'Team7', '2134s65df423sdf1f2sdg431dsg', 1, 'Epita'),
|
|
||||||
(8, 'Team8', '2134s65df423sdf13zsdg431dsg', 1, 'Epita'),
|
|
||||||
(9, 'Team9', '2134s65df423sdf13csdg431dsg', 1, 'Epita'),
|
|
||||||
(10, 'Team10', '2134s65df4q3sdf132sdg431dsg', 1, 'Epita'),
|
|
||||||
(11, 'Team11', '2134s65df423sdf132s2g431dsg', 1, 'Epita'),
|
|
||||||
(12, 'Team12', '2134s65df423sdf132sdg401dsg', 1, 'Epita'),
|
|
||||||
(13, 'Team13', '2134s65df423sdf132sdg401dsg', 1, 'Epita'),
|
|
||||||
(14, 'Team14', '2134s65df423sdf132sdg401dsg', 1, 'Epita'),
|
|
||||||
(15, 'Team15', '2134s65df423sdf132sdg401dsg', 1, 'Epita');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `team_members`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `team_members` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`id_team` int(10) unsigned NOT NULL,
|
|
||||||
`firstname` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`lastname` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`nickname` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
`company` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=28 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `team_members`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `team_members` (`id`, `id_team`, `firstname`, `lastname`, `nickname`, `company`) VALUES
|
|
||||||
(1, 1, 'Alph', 'A', 'Alominia', ''),
|
|
||||||
(2, 1, 'Bet', 'A', 'CaptainSandwich', ''),
|
|
||||||
(3, 2, 'Charl', 'I', 'Tintin', ''),
|
|
||||||
(4, 2, 'Delt', 'A', 'Wolwerin', ''),
|
|
||||||
(5, 3, 'Ech', 'O', 'Homer', ''),
|
|
||||||
(6, 3, 'Fox', 'Trot', 'KevBG91', ''),
|
|
||||||
(7, 4, 'Gol', 'F', 'R2D2', ''),
|
|
||||||
(8, 4, 'Hot', 'El', 'Corbaine', ''),
|
|
||||||
(9, 5, 'Ind', 'Ia', 'Lelama', ''),
|
|
||||||
(10, 5, 'Jule', 'Yer', 'Betrave', ''),
|
|
||||||
(11, 6, 'Krev', 'Lard', 'BlueSunday', ''),
|
|
||||||
(12, 6, 'Lamb', 'Ada', 'Chatpitre', ''),
|
|
||||||
(13, 7, 'Mi', 'Ke', 'Tournewsol', ''),
|
|
||||||
(14, 7, 'Nov', 'Ember', 'Dasilva', ''),
|
|
||||||
(15, 8, 'Os', 'Car', 'Laurie', ''),
|
|
||||||
(16, 8, 'Pa', 'Pa', 'Nowel', ''),
|
|
||||||
(17, 9, 'Que', 'Bec', 'Polyr', ''),
|
|
||||||
(18, 9, 'Rom', 'Eo', 'Granola', ''),
|
|
||||||
(19, 10, 'Sier', 'Ra', 'Petilus75', ''),
|
|
||||||
(20, 11, 'Tan', 'Go', 'Lolilol42', ''),
|
|
||||||
(21, 12, 'Uni', 'Form', 'JmLayfrite', ''),
|
|
||||||
(22, 13, 'Vic', 'Tor', 'Minerva', ''),
|
|
||||||
(23, 13, 'Whis', 'Key', 'Moly', ''),
|
|
||||||
(24, 14, 'X', 'Rey', 'Mistigri', ''),
|
|
||||||
(25, 14, 'Yan', 'Kee', 'Astroboy', ''),
|
|
||||||
(26, 15, 'Zul', 'Lu', 'Salameche', ''),
|
|
||||||
(27, 15, 'Ze', 'Ro', 'Mandy', '');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `themes`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `themes` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=9 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `themes`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `themes` (`id`, `name`) VALUES
|
|
||||||
(1, 'pdf'),
|
|
||||||
(2, 'flash'),
|
|
||||||
(3, 'image'),
|
|
||||||
(4, 'se'),
|
|
||||||
(5, 'memdump'),
|
|
||||||
(6, 'java'),
|
|
||||||
(7, 'dotnet'),
|
|
||||||
(8, 'pcap');
|
|
||||||
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
@ -115,11 +115,11 @@ class Team
|
|||||||
{
|
{
|
||||||
$db = new BDD();
|
$db = new BDD();
|
||||||
|
|
||||||
$res = $db->unique_query("SELECT e.id, s.id_user, SUM(e.points) as sum_points
|
$res = $db->unique_query("SELECT e.id, s.id_team, SUM(e.points) as sum_points
|
||||||
FROM exercices e
|
FROM exercices e
|
||||||
LEFT OUTER JOIN solved s ON e.id = s.id_exercice
|
LEFT OUTER JOIN solved s ON e.id = s.id_exercice
|
||||||
WHERE s.id_user = " . $this->id . "
|
WHERE s.id_team = " . $this->id . "
|
||||||
GROUP BY s.id_user");
|
GROUP BY s.id_team");
|
||||||
|
|
||||||
$db->deconnexion();
|
$db->deconnexion();
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class Team
|
|||||||
$res = $db->unique_query("SELECT e.id_theme AS theme, count( s.id ) AS solved
|
$res = $db->unique_query("SELECT e.id_theme AS theme, count( s.id ) AS solved
|
||||||
FROM solved AS s
|
FROM solved AS s
|
||||||
RIGHT OUTER JOIN exercices AS e ON e.id = s.id_exercice
|
RIGHT OUTER JOIN exercices AS e ON e.id = s.id_exercice
|
||||||
AND s.id_user = ".$this->id."
|
AND s.id_team = ".$this->id."
|
||||||
AND e.id_theme = ".$id_theme);
|
AND e.id_theme = ".$id_theme);
|
||||||
|
|
||||||
$db->deconnexion();
|
$db->deconnexion();
|
||||||
@ -176,7 +176,7 @@ class Team
|
|||||||
$ids = $db->query("SELECT id_theme, id_exercice
|
$ids = $db->query("SELECT id_theme, id_exercice
|
||||||
FROM `solved`
|
FROM `solved`
|
||||||
LEFT OUTER JOIN exercices ON `solved`.id_exercice = `exercices`.id
|
LEFT OUTER JOIN exercices ON `solved`.id_exercice = `exercices`.id
|
||||||
WHERE id_user =".$this->id." AND id_theme =".$id_theme);
|
WHERE id_team =".$this->id." AND id_theme =".$id_theme);
|
||||||
$db->deconnexion();
|
$db->deconnexion();
|
||||||
|
|
||||||
$array = array();
|
$array = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user