Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 731f58d2d0e7304bf2eb6d6bc63dc471d0be4768
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

uri.c

Blame
  • index.php 1,61 Kio
    <?php
    require 'Slim/Slim.php';
    
    \Slim\Slim::registerAutoloader();
    $app = new \Slim\Slim();
    $bdd = new PDO('mysql:host=mysql.iiens.net;dbname=assoce_nightiies', 'assoce_nightiies', 'VwuQREP5JwJQTF5h', array(
    		PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
    $samPics = array('sam1.jpg', 'sam2.jpg', 'sam3.jpg');
    
    $app->get(
        '/',
        function () {
    		global $samPics;
    		global $bdd;
    
    		$sam = $samPics[array_rand($samPics)];
    
    		$events = $bdd->prepare('SELECT s.id, title, date, place, description, GROUP_CONCAT(nick SEPARATOR ", ") as nicks
    			FROM sam s
    			LEFT OUTER JOIN sam_users su ON s.id = su.event
    			WHERE date > '.time().'
    			GROUP BY s.id
    			ORDER BY date');
    		$events->execute();
    
    		echo <<<EOF
    <html>
    	<head>
    		<link rel="stylesheet" type="text/css" href="/links/common.css">
    	</head>
    	<body>
    		<div class="header">
    			<img src="assets/sam/$sam" style="margin:auto">
    		</div>
    		<div class="content">
    			<table class="calendar">
    				<thead>
    					<tr>
    						<th>id</th>
    						<th>Date</th>
    						<th>Titre</th>
    						<th>Description</th>
    						<th>Salle</th>
    						<th>Participants</th>
    					</tr>
    				</thead>
    				<tbody>
    EOF;
    
    		while ($event = $events->fetch()) {
    			$date = date('d/m/y', $event[2]);
    			$description = preg_replace("#(^|[\n ])(https?://[\w\#$%&~/.\-;:=,?@\[\]+]+)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $event[4]);
    			echo <<<EOF
    					<tr>
    						<td>$event[0]</td>
    						<td>$date</td>
    						<td>$event[1]</td>
    						<td>$description</td>
    						<td>$event[3]</td>
    						<td>$event[5]</td>
    					</tr>
    EOF;
    		}
    
    		echo <<<EOF
    				</tbody>
    			</table>
    		</div>
    	</body>
    </html>
    EOF;
        }
    );
    
    $app->run();
    
    ?>