From bb664e34a4fc60555b0901fe62742249d990b8e7 Mon Sep 17 00:00:00 2001 From: Phyks Date: Wed, 7 Aug 2013 23:53:46 +0200 Subject: [PATCH] Install.php looks nicer --- index.php | 21 ------------ install.php | 81 +++++++++++++++++++++++------------------------ tpl/css/style.css | 32 +++++++++++++++++++ 3 files changed, 72 insertions(+), 62 deletions(-) diff --git a/index.php b/index.php index a19e577..1a43d45 100644 --- a/index.php +++ b/index.php @@ -1,23 +1,2 @@ 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(); - } -} diff --git a/install.php b/install.php index 00a97c4..0c3a305 100644 --- a/install.php +++ b/install.php @@ -15,50 +15,49 @@ $instance_title = (!empty($_POST['instance_title'])) ? $_POST['instance_title'] : 'Bouffe@Ulm'; 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 } catch (PDOException $e) { $error = 'Unable to connect to database, check your credentials.'; } if(empty($error)) { - if(function_exists('mcrypt_create_iv')) { - $salt = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); - } - else { - mt_srand(microtime(true)*100000 + memory_get_usage(true)); - $salt = md5(uniqid(mt_rand(), true)); - } - - define('SALT', $salt); - - $config = " - define('VERSION_NUMBER', '2.0'); - define('MYSQL_HOST', '".$mysql_host."'); - define('MYSQL_LOGIN', '".$mysql_login."'); - define('MYSQL_PASSWORD', '".$mysql_password."'); - define('MYSQL_DB', '".$mysql_db."'); - define('MYSQL_PREFIX', '".$mysql_prefix."'); - define('INSTANCE_TITLE', '".$instance_title."'); - define('BASE_URL', '".$_POST['base_url']."'); - define('SALT', '".$salt."');"; - - if(file_put_contents("inc/config.php", $config)) { - try { - $admin = new User(); - $admin->setLogin($_POST['admin_login']); - $admin->setPassword($_POST['admin_password']); - $admin->setAdmin(true); - $admin->save(); - header('location: index.php'); - exit(); - } catch ($e) { - //TODO - } - } - else - $error = 'Unable to write configuration to config file inc/config.php.'; + if(function_exists('mcrypt_create_iv')) { + $salt = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); } + else { + mt_srand(microtime(true)*100000 + memory_get_usage(true)); + $salt = md5(uniqid(mt_rand(), true)); + } + + define('SALT', $salt); + + $config = " + define('VERSION_NUMBER', '2.0'); + define('MYSQL_HOST', '".$mysql_host."'); + define('MYSQL_LOGIN', '".$mysql_login."'); + define('MYSQL_PASSWORD', '".$mysql_password."'); + define('MYSQL_DB', '".$mysql_db."'); + define('MYSQL_PREFIX', '".$mysql_prefix."'); + define('INSTANCE_TITLE', '".$instance_title."'); + define('BASE_URL', '".$_POST['base_url']."'); + define('SALT', '".$salt."');"; + + if(file_put_contents("inc/config.php", $config)) { + try { + $admin = new User(); + $admin->setLogin($_POST['admin_login']); + $admin->setPassword($_POST['admin_password']); + $admin->setAdmin(true); + $admin->save(); + header('location: index.php'); + exit(); + } catch (Exception $e) { + //TODO + } + } + else + $error = 'Unable to write configuration to config file inc/config.php.'; } } ?> @@ -69,8 +68,8 @@ Bouffe@Ulm - Installation - -

Bouffe@Ulm - Installation

+ +

Bouffe@Ulm - Installation

-

This small form will guide you through the installation of Bouffe@Ulm.

+

This small form will guide you through the installation of Bouffe@Ulm.

@@ -106,7 +105,7 @@

-

type="submit" class="center">

+

type="submit">

diff --git a/tpl/css/style.css b/tpl/css/style.css index e6d05a2..950c94b 100644 --- a/tpl/css/style.css +++ b/tpl/css/style.css @@ -1,3 +1,12 @@ +body { + font-family: sans-serif; +} + +fieldset { + border: 1px solid #999; + margin-bottom: 1em; +} + .center { text-align: center; } @@ -7,3 +16,26 @@ color: red; 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; +}