Install.php looks nicer

This commit is contained in:
Phyks 2013-08-07 23:53:46 +02:00
parent 561af52a31
commit bb664e34a4
3 changed files with 72 additions and 62 deletions

View File

@ -1,23 +1,2 @@
<?php <?php
require_once('inc/header.php'); require_once('inc/header.php');
init(true,false) {
global $bdd;
$bdd = new PDO('mysql:host='.MYSQL_HOST.';dbname='.MYSQL_DB, MYSQL_LOGIN, MYSQL_PASSWORD);
$bdd->query("SET NAMES 'utf8'");
session_start();
date_default_timezone_set(TIMEZONE);
if($protect && empty($_SESSION['login'])) {
header('location: connexion.php');
exit();
}
if($admin && $_SESSION['admin']) {
header('location: message.php?id=7');
exit();
}
}

View File

@ -15,7 +15,7 @@
$instance_title = (!empty($_POST['instance_title'])) ? $_POST['instance_title'] : 'Bouffe@Ulm'; $instance_title = (!empty($_POST['instance_title'])) ? $_POST['instance_title'] : 'Bouffe@Ulm';
try { try {
$db = new Storage(array('host'=>$mysql_host, 'login'=>$mysql_login, 'password'=>$mysql_password, 'db'=>$mysql_db); $db = new Storage(array('host'=>$mysql_host, 'login'=>$mysql_login, 'password'=>$mysql_password, 'db'=>$mysql_db));
//TODO : Create tables //TODO : Create tables
} catch (PDOException $e) { } catch (PDOException $e) {
$error = 'Unable to connect to database, check your credentials.'; $error = 'Unable to connect to database, check your credentials.';
@ -52,7 +52,7 @@
$admin->save(); $admin->save();
header('location: index.php'); header('location: index.php');
exit(); exit();
} catch ($e) { } catch (Exception $e) {
//TODO //TODO
} }
} }
@ -60,7 +60,6 @@
$error = 'Unable to write configuration to config file inc/config.php.'; $error = 'Unable to write configuration to config file inc/config.php.';
} }
} }
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
@ -69,8 +68,8 @@
<title>Bouffe@Ulm - Installation</title> <title>Bouffe@Ulm - Installation</title>
<link rel="stylesheet" media="screen" type="text/css" href="tpl/css/style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="tpl/css/style.css" />
</head> </head>
<body> <body id="install">
<h1>Bouffe@Ulm - Installation</h1> <h1 class="center">Bouffe@Ulm - Installation</h1>
<?php <?php
if(!empty($error)) { if(!empty($error)) {
@ -78,7 +77,7 @@
} }
?> ?>
<p>This small form will guide you through the installation of Bouffe@Ulm.</p> <p class="center">This small form will guide you through the installation of Bouffe@Ulm.</p>
<form action="install.php" method="post"> <form action="install.php" method="post">
<fieldset> <fieldset>
@ -106,7 +105,7 @@
<p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login"/></p> <p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login"/></p>
<p><label for="admin_mdp">Password for the admin : </label><input type="password" name="admin_pass" id="admin_pass"/></p> <p><label for="admin_mdp">Password for the admin : </label><input type="password" name="admin_pass" id="admin_pass"/></p>
</fieldset> </fieldset>
<p><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit" class="center"></p> <p class="center"><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit"></p>
</form> </form>
</body> </body>
</html> </html>

View File

@ -1,3 +1,12 @@
body {
font-family: sans-serif;
}
fieldset {
border: 1px solid #999;
margin-bottom: 1em;
}
.center { .center {
text-align: center; text-align: center;
} }
@ -7,3 +16,26 @@
color: red; color: red;
font-weight: bold; font-weight: bold;
} }
input[type=submit] {
background-color: green;
color: white;
border-radius: 10px;
}
#install {
margin: 0;
}
#install form {
width: 67%;
margin: auto;
}
#install h1 {
background-color: #333;
border-bottom: 0.3em solid green;
color: white;
padding: 0.5em;
margin: 0;
}