index.php 1.64 KB
Newer Older
1
<?php
Safyrus's avatar
Safyrus committed
2

Safyrus's avatar
Safyrus committed
3 4
require_once '../vendor/autoload.php';

Safyrus's avatar
Safyrus committed
5
use bdd\controleur\ControleurRequete;
6 7 8 9 10 11 12 13 14 15 16 17 18 19
use Illuminate\Database\Capsule\Manager as DB;
$db = new DB();
//SI CA NE FONCTIONNE PAS, ENLEVER LES COMMENTAIRES : CES INFOS SONT DEJA DANS LE CONF.INI
//LA LIGNE DU PASSWORD NE DEVRAIT PAS ETRE NECESSAIRE CAR NOUS NOUS CONNECTONS AVEC ROOT, SINON, LA METTRE QUAND MEME
/*$db->addConnection( [
	'driver' => 'mysql',
	'host' => 'localhost',
	'database' => 'gamepedia',
	'username' => 'user',
	//'password' => 'password',
	'charset' => 'utf8',
	'collation' => 'utf8_unicode_ci',
	'prefix' => ''
] );*/
Safyrus's avatar
Safyrus committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33

// ajout des informations pour se connecter à la base de données
$ini_file = parse_ini_file('../conf/conf.ini');
$db->addConnection([
    'driver'    => $ini_file['driver'],
    'host'      => $ini_file['host'],
    'database'  => $ini_file['database'],
    'username'  => $ini_file['username'],
    'password'  => $ini_file['password'],
    'charset'   => $ini_file['charset'],
    'collation' => $ini_file['charset'] . '_unicode_ci',
    'prefix'    => ''
]);

34 35
$db->setAsGlobal();
$db->bootEloquent();
Safyrus's avatar
Safyrus committed
36 37 38 39 40 41

session_start();

$app = new Slim();

$app->get('/', function () {
Safyrus's avatar
Safyrus committed
42 43
    $v = new HomeView();
    $v->renderHome();
Safyrus's avatar
Safyrus committed
44 45
})->name('accueil');
$app->get('/ex1/requete1', function () {
Safyrus's avatar
Safyrus committed
46 47
    $c = new ControleurRequete();
    $c->selectMario();
Safyrus's avatar
Safyrus committed
48 49
})->name('ex1 requete 1');
$app->get('/ex1/requete2', function () {
Safyrus's avatar
Safyrus committed
50
    $c = new ControleurRequete();
Safyrus's avatar
Safyrus committed
51 52 53

})->name('ex1 requete 2');
$app->get('/ex1/requete3', function () {
Safyrus's avatar
Safyrus committed
54
    $c = new ControleurRequete();
Safyrus's avatar
Safyrus committed
55 56 57

})->name('ex1 requete 3');
$app->get('/ex1/requete4', function () {
Safyrus's avatar
Safyrus committed
58
    $c = new ControleurRequete();
Safyrus's avatar
Safyrus committed
59 60 61 62 63

})->name('ex1 requete 4');


$app->run();