summaryrefslogtreecommitdiff
path: root/doc/niels-diplom/Dateistruktur/admin
diff options
context:
space:
mode:
Diffstat (limited to 'doc/niels-diplom/Dateistruktur/admin')
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/LIST/parse-exel.pl38
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/adminfuncs.php190
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/edit_lesson.php159
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/get_user.php158
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/lesson_admin.php178
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/upload.php25
-rwxr-xr-xdoc/niels-diplom/Dateistruktur/admin/user_admin.php406
7 files changed, 1154 insertions, 0 deletions
diff --git a/doc/niels-diplom/Dateistruktur/admin/LIST/parse-exel.pl b/doc/niels-diplom/Dateistruktur/admin/LIST/parse-exel.pl
new file mode 100755
index 0000000..1574c0d
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/LIST/parse-exel.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Spreadsheet::ParseExcel;
+
+my $oExcel = new Spreadsheet::ParseExcel;
+
+die "Bitte eine EXCEL-DATEI als $0 angeben!" unless @ARGV;
+
+my $oBook = $oExcel->Parse($ARGV[0]);
+my($iR, $iC, $oWkS, $oWkC);
+
+#print "FILE :", $oBook->{File} , "\n";
+#print "COUNT :", $oBook->{SheetCount} , "\n";
+#print "AUTHOR:", $oBook->{Author} , "\n"
+
+#if defined $oBook->{Author};
+
+for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++)
+{
+ $oWkS = $oBook->{Worksheet}[$iSheet];
+ #print "--------- SHEET:", $oWkS->{Name}, "\n";
+ for(my $iR = $oWkS->{MinRow} ;
+ defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
+ $iR++)
+ {
+ print ">>>";
+ for(my $iC = $oWkS->{MinCol} ;
+ defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
+ $iC++)
+ {
+ $oWkC = $oWkS->{Cells}[$iR][$iC];
+ print ">", $oWkC->Value if($oWkC);
+ }
+ }
+}
+
+
diff --git a/doc/niels-diplom/Dateistruktur/admin/adminfuncs.php b/doc/niels-diplom/Dateistruktur/admin/adminfuncs.php
new file mode 100755
index 0000000..e6c61b3
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/adminfuncs.php
@@ -0,0 +1,190 @@
+<?
+
+//___________Nutzerfunktionen____________________________________________________________________________
+
+
+
+function del_user($user) // deaktivieren einzelner Nutzer
+{
+
+ $delete = "UPDATE students SET aktiv = 0 WHERE Name = '$user'";
+
+ $stmt = dbconnect($delete);
+
+ OCIExecute($stmt);
+
+ $message = "Nutzer '$user' inaktiv gesetzt!";
+
+ return $message;
+
+}
+
+
+
+function akt_user($user) // aktivieren einzelner Nutzer
+{
+
+ $aktiv = "UPDATE students SET aktiv = 1 WHERE Name = '$user'";
+
+ $stmt = dbconnect($aktiv);
+
+ OCIExecute($stmt);
+
+ $message = "Nutzer '$user' aktiv gesetzt!";
+
+ return $message;
+
+}
+
+
+function akt_group($group) // Gruppe komplett aktivieren
+{
+ $aktiv = "UPDATE students SET aktiv = 1 WHERE groups = '$group'";
+
+ $stmt = dbconnect($aktiv);
+
+ OCIExecute($stmt);
+
+ $message = "gruppe '$group' aktiv gesetzt!";
+
+ return $message;
+}
+
+function inakt_group($group) // Gruppe komplett deaktivieren
+{
+
+ $aktiv = "UPDATE students SET aktiv = 0 WHERE groups = '$group'";
+
+ $stmt = dbconnect($aktiv);
+
+ OCIExecute($stmt);
+
+ $message = "Gruppe '$group' inaktiv gesetzt!";
+
+ return $message;
+
+
+}
+
+
+function add_user($name, $vorname, $login, $typ, $group) // Anlegen einzelner Nutzer in vorhandene Gruppen
+{
+
+ $insert = "INSERT INTO students VALUES (1, '$name', '$vorname', '$typ', sysdate, 1, '$login', '$group')";
+
+ print $insert;
+
+ $stmt = dbconnect($insert);
+
+ OCIExecute($stmt);
+
+ $message = "Nutzer '$user' erfolgreich in '$group' eingefügt!";
+
+ return $message;
+
+}
+
+
+
+function add_user_from_list($name, $vorname, $login, $group) // Anlegen der Nutzer aus der Liste
+{
+
+ $test = "Select NAME, LOGIN, GROUPS from Students where NAME='$name' and LOGIN='$login' and GROUPS='$group'";
+
+ $stmt = dbconnect($test);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt,$results); //Ergebnisse in Array eintragen...
+
+ if ( $nrows == 1 )
+ {
+ $message = "Nutzer '$name', '$vorname' mit Login '$login' existiert bereits - Nutzer wurde nicht angelegt!";
+ return $message;
+ exit;
+ }
+
+ $insert = "INSERT INTO students VALUES (1, '$name', '$vorname', 0, sysdate, 1, '$login', '$group')";
+
+ $stmt = dbconnect($insert);
+
+ OCIExecute($stmt);
+
+ $message = "Nutzer '$name', '$vorname' mit Login '$login' erfolgreich in '$group' eingefügt!";
+
+ return $message;
+
+}
+
+
+
+function add_group($groupname)
+{
+ $insert = "INSERT INTO groups VALUES ('$groupname')";
+
+ $stmt = dbconnect($insert);
+
+ OCIExecute($stmt);
+
+ $message = "Gruppe '$groupname' erfolgreich angelegt!";
+
+ return $message;
+}
+
+
+
+
+//_________Aufgabenfunktionen_____________________________________________________________________
+
+
+
+
+function less_del($lesson)
+{
+
+ $delete = "update lessons set AKTIV=0 where lesson_id = '$lesson'";
+
+ $stmt = dbconnect($delete);
+
+ OCIExecute($stmt);
+
+ $message = "Die Aufgabe wurde erfolgreich gelöscht!";
+
+ return $message;
+
+}
+
+
+function less_add($text, $muster, $typ, $part)
+{
+
+ $insert = "INSERT INTO lessons VALUES (1, '$text', '$typ', 1, '$part', '$muster')";
+
+ $stmt = dbconnect($insert);
+
+ OCIExecute($stmt);
+
+ $message = "Die Aufgabe wurde angelegt!";
+
+ return $message;
+
+}
+
+function less_change($typ, $text, $aktiv, $muster, $id)
+{
+
+ $text = ereg_replace("'", "''", $text);
+ $muster = ereg_replace("'", "''", $muster);
+
+ $update = "UPDATE lessons SET text = '$text', typ = '$typ', aktiv = '$aktiv', muster = '$muster' WHERE lesson_id = '$id'";
+
+ $stmt = dbconnect($update);
+
+ OCIExecute($stmt);
+
+ $message = "Die Aufgabe wurde geändert!";
+
+ return $message;
+
+}
+?> \ No newline at end of file
diff --git a/doc/niels-diplom/Dateistruktur/admin/edit_lesson.php b/doc/niels-diplom/Dateistruktur/admin/edit_lesson.php
new file mode 100755
index 0000000..de1da2d
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/edit_lesson.php
@@ -0,0 +1,159 @@
+<?php
+
+include("../header.php");
+
+if ($_SESSION['type'] == 0) // Session Zugangscheck für den Administrator
+ {
+
+ //print "<meta HTTP-EQUIV=\"Refresh\" CONTENT=5; URL=\"/dipl/praktikum.php\">";
+ print "<tr><td class=\"titel_15\">KEINE ADMINSESSION...</td></tr>";
+ print "<tr><td class=\"titel_15\">Bitte Loggen sie sich erneut als Admin ein...</td></tr>";
+ print "</td></tr></table></table>";
+ include("../footer.php");
+ exit;
+
+ }
+
+include("adminfuncs.php");
+
+
+$id = $_GET['id'];
+
+
+if (isset($_POST['delete']))
+{
+
+ $message = less_del($id); //Aufgabe entfernen
+
+ ?>
+
+ <tr>
+ <td class="titel_15">AUFGABENVERWALTUNG</td>
+ </tr>
+
+ <table>
+ <tr></tr>
+
+
+ <?
+
+ print "<tr><td class=text>" . $message . "</td></tr></table>";
+
+}
+
+
+if (isset($_POST['new']))
+{
+
+ less_change($_POST['new_typ'], $_POST['new_text'], $_POST['new_aktiv'], $_POST['new_muster'], $id); //Aufgabe ändern
+
+}
+
+?>
+
+<tr>
+<td class="titel_15">AUFGABENVERWALTUNG</td>
+</tr>
+
+<table>
+
+<form action="<?=$_POST['PHP_SELF'] . "?id=" . $_GET['id'] . "&typ=" . $_GET['typ'] . "&" . SID?>" method="Post">
+
+<?
+
+ $sql = "SELECT typ as TYP, text as TEXT, aktiv as AKTIV, muster as MUSTER FROM lessons WHERE lesson_id = '$id'";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt,$results); //Ergebnisse in Array eintragen...
+
+ if ( $nrows == 1 )
+ {
+ OCIExecute($stmt);
+
+ while(OCIFetch($stmt))
+ {
+ $lesson_typ = OCIResult($stmt, "TYP");
+ $lesson_text = OCIResult($stmt, "TEXT");
+ $aktiv = OCIResult($stmt, "AKTIV");
+ $muster = OCIResult($stmt, "MUSTER");
+ }
+
+
+
+ print "<tr><TD colspan=2 class=text><BR>Die von Ihnen gewählte Aufgabe vom Typ " . $_GET['typ'] . " hat folgende Inhalte: <BR> <BR><TABLE Width=550 BORDER=1 colspan=2>\n";
+ print "<TR>\n";
+ while ( list( $key, $val ) = each( $results ) )
+ {
+ print "<TH>$key</TH>\n";
+ }
+
+ print "</TR>\n";
+
+ $column = each($results);
+ $data = $column['value'];
+
+?>
+
+
+
+ <td valign=top>
+ <br>
+ <select class="inputtext" name="new_typ" size="1" >
+ <option <?if($lesson_typ == 'SELECT') {?> selected <?}?>>SELECT
+ <option <?if($lesson_typ == 'INSERT') {?> selected <?}?>>INSERT
+ <option <?if($lesson_typ == 'UPDATE') {?> selected <?}?>>UPDATE
+ <option <?if($lesson_typ == 'CREATE') {?> selected <?}?>>CREATE
+ </select>
+ </td>
+
+<TD><TExtarea name="new_text" cols="25" rows="10"><?print $lesson_text; ?></textarea></TD>
+
+ <TD valign=top>
+ <br>
+ <select class="inputtext" name="new_aktiv" size="1" cols=10>
+ <option value=1 <?if ($aktiv == 1) {?> selected <?}?> >aktiv(1)
+ <option value=0 <?if ($aktiv == 0) {?> selected <?}?> >inaktiv(0)
+ </select>
+ </td>
+
+<TD><TExtarea name="new_muster" cols=15 rows=10><?print $muster;?></textarea></TD>
+
+</TR></td></tr>
+
+</TABLE><BR>
+
+<tr><td><input class="inputsubmit" type="Submit" name="new" value="ändern" valign="center"><BR><br></td></tr>
+
+
+<tr><td colspan=2 class="randoben">&nbsp;</td></tr>
+<tr><td valign="center" class="titel"><br>Die oben angezeigte Aufabe</td>
+<td>
+<input class="inputsubmit" type="Submit" name="delete" value="inaktiv setzen">
+</td></tr>
+<tr><td>&nbsp;</td></tr>
+
+<tr><td id=tdlistl>&nbsp;</td></tr>
+
+<tr><td colspan=30><div id=message><? echo $message; ?></div></td></tr>
+
+
+<tr><td id=tdlistl colspan=30>&nbsp;</td></tr>
+</form>
+</table>
+
+ </td> </tr></table>
+ <tr>
+ <td width="200" align="right" valign="top" class="randmenu"><p>&nbsp;</td>
+ </tr>
+ </table>
+
+<?
+ include("../footer.php");
+ exit;
+ }
+?>
+
+
diff --git a/doc/niels-diplom/Dateistruktur/admin/get_user.php b/doc/niels-diplom/Dateistruktur/admin/get_user.php
new file mode 100755
index 0000000..52aee37
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/get_user.php
@@ -0,0 +1,158 @@
+<?php
+
+include("../header.php");
+include("adminfuncs.php");
+
+$path = "LIST/".$_SESSION['file'];
+$scriptpath = "LIST/parse-exel.pl";
+
+
+//______________Auslesen des EXCEL-FILES_____________________________________________________________________
+
+ $handle = popen("perl $scriptpath $path", "r"); // parsen des XLS-Files
+ $inhalt = fread($handle, filesize ("$path")); // Parsingergebnis in Variable schreiben
+
+ $lines = explode(">>>",$inhalt); // Zeilenweise aufsplitten...
+ $count = count($lines); // Anzahl der Ergebnisse bestimmen...
+
+ for ($i = 0; $i < $count; $i++) // Inhalte in zweidimensionales Array schreiben
+ {
+ $cont = explode(">",$lines[$i]);
+ $countcont = count($cont);
+ for ($c = 0; $c < $countcont; $c++)
+ {
+ $dim[$i][$c] = $cont[$c]; // $dim enthält die Daten der Studenten
+ }
+ }
+
+//____________________________________________________________________________________________________________
+
+
+
+?>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td class="titel_15">STUDENTENLISTE<br><br></td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class=text>
+
+<?
+
+if (isset($_GET['load']))
+{
+
+ $group = $_GET['thegroup'];
+
+ while(list($strName ,$value) = each($_GET))
+ {
+ if(is_array($value))
+ {
+ foreach($value as $value_array)
+ {
+ $message = add_user_from_list($dim[$value_array][1], $dim[$value_array][2], $dim[$value_array][3], $group);
+ print "> ".$message."<br>"; //Ausgabe der Fehlermeldung
+ }
+ }
+ }
+}
+
+?>
+
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td valign="top" class="text">
+ <tr>
+
+ <table>
+
+<form action=<?=$_POST['PHP_SELF'].SID?>>
+
+<tr colspan=2><td class="text">In welche GRUPPE sollen die Nutzer aufgenommen werden:</td>
+ <td width=400>
+ <select class="inputtext" name="thegroup" size="1" width=190>
+ <?
+
+ $sql = "SELECT groups FROM groups";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value']; //Liste mit vorhandenen Benutzern füllen
+ }
+
+ if ($_POST['all_group'] == $data[$i]) print "<option selected>" . $data[$i] . "</option>\n"; else print "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+ </tr>
+
+<tr colspan=2>
+ <td>&nbsp;</td>
+ </tr>
+ <tr colspan=2>
+ <td colspan=2 class=randoben>&nbsp;</td>
+ </tr>
+<tr valign=top colspan=2><td>
+
+
+<?
+
+print "<p><select name=List[] size=$count multiple>";
+
+
+ for ($l = 0; $l < $count; $l++)
+ {
+ print "<option value=$l>";
+ for ($ll = 1; $ll < 4; $ll++)
+ {
+ print $dim[$l][$ll] . " ";
+ }
+ print "</option>";
+ }
+
+
+?>
+
+</select></p>
+
+</td>
+<td colspan=2>
+<input class=inputsubmit type=submit name=load width=179 height=15 border=0>
+</td>
+</tr>
+</form>
+
+</table>
+
+ </td> </tr></table>
+ <tr>
+ <td width="200" align="right" valign="top" class="randmenu"><p>&nbsp;</td>
+ </tr>
+ </table>
+
+
+<?
+include("../footer.php");
+?> \ No newline at end of file
diff --git a/doc/niels-diplom/Dateistruktur/admin/lesson_admin.php b/doc/niels-diplom/Dateistruktur/admin/lesson_admin.php
new file mode 100755
index 0000000..f039943
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/lesson_admin.php
@@ -0,0 +1,178 @@
+<?php
+
+include("../header.php");
+
+if ($_SESSION['type'] == 0) // Session Zugangscheck für den Administrator
+ {
+
+ //print "<meta HTTP-EQUIV=\"Refresh\" CONTENT=5; URL=\"/dipl/praktikum.php\">";
+ print "<tr><td class=\"titel_15\">KEINE ADMINSESSION...</td></tr>";
+ print "<tr><td class=\"titel_15\">Bitte Loggen sie sich erneut als Admin ein...</td></tr>";
+ print "</td></tr></table></table>";
+ include("../footer.php");
+ exit;
+
+ }
+
+include("adminfuncs.php");
+
+
+if (isset($_POST['add']))
+{
+ less_add($_POST['less_text'], $_POST['less_muster'], $_POST['less_typ'], $_POST['less_part']); //Aufgabe anlegen
+}
+
+
+if (isset($_POST['back']))
+{
+ unset($find);
+ unset($chose_typ);
+ unset($_SESSION['chose_typ']);
+}
+
+?>
+
+
+
+
+
+<a name="start"></a>
+
+<tr>
+<td class="titel_15">AUFGABENVERWALTUNG</td>
+</tr>
+
+<table class=text>
+
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="Post">
+
+
+<? if (isset($_POST['find']))
+ {
+ $chose_typ = $_POST['chose_typ'];
+
+ $_SESSION['chose_typ'] = $_POST['chose_typ'];
+
+ $sql = "SELECT LESSON_ID, TYP, TEXT FROM LESSONS where TYP = '$chose_typ' and part <> 'Vorbereitung'";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+
+ print "<tr><TD colspan=2 class=text><BR>In der Rubrik \"$chose_typ \" sind folgende Aufgaben enthalten: <BR> <BR><TABLE Width=550 BORDER=1 colspan=2>\n";
+ print "<TR>\n";
+
+
+
+ print "<TABLE Width=550 BORDER=1 colspan=2 class=text>\n";
+ print "<TH>ID</TH><TH>Typ</TH><TH>Beschreibung</TH>";
+
+ while (OCIFetch($stmt)) {
+ print "<tr><TD><a href=\"edit_lesson.php?id=" . OCIResult($stmt, "LESSON_ID") . "&typ=" . OCIResult($stmt, "TYP") . "&" . SID . "\">" . OCIResult($stmt, "LESSON_ID") . "</a></TD><TD>" . OCIResult($stmt, "TYP") . "</TD><TD>" . OCIResult($stmt, "TEXT") . "</TD></tr>";
+ }
+ OCIFreeStatement($stmt);
+
+ unset($_SESSION['chose_typ']);
+?>
+
+</TABLE>
+
+<tr>
+ <td>...zum Bearbeiten oder Löschen der Aufgaben klicken Sie bitte auf die ID!</td>
+<tr>
+ <td valign=top><br><input class="inputsubmit" type="Submit" name="back" value="zurück zur Auswahl&nbsp;"></td>
+</tr>
+
+
+
+
+
+
+</table>
+
+</table>
+
+
+<?
+ include("../footer.php");
+ exit;
+ }
+?>
+
+
+ <tr><td class="titel" colspan=2><br>Aufgaben finden & bearbeiten</td></tr>
+
+ <tr><td class="text" ><br>AUFGABEN aus der Rubrik:</td></tr>
+
+ <tr>
+ <td><br>
+ <select class="inputtext" name="chose_typ" size="1">
+ <option>SELECT</option>
+ <option>INSERT</option>
+ <option>UPDATE</option>
+ <option>CREATE</option>
+ </select>
+ <input class="inputsubmit" type="Submit" name="find" value="finden" valign="center"><br><br></td>
+ </tr>
+</form>
+</TABLE>
+
+
+
+<table>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="Post">
+
+ <tr><td colspan=2 class=randunten>&nbsp;</td></tr>
+ <tr><td class=titel colspan=2><br>Anlegen neuer Aufgaben</td></tr>
+ <tr><td colspan=2>&nbsp;</td></tr>
+ <tr><td class="text" valign=top>AUFGABENTEXT</td>
+ <td><textarea class="inputtext" type="text" name="less_text" cols="85" rows="10"></textarea></td></tr>
+
+ <tr>
+ <td class="text">MUSTERLÖSUNG</td>
+ <td>
+ <input class="inputtext" type="text" name="less_muster" size="80">
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class="text">TYPE</td>
+ <td>
+ <select class="inputtext" name="less_typ" size="1">
+ <option >SELECT</option>
+ <option >INSERT</option>
+ <option >UPDATE</option>
+ <option >CREATE</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="text">GLIEDERUNG</td>
+ <td>
+ <select class="inputtext" name="less_part" size="1">
+ <option >Vorbereitung</option>
+ <option >Abfragen</option>
+ </select><input class="inputsubmit" type="Submit" name="add" size="30" value="Aufgabe hochladen" align=center>
+ </td>
+ </tr>
+
+
+
+
+</form>
+</table>
+
+</td> </tr></table>
+<tr>
+<td width="200" align="right" valign="top" class="randmenu"><p>&nbsp;</td>
+</tr>
+</table>
+
+
+
+<?
+include("../footer.php");
+?> \ No newline at end of file
diff --git a/doc/niels-diplom/Dateistruktur/admin/upload.php b/doc/niels-diplom/Dateistruktur/admin/upload.php
new file mode 100755
index 0000000..1ef34c3
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/upload.php
@@ -0,0 +1,25 @@
+<?
+
+$uploadDir = '/usr/local/apache/htdocs_ssl/dipl/admin/LIST/';
+$uploadFile = $uploadDir . $_FILES['userfile']['name'];
+
+print "<pre>";
+if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
+{
+ print "File is valid, and was successfully uploaded. ";
+ print "Here's some more debugging info:\n";
+ print_r($_FILES);
+}
+else
+{
+ print "Possible file upload attack! Here's some debugging info:\n";
+ print_r($_FILES);
+}
+print "</pre>";
+?>
+
+<form enctype="multipart/form-data" action="upload.php" method="post">
+ <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
+ Choose a file to upload: <input name="userfile" type="file" />
+ <input type="submit" value="Upload File" />
+</form>
diff --git a/doc/niels-diplom/Dateistruktur/admin/user_admin.php b/doc/niels-diplom/Dateistruktur/admin/user_admin.php
new file mode 100755
index 0000000..01e7578
--- /dev/null
+++ b/doc/niels-diplom/Dateistruktur/admin/user_admin.php
@@ -0,0 +1,406 @@
+<?php
+
+include("../header.php");
+
+if ($_SESSION['type'] == 0) // Session Zugangscheck für den Administrator
+ {
+
+ //print "<meta HTTP-EQUIV=\"Refresh\" CONTENT=5; URL=\"/dipl/praktikum.php\">";
+ print "<tr><td class=\"titel_15\">KEINE ADMINSESSION...</td></tr>";
+ print "<tr><td class=\"titel_15\">Bitte Loggen sie sich erneut als Admin ein...</td></tr>";
+ print "</td></tr></table></table>";
+ include("../footer.php");
+ exit;
+
+ }
+
+include("adminfuncs.php");
+
+if (isset($_POST['new_group']))
+{
+
+ add_group($_POST['gruppe']); //user anlegen
+
+}
+
+if (isset($_POST['add_user']))
+{
+
+ add_user($_POST['name'], $_POST['vorname'], $_POST['login'], $_POST['typ'], $_POST['user2group']); //user anlegen
+
+}
+
+if (isset($_POST['deakt_user']))
+{
+ $message = del_user($_POST['deakt_him']); //user deaktivieren
+ unset($message);
+}
+
+if (isset($_POST['akt_user']))
+{
+ $message = akt_user($_POST['akt_ihn']); //user deaktivieren
+ unset($message);
+}
+
+if (isset($_POST['chng_akt_group']))
+{
+ $message = akt_group($_POST['all_group']); //Gruppe komplett aktivieren
+ unset($message);
+}
+
+if (isset($_POST['chng_inakt_group']))
+{
+ $message = inakt_group($_POST['all_group']); //Gruppe komplett deaktivieren
+ unset($message);
+}
+
+
+?>
+
+<a name="start"></a>
+
+<tr>
+<td class="titel_15">NUTZERVERWALTUNG</td>
+</tr>
+<tr>
+<td>
+<table width=560>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="post">
+
+ <tr><td colspan=3 class="titel"><br>einzelne aktuelle Nutzer deaktivieren...<?print $message;?></td></tr>
+ <tr><td colspan=3>&nbsp;</td></tr>
+ <tr><td class="text" width=50>USER</td>
+ <td width=100>
+ <select class="inputtext" name="deakt_him" size="1" width=95>
+
+ <?
+
+ $sql = "SELECT name FROM students where aktiv=1";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value'];
+ //Liste mit vorhandenen Benutzern füllen
+ }
+
+ echo "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+
+ <td align=right>
+ <input class="inputsubmit" type="Submit" name="deakt_user" value="inaktiv setzen">
+ </td>
+
+ </tr>
+</table>
+</form>
+
+<table width=560>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="post">
+
+ <tr><td colspan=5 class="randoben">&nbsp;</td></tr>
+
+ <tr><td colspan=5 class="titel" >einzelne inaktive Nutzer aktivieren...nach Gruppen selektiert</td></tr>
+ <tr><td colspan=5>&nbsp;</td></tr>
+
+
+
+ <tr><td class="text" width=50>GRUPPE</td>
+ <td width=100>
+ <select type=submit class="inputtext" name="group" size="1" onchange="this.form.submit()" width=95>
+ <?
+
+ $sql = "SELECT distinct groups FROM students";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value']; //Liste mit vorhandenen Benutzern füllen
+ }
+
+ if ($_POST['group'] == $data[$i]) print "<option selected>" . $data[$i] . "</option>\n"; else print "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+
+
+ <td class="text" align=right width=200>inaktive Nutzer aus der Gruppe: <?print $_POST['group'];?></td>
+ <td>
+ <select class="inputtext" name="akt_ihn" size="1">
+ <?
+ $gruppe = $_POST['group'];
+
+ $sql = "SELECT name FROM students where aktiv=0 and groups='$gruppe'";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value'];
+ //Liste mit vorhandenen Benutzern füllen
+ }
+
+ echo "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+ <td align=right>
+ <input class="inputsubmit" type="Submit" name="akt_user" value="aktiv setzen">
+ </td>
+ </tr>
+ <tr><td colspan=5>&nbsp;</td></tr>
+</form>
+</table>
+
+
+
+<table width=560>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="post">
+
+ <tr><td colspan=4 class="randoben">&nbsp;</td></tr>
+
+ <tr><td colspan=4 class="titel">gesamte Gruppen aktivieren oder deaktivieren...<?print $message;?></td></tr>
+ <tr><td colspan=4>&nbsp;</td></tr>
+ <tr><td class="text" width=50>GRUPPE</td>
+ <td width=100>
+ <select type=submit class="inputtext" name="all_group" size="1" onchange="this.form.submit()" width=95>
+ <?
+
+ $sql = "SELECT distinct groups FROM students";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value']; //Liste mit vorhandenen Benutzern füllen
+ }
+
+ if ($_POST['all_group'] == $data[$i]) print "<option selected>" . $data[$i] . "</option>\n"; else print "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+
+ <td align=right>
+ <input class="inputsubmit" type="Submit" name="chng_akt_group" value="Gr. aktiv setzen">
+ </td>
+ <td align=right>
+ <input class="inputsubmit" type="Submit" name="chng_inakt_group" value="Gr. inaktiv setzen">
+ </td>
+
+ </tr>
+ <tr><td>&nbsp;</td></tr>
+ </form>
+</table>
+
+<table width=560>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="Post">
+
+
+ <tr><td colspan=3 class="randoben">&nbsp;</td></tr>
+
+ <tr>
+ <td valign="center" colspan=3 class="titel">Hinzufügen einzelner Nutzer zu bestehenden Gruppen<br></td>
+ </tr>
+ <tr><td colspan=3>&nbsp;</td></tr>
+
+<tr><td class="text" width=150>in welche GRUPPE einfügen?</td>
+ <td width=100>
+ <select type=submit class="inputtext" name="user2group" size="1" onchange="this.form.submit()" width=95>
+ <?
+
+ $sql = "SELECT groups FROM groups";
+ //$sql = "SELECT distinct groups FROM students";
+
+ $stmt = dbconnect($sql);
+
+ OCIExecute($stmt);
+
+ $nrows = OCIFetchStatement($stmt, $results);
+
+
+ for ( $i = 0; $i < $nrows; $i++ )
+ {
+ reset($results);
+
+ while ( $column = each($results) )
+ {
+ $data = $column['value']; //Liste mit vorhandenen Benutzern füllen
+ }
+
+ if ($_POST['user2group'] == $data[$i]) print "<option selected>" . $data[$i] . "</option>\n"; else print "<option>$data[$i]</option>\n";
+ }
+
+ ?>
+
+ </select>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class="text">NAME</td>
+ <td>
+ <input class="inputtext" type="title" name="name" size=40>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="text">VORNAME</td>
+ <td>
+ <input class="inputtext" type="title" name="vorname" size=40>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="text">LOGIN</td>
+ <td>
+ <input class="inputtext" type="Password" name="login" size=40>
+ </td>
+ </tr>
+
+ <tr><td>&nbsp;</td></tr>
+
+ <tr>
+ <td class="text">TYP</td>
+ <td>
+ <select class="inputtext" name="typ" size="1">
+ <option value=0>USER</option>
+ <option value=1>ADMIN</option>
+ </select>
+ </td>
+ <td>
+ <input class="inputsubmit" type="Submit" name="add_user" size="30" value="Nutzer in <?print $_POST['user2group'];?> anlegen">
+ </td>
+ </tr>
+
+ <tr><td>&nbsp;</td></tr>
+
+ </form>
+
+
+
+ </table>
+
+<table width=560>
+<form action="<?=$_POST['PHP_SELF'] . "?" . SID?>" method="post">
+ <tr><td colspan=5 class="randoben">&nbsp;</td></tr>
+ <tr><td colspan=3 class="titel">Neue Gruppe anlegen...</td></tr>
+ <tr><td colspan=3>&nbsp;</td></tr>
+ <tr><td class="text" width=50>Gruppenname:</td>
+ <td>
+ <input class="inputtext" type="title" name="gruppe" size=40>
+ </td>
+ <td align=right>
+ <input class="inputsubmit" type="Submit" name="new_group" value="Gruppe anlegen">
+ </td>
+
+ </tr>
+</table>
+</form>
+
+
+<table width=560>
+<form action="<?$_POST['PHP_SELF'] . SID?>" method="post" enctype="multipart/form-data">
+
+<tr><td colspan=5 class="randoben">&nbsp;</td></tr>
+<tr><td colspan=5 class="titel" >EXCEL-LISTE HOCHLADEN</td></tr>
+ <tr><td colspan=5>&nbsp;</td></tr>
+ <tr>
+ <td class=text>Bitte wählen Sie eine .XLS-Datei mit den Userdaten:
+ <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+ <input class="inputsubmit" name="userfile" type="file" size="40" accept="*.xls"></td>
+ <td><br>
+ <input class="inputsubmit" type="submit" value="Upload File" name=upload align=right>
+ </td>
+ </tr>
+ <tr><td colspan=5>&nbsp;</td></tr>
+</form>
+
+<?
+
+$uploadDir = '/usr/local/apache/htdocs_ssl/dipl/admin/LIST/';
+$uploadFile = $uploadDir . $_FILES['userfile']['name'];
+
+if ( $_FILES['userfile']['type'] == "application/vnd.ms-excel" )
+{
+ $up = move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile);
+ $_SESSION['file'] = $_FILES['userfile']['name'];
+}
+
+if ( $up == 1 )
+{
+ print "<tr><td class=text>Datei ist akzeptiert und wurde erfolgreich hochgeladen. <br>";
+ print "<B>Debugging info:</B><br>" . "Datei: " . $_FILES['userfile']['name'] . "<br>Typ: " . $_FILES['userfile']['type'] . "<br>Größe: " . $_FILES['userfile']['size'] . " Byte";
+ print "</td></tr><tr><td colspan=5>&nbsp;</td></tr>";
+ print "<tr><td class=text><a href=get_user.php?".SID.">Zum Datenbankupload...</a></td></tr>";
+}
+elseif (isset($_POST['upload']))
+{
+ print "<tr><td class=text>Datei ist fehlerhaft oder keine EXCEL-DATEI und wurde nicht hochgeladen.<br>";
+ print "<B>Debugging info:</B><br>" . "Datei: " . $_FILES['userfile']['name'] . "<br>Typ: " . $_FILES['userfile']['type'] . "<br>Größe: " . $_FILES['userfile']['size'] . " Byte";
+}
+?>
+
+</table>
+
+ </td>
+</tr>
+</table>
+</table>
+
+
+<?
+include("../footer.php");
+?> \ No newline at end of file