diff --git a/registration-system/admin/pages_sa.php b/registration-system/admin/pages_sa.php index c0ed70b0fb10bfb58ae10fa79498b9c68a79ebd3..3bbb6b037e7b31599e950b75bc2ae2809bfa71db 100644 --- a/registration-system/admin/pages_sa.php +++ b/registration-system/admin/pages_sa.php @@ -6,12 +6,80 @@ * Time: 9:24 PM */ -global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax, $config_reisearten, $config_reisearten_0, $config_studitypen_o, $config_admin_verbose_level, $config_verbose_level, $config_essen; +global $text, $headers, $admin_db, $config_userfile, $config_current_fahrt_file, $config_current_fahrt_id, $ajax, $config_reisearten, $config_reisearten_0, $config_studitypen_o, $config_admin_verbose_level, $config_verbose_level, $config_essen; //$config_admin_verbose_level = 4; //$config_verbose_level = 4; $text .= "<h1>SuperAdmin Panel</h1>"; -// neue fahrt anlegen -// neue nutzer anlegen +// FORM submit stuff +if(isset($_REQUEST['us_submit'])){ + if(!isset($_REQUEST['users'])) $text.= "something wrong... wanted to submit users"; + else { + $tmp = file_put_contents($config_userfile, $_REQUEST['users']); + $text .= "updated userfile!<br /> + written to file '".$config_userfile."' with exit code: ". $tmp ."<br /> + if no code shown, then false -> check if file has chmod rw-rw-rw-!"; + } +} + +if(isset($_REQUEST['nf_submit'])){ + if(isset($_REQUEST['resubmit'])){} + else{ + $admin_db->insert("fahrten", ["titel"=>"neu", "map_pin" => "52.42951196033782 13.530490995971718", "von"=>date('Y-m-d'), "bis" => date('Y-m-d')]); + $tmp = $admin_db->max("fahrten", "fahrt_id"); + $text .= "neue Fahrt angelegt mit ID: ".$tmp. "<br/> + Zum Bearbeiten ID ändern!"; + } +} + +if(isset($_REQUEST['id_submit'])){ + $tmp = file_put_contents($config_current_fahrt_file, $_REQUEST['fid']); + $text .= "changed \$config_current_fahrt_id to ".$_REQUEST['fid'] . "<br /> + written to file '".$config_current_fahrt_file."' with exit code: ". $tmp ."<br /> + if no code shown, then false -> check if file has chmod rw-rw-rw-!"; +} + + + + + + + +// VIEW stuff: + +if(file_exists($config_userfile)) + $usas = file_get_contents($config_userfile); +$text .= '<h2>Nutzer bearbeiten</h2> +ACHTUNG: Tippfehler können Systemfunktionalität beeinträchtigen! <i>Format: {N|S}⎵USERNAME⎵PASSWORD⎵RANDOMSTUFF</i><br /> +<a href="../passwd/index.html">Passwort-gen tool</a> (an Organisator weiterleiten, der schickt dann Passwort hash zurück)<br /> +<form method="POST"> + <textarea rows="8" cols="130" name="users" id="users">'.$usas.'</textarea><br /> + <input type="submit" name="us_submit" id="us_submit" value="us_submit" /> +</form> '; + + +$text .= '<h2>Neue Fahrt anlegen</h2> +<form method="POST" target="?resubmit=not"> + <input type="submit" name="nf_submit" value="nf_submit" id="nf_submit" /> +</form> '; + + +$text .= '<!--h2>Fahrt löschen</h2> +ACHTUNG: löscht ohne Nachfrage ALLE mit dieser Fahrt verbunden Daten!<br /-->'; + + +$fids = $admin_db->select("fahrten","fahrt_id"); +$config_current_fahrt_id = getCFID(); +$text .= '<h2>Aktuelle Fahrt ID</h2> + Wählt die Fahrt, die über das Adminpanel bearbeitet/verwaltet werden kann.<br /> + <form method="POST" > + <label>Neue ID wählen (aktiv: '.$config_current_fahrt_id.'):</label> + <select name="fid" id="fid">'; + foreach($fids as $fid) + $text .= '<option value="'.$fid.'">'.$fid.'</option>'; +$text .= ' + </select> + <input type="submit" name="id_submit" value="id_submit" id="id_submit" /> + </form>'; diff --git a/registration-system/config.inc.php b/registration-system/config.inc.php index a4eda6c26b0b548eae6910b7eeb271c7226331c4..a8c14d49c482d34ed86a8552c899b7b5317f0e89 100644 --- a/registration-system/config.inc.php +++ b/registration-system/config.inc.php @@ -70,8 +70,18 @@ $config_superadmins = array( ); */ $config_userfile = __DIR__."/passwd/users.txt"; // relative to configfile +$config_current_fahrt_file = __DIR__."/config_current_fahrt_id"; $config_mailtag = "[FS-Fahrt] - "; $config_baseurl = "http://fsfahrt.repke.eu/anmeldung/registration-system/"; -$config_current_fahrt_id = 2; +$config_current_fahrt_id = getCFID(); + +function getCFID(){ + global $config_current_fahrt_file; + if(file_exists( $config_current_fahrt_file )) + $tmp = file_get_contents($config_current_fahrt_file); + if(is_numeric($tmp)) + return $tmp; + return 1; +} \ No newline at end of file diff --git a/registration-system/config_current_fahrt_id b/registration-system/config_current_fahrt_id new file mode 100644 index 0000000000000000000000000000000000000000..d8263ee9860594d2806b0dfd1bfd17528b0ba2a4 --- /dev/null +++ b/registration-system/config_current_fahrt_id @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/registration-system/view/admin_style.css b/registration-system/view/admin_style.css index ebb65c1242bb5be26a7c060e1d7ea4be058b29c3..1d70ba26ae88f110bbb62abf851a855257d4d1bb 100644 --- a/registration-system/view/admin_style.css +++ b/registration-system/view/admin_style.css @@ -9,6 +9,7 @@ body{ margin-top: 40px; height:100%; } + a:link, a:visited { background-color:inherit; color:#ff8400;;