From: Jérôme Benoit Date: Tue, 9 Jan 2018 09:21:55 +0000 (+0100) Subject: Initial commit of the HUGo project web application. X-Git-Url: https://git.piment-noir.org/?p=Project_webapp.git;a=commitdiff_plain;h=fb6aedc24c1522dd61aabe01263eb88f69accee0 Initial commit of the HUGo project web application. Signed-off-by: Jérôme Benoit --- fb6aedc24c1522dd61aabe01263eb88f69accee0 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; +}