From 3256717165436e4e90bc5ca764babf1bd8d97f0a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Sep 2014 18:55:57 +0200 Subject: improvemend --- bootstrap/action.php | 17 ++++ bootstrap/bootstrap.php | 25 +++--- bootstrap/class/mysql.php | 24 +++-- bootstrap/config.php | 12 +-- bootstrap/functions.php | 214 ++++++++++++++++++++++++++++++++++++++++++++ bootstrap/index.php | 83 +++++++++-------- bootstrap/setup.php | 12 --- bootstrap/static/header.php | 6 +- bootstrap/static/style.css | 66 ++++++++++++++ 9 files changed, 377 insertions(+), 82 deletions(-) create mode 100644 bootstrap/action.php delete mode 100644 bootstrap/setup.php create mode 100644 bootstrap/static/style.css (limited to 'bootstrap') diff --git a/bootstrap/action.php b/bootstrap/action.php new file mode 100644 index 0000000..e6ce5c6 --- /dev/null +++ b/bootstrap/action.php @@ -0,0 +1,17 @@ +".$e->getMessage()."

", '500 Server Failure', false, '

Failed to open database connection.

'); } - if ( $this->db->connect_errno() ){ + if ( $this->db->connect_errno ){ failure("

Can't connect to the database. MySQL gave this error code: " . $this->db->connect_errno . "

", '500 Server Failure', false, '

Connection to MySQL server failed.

'); } @@ -46,7 +46,7 @@ class db { if ( ! $this->check() ) return false; - return $this->db->query($sql); + return $this->db->query($string); } # does multiple queries WITHOUT output (INSERT, UPDATE, DELETE... ) @@ -63,7 +63,7 @@ class db { break; if ( ! $this->db->next_result() ){ if ( $this->db->error != "" ){ - $res->free(); + //$result->free(); return false; } } @@ -117,8 +117,8 @@ class db { name VARCHAR(70), UNIQUE(name), password VARCHAR(70), UNIQUE(password), email VARCHAR(70), UNIQUE(email), - register INTEGER, - ENGINE=InnoDB;'; + register INTEGER + ) ENGINE=InnoDB;'; $banned_user_table = 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'banned_user @@ -131,7 +131,19 @@ class db { ) ENGINE=InnoDB;'; - if ( ! $this->execMultipleQueries('BEGIN; '. $user_table . ' ' . $banned_user_table . ' END;') ) + $jg_table = + 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'member + ( member_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(member_id), + name varchar(70), UNIQUE(name), + adresse TEXT, + telefonnummer TEXT, + handynummer TEXT, + email varchar(70), UNIQUE(email), + geburtstag TEXT + ) + ENGINE=InnoDB;'; + + if ( ! $this->execMultipleQueries('BEGIN; '. $user_table . ' ' . $banned_user_table . ' ' . $jg_table . ' COMMIT;') ) failure("

There was a problem during bootstrapping the database schema. " . $this->db->error . "

", '500 Server Failure', false, "

CREATE TABLE FAILED

"); } diff --git a/bootstrap/config.php b/bootstrap/config.php index 5c66d07..e39fb57 100644 --- a/bootstrap/config.php +++ b/bootstrap/config.php @@ -1,12 +1,12 @@ +
+
+ + +

Junge Gemeinde Adlershof

Login required

+ + +
+ +
+ +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+
+ + +

Junge Gemeinde Adlershof

+ +
+
+doQuery("SELECT * FROM " . DBPREFIX . "member;"); +?> +

Adress Liste

+
+ +
+ + + + + + + + + + + + + + + fetch_array(MYSQLI_ASSOC) ){ + echo " + + + + + + + + + "; + $count++; + } + ?> + + */ + ?> + +

#

Name

Adresse

Telefon

Handynummer

E-Mail

Geburtstag

ändern

$count".htmlentities($row['name'])."".htmlentities($row['adresse'])."".htmlentities($row['telefonnummer'])."".htmlentities($row['handynummer'])."".htmlentities($row['email'])."".htmlentities($row['geburtstag'])."
".$count."".$row[1]." + ".$row[2]."".$row[3]."".$row[4]."".$row[5]."".$row[6]."
+
+ +
+
+ + +prepare("SELECT * FROM " . DBPREFIX . "member WHERE member_id = %d", $id); + $result = $db->doQuery($sql); + if(!$result){ + echo "Fail!"; + exit; + } + while ( $row = $result->fetch_array(MYSQLI_ASSOC) ){ +?> +

Änderung für

+ +
+
&goto=liste'> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAdresseTelefon
'>'>'>
HandynummerE-MailGeburtstag
'>'>'>
+ +
+
+ +

Füge die Daten hinzu

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAdresseTelefon
HandynummerE-MailGeburtstag
+ +
+
+prepare("INSERT INTO " . DPREFIX . "member (id, name, adresse, telefonnummer, handynummer, email, geburtstag) VALUES (NULL. %s, %s, %s, %s, %s, %s);", $_POST['name'], $_POST['adresse'], $_POST['telefonnummer'], $_POST['handynummer'], $_POST['email'], $_POST['geburtstag']); + if( ! $db->doQuery($sql) ) + return false; + else + return true; +} + +function print_404(){ + header($_SERVER['HTTP_PROTOCOL'] . ' 404 Not Found'); +?> + @@ -10,9 +14,11 @@ $user = new jg(); + + + Junge Gemeinde Adlershof - @@ -23,50 +29,43 @@ require_once 'static/header.php';
isLoggedIn() ){ -?> -
-
- -

Junge Gemeinde Adlershof

+ if($_GET["page"] == "" || $_GET["page"] == "index") + print_index(); + else{ + switch($_GET["page"]){ + case("login"): + print_login(); + break; + case("liste"): + print_list(); + break; - -
- -
- - Required for login. -
-
+ case("update"): + print_update_list($_GET['id']); + break; + case("add"): + print_add_entry_to_list(); + break; + case("404"): + print_404(); + break; + case("action"): + require_once 'action.php'; + break; + default: + print_index(); + } + } - -
- -
- - Required for login. -
+/* +if ( isset($_GET['goto']) && $_GET['goto'] != "" && $redirect ){ + header($_SERVER['SERVER_PROTOCOL'] . ' 302 Moved'); + header('Location: /?page='.$_GET['goto']); +} +*/ +?>
- - -
- -
- -
- -
-
- -

Junge Gemeinde Adlershof

-
-
-

Welcome!

-
createTables(); -$db->close(); - -echo "

Successfully created the database.

"; - -# rename this file to avoid setting up the tables twice -rename(ABSPATH . 'setup.php', ABSPATH . '_setup.php'); diff --git a/bootstrap/static/header.php b/bootstrap/static/header.php index 37c36ab..a7a5042 100644 --- a/bootstrap/static/header.php +++ b/bootstrap/static/header.php @@ -7,18 +7,18 @@ - Home + Home
diff --git a/bootstrap/static/style.css b/bootstrap/static/style.css new file mode 100644 index 0000000..5821df4 --- /dev/null +++ b/bootstrap/static/style.css @@ -0,0 +1,66 @@ +html { + position: relative; + min-height: 100%; +} + +body { + margin-bottom: 60px; +} + +a { + color: #3083D6; +} + +/* navbar */ + +.navbar-default { + background-color: #3083D6 ; + border-color: #3083D6 ; + background: #3083D6 ; +} + +.navbar-default .navbar-brand { + color: white; +} + +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { +} + +.navbar-default .navbar-nav > li > a { + color: white; +} + + +/* footer */ + +.footer { + background-color: #3083D6 ; + border-color: #3083D6 ; + background: #3083D6 ; + color: white ; + position: absolute; + bottom: 0; + width: 100%; +} + +#copyright-text { + color: white; +} + +/* noscript */ + +.noscript { + background-color: red; + color: white; +} + +.table-center { + margin: 0 auto !important; + float: none !important; +} + +.disabled { + color: #5E5E5E; + text-decoration: line-through; +} -- cgit v1.2.3