diff --git a/includes/header.php b/includes/header.php
new file mode 100644
index 0000000000000000000000000000000000000000..b7ea899e6b9c13ffc5938e72ecb2db38473daab5
--- /dev/null
+++ b/includes/header.php
@@ -0,0 +1,16 @@
+<?php
+
+$samPics = array('sam1.jpg', 'sam2.jpg', 'sam3.jpg', 'sam4.jpg');
+$sam = $samPics[array_rand($samPics)];
+
+?>
+
+<html>
+	<head>
+		<link rel="stylesheet" type="text/css" href="/links/common.css">
+		<meta charset="UTF-8">
+	</head>
+	<body>
+		<div class="header">
+		<img src="assets/sam/<?php echo $sam; ?>" style="margin:auto">
+		</div>
diff --git a/index.php b/index.php
index 3b18e271629d32edf07dd0b4fcf73c5248b9f985..d9f92e1e287852c1af7160c37bd8d3a37f878eac 100644
--- a/index.php
+++ b/index.php
@@ -5,35 +5,53 @@ require 'Slim/Slim.php';
 $app = new \Slim\Slim();
 $bdd = new PDO('mysql:host=mysql.iiens.net;dbname=assoce_nightiies', 'assoce_nightiies', 'CQX2K3BZctUAvUtz', array(
 		PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
-$samPics = array('sam1.jpg', 'sam2.jpg', 'sam3.jpg', 'sam4.jpg');
 
 $app->get(
-    '/',
-    function () {
-		global $samPics;
+	'/',
+	function () {
 		global $bdd;
 
-		$sam = $samPics[array_rand($samPics)];
+		$chans = $bdd->prepare('SELECT name, id
+			FROM sam_calendars
+			');
+		$chans->execute();
+
+		include('includes/header.php');
+		echo <<<EOF
+		<div class="content">
+			<p>Calendrier disponibles : </p>
+			<ul>
+EOF;
+
+		while ($chan = $chans->fetch()) {
+			echo '<li><a href="'.$chan[1].'">'.$chan[0].'</a></li>';
+		}
+
+		echo <<<EOF
+			</ul>
+		</div>
+	</body>
+</html>
+EOF;
+	}
+);
+
+$app->get(
+    '/:calendar',
+    function ($calendar) {
+		global $bdd;
 
 		$events = $bdd->prepare('SELECT s.id, title,
 			DATE_FORMAT(date, "%d/%m/%Y"), place, description, link, GROUP_CONCAT(nick SEPARATOR ", ") as nicks
 			FROM sam s
 			LEFT OUTER JOIN sam_users su ON s.id = su.event
-			WHERE s.date >= NOW()
+			WHERE s.date >= NOW() AND s.calendar_id = ?
 			GROUP BY s.id
 			ORDER BY date');
-		$events->execute();
+		$events->execute(array($calendar));
 
+		include('includes/header.php');
 		echo <<<EOF
-<html>
-	<head>
-		<link rel="stylesheet" type="text/css" href="/links/common.css">
-		<meta charset="UTF-8">
-	</head>
-	<body>
-		<div class="header">
-			<img src="assets/sam/$sam" style="margin:auto">
-		</div>
 		<div class="content">
 			<p>
 				Calendrier ICS (importable dans toutes application agenda digne de ce nom) : <a href="http://nightiies.iiens.net/sam/events.php">calendar.ics</a>. Un argument GET « nick » peut être ajouter à l'URL pour filtrer les soirées.