From fb6aedc24c1522dd61aabe01263eb88f69accee0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 9 Jan 2018 10:21:55 +0100 Subject: [PATCH] Initial commit of the HUGo project web application. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- account.php | 0 booking.php | 0 config.php | 25 +++++++++ footer.html | 5 ++ header.html | 14 +++++ header.php | 12 +++++ home.php | 25 +++++++++ index.php | 61 ++++++++++++++++++++++ libs/db.php | 116 +++++++++++++++++++++++++++++++++++++++++ login.php | 0 register.php | 0 search.php | 0 styles/airpolytech.css | 16 ++++++ 13 files changed, 274 insertions(+) create mode 100644 account.php create mode 100644 booking.php create mode 100644 config.php create mode 100644 footer.html create mode 100644 header.html create mode 100644 header.php create mode 100644 home.php create mode 100644 index.php create mode 100644 libs/db.php create mode 100644 login.php create mode 100644 register.php create mode 100644 search.php create mode 100644 styles/airpolytech.css diff --git a/account.php b/account.php new file mode 100644 index 0000000..e69de29 diff --git a/booking.php b/booking.php new file mode 100644 index 0000000..e69de29 diff --git a/config.php b/config.php new file mode 100644 index 0000000..dd03f8f --- /dev/null +++ b/config.php @@ -0,0 +1,25 @@ + 'localhost', + 'username' => 'fraggle', + 'password' => '$Love79!', + 'database' => 'bdVols', + 'actions' => array ( + 'home', + 'login', + 'register', + 'booking', + 'search', + 'account' + ) + ); + + /* return array( + 'host' => $_SERVER['dbHost'], + 'username' => $_SERVER['dbLogin'], + 'password' => $_SERVER['dbPass'], + 'database' => '$_SERVER['dbBd']' + ); */ + +?> diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..70960fb --- /dev/null +++ b/footer.html @@ -0,0 +1,5 @@ + + + diff --git a/header.html b/header.html new file mode 100644 index 0000000..8e523a2 --- /dev/null +++ b/header.html @@ -0,0 +1,14 @@ + + + + +Air Polytech + + + + + + diff --git a/header.php b/header.php new file mode 100644 index 0000000..e81db37 --- /dev/null +++ b/header.php @@ -0,0 +1,12 @@ + diff --git a/home.php b/home.php new file mode 100644 index 0000000..5499ba9 --- /dev/null +++ b/home.php @@ -0,0 +1,25 @@ +query($requete); + echo "\n"; + echo "\n"; + while ($ligne = $result->fetch_row()) { + $code = htmlentities($ligne[0]); + $nom = htmlentities($ligne[1]); + $rue = htmlentities($ligne[2]); + $ville = htmlentities($ligne[3]); + echo "\n"; + } + echo "
Code_CLNomRueVille
$code$nom$rue$ville
\n"; + $result->close(); + $connection->close(); +} + +home(); + +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..01b3ce3 --- /dev/null +++ b/index.php @@ -0,0 +1,61 @@ + diff --git a/libs/db.php b/libs/db.php new file mode 100644 index 0000000..0f280a4 --- /dev/null +++ b/libs/db.php @@ -0,0 +1,116 @@ +connection = $connection; + + if (!$this->connection->connect_errno) { + $this->connected = true; + } else { + die('Fail to connect to the RDBMS'); + } + + return $this->connection; + } + + /** + * [close description] + * @return [type] [description] + */ + public function close() + { + if ($this->connected && $this->connection->close()) { + $this->connected = false; + } else { + die('Fail to close the connection to the RDBMS'); + } + } + + /** + * [query description] + * @param [type] $sql_query [description] + * @return [type] [description] + */ + public function query($sql_query) + { + if ($this->connected && !($query_result = $this->connection->query($sql_query))) { + echo "Fail to execute the SQL query : " . $sql_query; + } + return $query_result; + } + + /** + * [prepare_query description] + * @param [type] $prepared_query [description] + * @return [type] [description] + */ + public function prepare_query($prepared_query) + { + $this->current_pquery = $prepared_query; + if ($this->connected && !($this->current_stmt = $this->connection->prepare($this->current_pquery))) { + // Empty the currently stored prepared query in the failure case + $this->current_pquery = ""; + echo "Fail to prepare SQL query : (" . $this->connection->errno . ") " . $this->connection->error . " - " . $this->current_pquery; + } + return $this->current_stmt; + } + + /** + * [prepared_query_bind_param description] + * @param [type] $params [description] + * @return [type] [description] + */ + public function prepared_query_bind_param(...$params) + { + $rt_val = $this->current_stmt->bind_param($params); + if (!$rt_val) { + echo "Fail to link parameters to SQL query : (" . $this->current_stmt->errno . ") " . $this->current_stmt->error . " - " . $this->current_pquery; + } + return $rt_val; + } + + /** + * [run_prepared_query description] + * @return [type] [description] + */ + public function run_prepared_query() + { + $rt_val = $this->current_stmt->execute(); + if (!$rt_val) { + echo "Fail to execute SQL query : (" . $this->current_stmt->errno . ") " . $this->current_stmt->error . " - " . $this->current_pquery; + } + return $rt_val; + } + + /** + * [close_prepared_query description] + * @return [type] [description] + */ + public function close_prepared_query() + { + $rt_val = $this->current_stmt->close(); + if (!$rt_val) { + echo "Fail to close SQL query : (" . $this->current_stmt->errno . ") " . $this->current_stmt->error . " - " . $this->current_pquery; + } + return $rt_val; + } +} +?> diff --git a/login.php b/login.php new file mode 100644 index 0000000..e69de29 diff --git a/register.php b/register.php new file mode 100644 index 0000000..e69de29 diff --git a/search.php b/search.php new file mode 100644 index 0000000..e69de29 diff --git a/styles/airpolytech.css b/styles/airpolytech.css new file mode 100644 index 0000000..3093507 --- /dev/null +++ b/styles/airpolytech.css @@ -0,0 +1,16 @@ +body { + background-color: black; + color: #eeeeee; + font-family: 'Encode Sans Semi Condensed', Arial, Helvetica, Verdana, sans-serif; + display: block; + margin: 8px; +} + +#footer { + text-align: center; +} + +#header { + font-size: 44px; + text-align: center; +} -- 2.34.1