diff options
Diffstat (limited to 'admin/user.php')
-rwxr-xr-x | admin/user.php | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/admin/user.php b/admin/user.php new file mode 100755 index 00000000..54e31ceb --- /dev/null +++ b/admin/user.php @@ -0,0 +1,249 @@ +<?PHP + +$title = "User-Liste"; +$header = "Editieren der Engelliste"; +include ("./inc/header.php"); +include ("./inc/funktion_db_list.php"); + +if (!IsSet($enterUID)){ + + // Userliste, keine UID uebergeben... + + echo "<a href=\"../makeuser.php\">Neuen Engel eintragen</a><br><br>\n\n"; + + if( !isset($OrderBy) ) $OrderBy = "Nick"; + $SQL = "SELECT * FROM User ORDER BY ". $OrderBy. " ASC"; + $Erg = mysql_query($SQL, $con); + echo mysql_error($con); + + // anzahl zeilen + $Zeilen = mysql_num_rows($Erg); + + echo "Anzahl Engel: $Zeilen<br><br>"; + + ?> + <table width="100%" class="border" cellpadding="2" cellspacing="1"> + <tr class="contenttopic"> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Nick">Nick</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Name">Name</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Vorname">Vorname</a></td> + <td>Alter</td> + <td>Telefon <a href="<? echo $PHP_SELF; ?>?OrderBy=email">@</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Size">Größe</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Gekommen">G</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Aktiv">A</a></td> + <td><a href="<? echo $PHP_SELF; ?>?OrderBy=Tshirt">T</a></td> + <td>Änd.</td> + <td>Secure</td> + </tr> + <? + $Gekommen = 0; + $Active = 0; + $Tshirt = 0; + + for ($n = 0 ; $n < $Zeilen ; $n++) { + echo " <tr class=\"content\">\n"; + echo " <td>".mysql_result($Erg, $n, "Nick"). "</td>\n"; + echo " <td>".mysql_result($Erg, $n, "Name")."</td>\n"; + echo " <td>".mysql_result($Erg, $n, "Vorname")."</td>\n"; + echo " <td>".mysql_result($Erg, $n, "Alter")."</td>\n"; + echo " <td>"; + if( strlen( mysql_result($Erg, $n, "Telefon"))>0) + echo "Tel: ". mysql_result($Erg, $n, "Telefon"). "<br>"; + if( strlen( mysql_result($Erg, $n, "Handy"))>0) + echo "Handy: ". mysql_result($Erg, $n, "Handy"). "<br>"; + if( strlen( mysql_result($Erg, $n, "DECT"))>0) + echo "<a href=\"./dect.php?custum=". mysql_result($Erg, $n, "DECT"). "\">DECT: </a>". + mysql_result($Erg, $n, "DECT"). "<br>"; + $Mail = mysql_result($Erg, $n, "email"); +// if( strlen($Mail) > 15 ) +// $Mail = substr($Mail, 0, 12). "..."; + if( strlen( $Mail)>0) + echo "email: <a href=\"mailto:".mysql_result($Erg, $n, "email")."\">$Mail</a>\n"; + echo "</td>\n"; + echo " <td>".mysql_result($Erg, $n, "Size")."</td>\n"; + $Gekommen += mysql_result($Erg, $n, "Gekommen"); + echo " <td>".mysql_result($Erg, $n, "Gekommen")."</td>\n"; + $Active += mysql_result($Erg, $n, "Aktiv"); + echo " <td>".mysql_result($Erg, $n, "Aktiv")."</td>\n"; + $Tshirt += mysql_result($Erg, $n, "Tshirt"); + echo " <td>".mysql_result($Erg, $n, "Tshirt")."</td>\n"; + echo " <td><a href=\"./user.php?enterUID=". + mysql_result($Erg, $n, "UID")."&Type=Normal\">Änd.</a></td>\n"; + echo " <td>"; + //check userCVS=OK + $SQL2 = "SELECT UID FROM UserCVS WHERE (UID=". mysql_result($Erg, $n, "UID"). ")"; + $Erg2 = mysql_query($SQL2, $con); + echo mysql_error($con); + if( mysql_num_rows($Erg2)==0) + { + $SQL3 = "INSERT INTO `UserCVS` ( `UID`) VALUES ( '". mysql_result($Erg, $n, "UID"). "');"; + $Erg3 = mysql_query($SQL3, $con); + if( $Erg3 ) + echo "was create<br>\n"; + else + echo mysql_error($con); + } + echo "<a href=\"./user.php?enterUID=". + mysql_result($Erg, $n, "UID")."&Type=Secure\">Secure</a></td>\n"; + echo " </tr>\n"; + } + echo "<tr>". + "<td></td><td></td><td></td><td></td><td></td><td></td>". + "<td>$Gekommen</td><td>$Active</td><td>$Tshirt</td><td></td></tr>\n"; + echo "\t</table>\n"; + // Ende Userliste +} +else +{ + // UserID wurde mit uebergeben --> Aendern... + + $SQL = "SELECT * FROM User where UID=$enterUID"; + $Erg = mysql_query($SQL, $con); + + $anzahl = mysql_num_rows($Erg); + + if ($anzahl != 1) + echo "Sorry, der Engel (UID=$enterUID) wurde in der Liste nicht gefunden."; + else + { + echo "Hallo,<br>". + "hier kannst du den Eintrag ändern. Unter dem Punkt 'Gekommen' ". + "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, ". + "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. ". + "Wenn T-Shirt ein 'Ja' enthält, bedeutet dies, dass der Engel ". + "bereits sein T-Shirt erhalten hat.<br><br>\n"; + + echo "<form action=\"./user2.php?action=change\" method=\"POST\">\n"; + echo "<table>\n"; + echo "<input type=\"hidden\" name=\"Type\" value=\"$Type\">\n"; + + if( $Type == "Normal" ) + { + echo " <tr><td>Nick</td><td>". + "<input type=\"text\" size=\"40\" name=\"eNick\" value=\"". + mysql_result($Erg, 0, "Nick")."\"></td></tr>\n"; + echo " <tr><td>lastLogIn</td><td>". + "<input type=\"text\" size=\"20\" name=\"elastLogIn\" value=\"". + mysql_result($Erg, 0, "lastLogIn"). "\" disabled></td></tr>\n"; + echo " <tr><td>Name</td><td>". + "<input type=\"text\" size=\"40\" name=\"eName\" value=\"". + mysql_result($Erg, 0, "Name")."\"></td></tr>\n"; + echo " <tr><td>Vorname</td><td>". + "<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"". + mysql_result($Erg, 0, "Vorname")."\"></td></tr>\n"; + echo " <tr><td>Alter</td><td>". + "<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"". + mysql_result($Erg, 0, "Alter")."\"></td></tr>\n"; + echo " <tr><td>Telefon</td><td>". + "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"". + mysql_result($Erg, 0, "Telefon")."\"></td></tr>\n"; + echo " <tr><td>Handy</td><td>". + "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"". + mysql_result($Erg, 0, "Handy")."\"></td></tr>\n"; + echo " <tr><td>DECT</td><td>". + "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"". + mysql_result($Erg, 0, "DECT")."\"></td></tr>\n"; + echo " <tr><td>email</td><td>". + "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"". + mysql_result($Erg, 0, "email")."\"></td></tr>\n"; + echo " <tr><td>Size</td><td>". + "<input type=\"text\" size=\"5\" name=\"eSize\" value=\"". + mysql_result($Erg, 0, "Size")."\"></td></tr>\n"; + echo " <tr><td>Passwort</td><td>". + "<input type=\"text\" size=\"40\" name=\"ePasswort\" value=\"". + mysql_result($Erg, 0, "Passwort")."\" disabled> ". + "<a href=\"./user2.php?action=newpw&eUID=" + .mysql_result($Erg, 0, "UID")."\">neues Kennwort setzen</a></td></tr>\n"; + + // Gekommen? + echo " <tr><td>Gekommen</td><td>\n"; + echo " <input type=\"radio\" name=\"eGekommen\" value=\"0\""; + if (mysql_result($Erg, 0, "Gekommen")=='0') + echo " checked"; + echo ">No \n"; + echo " <input type=\"radio\" name=\"eGekommen\" value=\"1\""; + if (mysql_result($Erg, 0, "Gekommen")=='1') + echo " checked"; + echo ">Yes \n"; + echo "</td></tr>\n"; + + // Aktiv? + echo " <tr><td>Aktiv</td><td>\n"; + echo " <input type=\"radio\" name=\"eAktiv\" value=\"0\""; + if (mysql_result($Erg, 0, "Aktiv")=='0') + echo " checked"; + echo ">No \n"; + echo " <input type=\"radio\" name=\"eAktiv\" value=\"1\""; + if (mysql_result($Erg, 0, "Aktiv")=='1') + echo " checked"; + echo ">Yes \n"; + echo "</td></tr>\n"; + + // T-Shirt bekommen? + echo " <tr><td>T-Shirt</td><td>\n"; + echo " <input type=\"radio\" name=\"eTshirt\" value=\"0\""; + if (mysql_result($Erg, 0, "Tshirt")=='0') + echo " checked"; + echo ">No \n"; + echo " <input type=\"radio\" name=\"eTshirt\" value=\"1\""; + if (mysql_result($Erg, 0, "Tshirt")=='1') + echo " checked"; + echo ">Yes \n"; + echo "</td></tr>\n"; + } //IF TYPE + + if( $Type == "Secure" ) + { + // CVS-Rechte + echo " <tr><td><br><u>Rights of \"". mysql_result($Erg, 0, "Nick"). "\":</u></td></tr>\n"; + + $SQL_CVS = "SELECT * FROM `UserCVS` WHERE UID=$enterUID"; + $Erg_CVS = mysql_query($SQL_CVS, $con); + $CVS_Data = mysql_fetch_array($Erg_CVS); + $CVS_Data_i = 1; + foreach ($CVS_Data as $CVS_Data_Name => $CVS_Data_Value) + { + $CVS_Data_i++; + //nur jeder zweiter sonst wird für jeden text noch die position (Zahl) ausgegeben + if( $CVS_Data_i%2 && $CVS_Data_Name!="UID") + { + echo "<tr><td>$CVS_Data_Name</td>\n<td>"; + echo "<input type=\"radio\" name=\"".($CVS_Data_i-1)."\" value=\"Y\" "; + if( $CVS_Data_Value == "Y" ) + echo " checked"; + echo ">allow \n"; + echo "<input type=\"radio\" name=\"".($CVS_Data_i-1)."\" value=\"N\" "; + if( $CVS_Data_Value == "N" ) + echo " checked"; + echo ">denied \n"; + echo "</td></tr>"; + } //IF + } //Foreach + echo "</td></tr>\n"; + } // IF TYPE + + + // Ende Formular + echo "</td></tr>\n"; + echo "</table>\n"; + echo "<input type=\"hidden\" name=\"enterUID\" value=\"$enterUID\">\n"; + echo "<input type=\"submit\" value=\"sichern...\">\n"; + echo "</form>"; + + if( $Type == "Normal" ) + { + echo "<form action=\"./user2.php?action=delete\" method=\"POST\">\n"; + echo "<input type=\"hidden\" name=\"enterUID\" value=\"$enterUID\">\n"; + echo "<input type=\"submit\" value=\"löschen...\">\n"; + echo "</form>"; + } + + } + +} + +include ("./inc/footer.php"); +?> + + |