diff options
Diffstat (limited to 'www/insert.php')
| -rw-r--r-- | www/insert.php | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/www/insert.php b/www/insert.php index 17002e3..c0b30e5 100644 --- a/www/insert.php +++ b/www/insert.php @@ -1,12 +1,9 @@ -<?php include('auth.php'); +<?php /* Copyright Maximilian Möhring, 2013 Licensed under the GPL. Read LICENSE for more Information.*/ -include("header.php"); - -if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $db = new SQLite3('../database/database.sqlite'); +function insert_db($db){ $safe1 = SQLite3::escapeString("$_POST[name]"); $safe2 = SQLite3::escapeString("$_POST[adresse]"); @@ -14,10 +11,21 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $safe4 = SQLite3::escapeString("$_POST[handynummer]"); $safe5 = SQLite3::escapeString("$_POST[email]"); $safe6 = SQLite3::escapeString("$_POST[geburtstag]"); - $query = "INSERT INTO member(id, name, adresse, telefonnummer, handynummer, email, geburtstag) VALUES(NULL,'$safe1','$safe2','$safe3','$safe4','$safe5','$safe6');"; - $result = $db->exec("$query"); + $query = "INSERT INTO jg (id, name, adresse, telefonnummer, handynummer, email, geburtstag) VALUES(NULL,'$safe1','$safe2','$safe3','$safe4','$safe5','$safe6');"; + if($db->exec(" + BEGIN TRANSACTION; + ".$query." + COMMIT; + ")){ + return true; + } else { + return false; + } } +function print_insert(){ + + include("static/header.php"); echo " <div id='content_container' align='center'> @@ -26,8 +34,33 @@ echo " <div class='ueberschrift'><p>JUNGE GEMEINDE ADLERSHOF</p> </div> </div> -"; - if ($_SERVER['REQUEST_METHOD'] == 'POST') { + <br><a2>Trage einfach die Daten von unserem neuen Mitglied ein: </a2><br> + <form method='post' action='/new_member' > + <table> + <tr> + <td align='right'><a2>Name: <input type='text' name='name' ></a2> </td> + <td align='right'><a2>Adresse: <input type='text' name='adresse' > </a2></td> + <td align='right'><a2>Telefon: <input type='text' name='telefonnummer'></a2> </td></tr> + <tr align='right'><td><a2>Handy: <input type='text' name='handynummer' ></a2> </td> + <td align='right'><a2>E-Mail: <input type='text' name='email' ></a2> </td> + <td align='right'><a2>Geburtstag: <input type='text' name='geburtstag' ></a2> </td> + </tr> + <tr> + <td> </td> + <td align='center'><input type='submit' name='submit' value='Hinzufügen'/></td> + <td> </td> + </tr> + </table> + </form> + </div> + "; + +} +/* +</body>"; +*/ + +/* echo " <center> <br> @@ -43,26 +76,5 @@ Einen Moment, sie werden gleich weitergeleitet. "; header("Refresh: 4; /liste.php"); - - } else { - echo " - <br><a2>Trage einfach die Daten von unserem neuen Mitglied ein: </a2><br> - <form method='post' action='insert.php' ><table><tr> - <td align='right'><a2>Name: <input type='text' name='name' ></a2> </td> - <td align='right'><a2>Adresse: <input type='text' name='adresse' > </a2></td> - <td align='right'><a2>Telefon: <input type='text' name='telefonnummer'></a2> </td></tr> - <tr align='right'><td><a2>Handy: <input type='text' name='handynummer' ></a2> </td> - <td align='right'><a2>E-Mail: <input type='text' name='email' ></a2> </td> - <td align='right'><a2>Geburtstag: <input type='text' name='geburtstag' ></a2> </td></tr> - <tr><td> </td><td align='center'><input type='submit' name='submit' value='Hinzufügen'/></td><td> </td></tr> - </table></form> - "; - -} -/* -</body>"; */ - //echo '<br><a href="login.php?x=$cryptedip">Zurück</a></center>'; - -?> |
