Kompetenz/index_db.php
2023-04-25 13:13:17 +02:00

562 lines
23 KiB
PHP
Executable File

<?php
include("kurs/datenbankanbindung.php"); // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
$db = dbconnect();
$ansp = $db->query("SELECT wert1, wert2 FROM parameter WHERE pid='1'");
$uhd = $ansp->fetch_array();
$ansprechpart = "$uhd[wert1]"; // Ansprechpartner bei Probleme
$helpmail = "$uhd[wert2]"; // Kontaktmailadresse bei Problemen
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
switch($action){
default:
echo"
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzsystem</title>
</head>
<body onload=\"if(document.login)document.login.uid.focus();return false;\">
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td height=\"30\">&nbsp;</td>
</tr>
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<font class=\"hd\">
Login Soziale Kompetenzen</font><br>
<span class=\"sh\">
Im System k&ouml;nnen Sie Ihr Soziale Kompetenz w&auml;hlen</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p><b>Folgende Loginkriterien sind zu beachten:</b> </p>
<ul>
<li>Der Benutzername entspricht dem Loginnamen in der Hochschule</li>
<li>Das Passwort entspricht dem, des Kursbelegungssystems</li>
<li>Der Benutzername darf <b>keine</b> Zus&auml;tze enthalten (.stud04 usw.)</li>
<li>Das Passwort entspricht - bis zum &Auml;ndern - dem Benutzernamen<br></li>
</ul>
<p></p>
<p></p>
<p></p>
<p></p>
<form action="; echo $_SERVER['PHP_SELF'] . "?action=anmeld"; echo" method=\"POST\" name=\"login\">
<input type=\"hidden\" name=\"tparam\" value=\"945180225\">
<table cellspacing=\"1\" cellpadding=\"1\" width=\"100%\" border=\"0\">
<tr>
<td class=\"formdesc\">
Benutzername
</td>
<td>
<input type=\"text\" name=\"uid\" value size=\"20\" maxlength=\"60\" tabindex=\"1\" onchange=\"document.login.pwd.focus()\"></td>
</tr>
<tr>
<td class=\"formdesc\">
Passwort
</td>
<td>
<input type=\"password\" name=\"pwd\" size=\"20\" tabindex=\"2\"></td>
</tr>
<tr class=\"login\">
<td align=\"right\" colspan=\"2\">
<input title=\"Login\" type=\"image\" src=\"images/b_login.gif\" border=\"0\"></td>
</tr>
</table>
</form>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
<p><br>
&nbsp;</p>
</div>
</td>
</tr>
</table>
</body>
</html>";
break;
case "anmeld":
$uid = strtolower($_POST[uid]);
$pwd = $_POST[pwd];
$db = dbconnect();
$result = $db->query("SELECT LOWER(uid) uid, Pwd FROM stud where uid=\"$uid\"");
$row = $result->fetch_array();
// Abfrage, was tun wenn Felder leer sind bzw. Passwort falsch ist
if ($uid == "" or $_POST['pwd'] == "")
{
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzsystem</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Fehlerhafte Eingabe </span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Es m&uuml;ssen alle Felder ausgef&uuml;llt werden</b>
</p>
<p align=\"center\"><a href=\"index.php\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
";
exit;
}
if ($uid != $row[uid]) {
echo"
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzsystem</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Falscher Benutzername</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Der Anmeldenamen ist im System nicht vorhanden!<br>
Wenden Sie sich bitte an
<a href=\"mailto:$_POST[helpmail]?subject=Keine Anmeldekennung\">$_POST[ansprechpart]</a></b></p>
<p align=\"center\"><a href=\"index.php\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
";
exit;
}
$passwd = md5($_POST['pwd']);
if ($passwd != $row[Pwd]){
// Cokkie hier, falls PW generiert werden soll
setcookie("uid1","");
setcookie("uid1","$row[uid]");
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzsystem</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Falsches Passwort</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Das eingegebene Passwort ist falsch!</b><br><br>
Sie k&ouml;nnen sich ein neues Passwort an Ihre<br>FH-Mailadresse schicken lassen: <a href="; echo $_SERVER['PHP_SELF'] . "?action=pass_gen>Neues Passwort</a>
<br>
<br>
Bei weiteren Problemen wenden Sie sich bitte<br>
an <a href=\"mailto:$_POST[helpmail]?subject=Keine Anmeldekennung\">$_POST[ansprechpart]</a></b></p>
<p align=\"center\"><a href=\"index.php\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>";
exit;
}
setcookie("uid1","");
setcookie("uid1","$row[uid]");
echo "
<meta http-equiv=\"refresh\" content=\"0; URL=index_frame.htm\">
";
break;
case "pass_gen":
$uid1=$_COOKIE["uid1"];
$pool = "qwertzupasdfghkyxcvbnm";
$pool .= "23456789";
$pool .= "WERTZUPLKJHGFDSAYXCVBNM";
srand ((double)microtime()*1000000);
for($index = 0; $index < 7; $index++)
{
$pass_word .= substr($pool,(rand()%(strlen ($pool))), 1);
}
$new_pw_md5=md5($pass_word);
$sql = $db->query ("UPDATE stud SET pwd='$new_pw_md5' WHERE uid='$uid1'");
// Nachricht &uuml;ber Passwortr&uuml;cksetzung: Hinzugef&uuml;gt 19.09.2006
$result2 = $db->query("SELECT uid, vorname, nachname, mail FROM stud where uid='$uid1'");
$row2 = $result2->fetch_array();
$empfaenger = "$row2[mail]";
$betreff = "Kurssystem: Passwort zur&uuml;ckgesetzt";
$text = "
<html>
<head>
<title>Passwort zur&uuml;ckgesetzt</title>
</head>
<body>
<font face='Arial' size='2'>
Guten Tag $row2[vorname] $row2[nachname]!<br><br>
Sie haben Ihr Passwort im Kurssystem zur&uuml;ckgesetzt!<br>
Nachfolgend finden Sie Ihre neuen Zugangsdaten:
<br>
<br>
<table>
<tr>
<td valign='top'>
<font face='Arial' size='2'>
Benutzerkennung:
</font>
</td>
<td valign='top'>
<font face='Arial' size='2'>
<b>$row2[uid]</b>
</font>
</td>
</tr>
<tr>
<td valign='top'>
<font face='Arial' size='2'>
Passwort:
</font>
</td>
<td valign='top'>
<font face='Arial' size='2'>
<b>$pass_word</b>
</font>
</td>
</tr>
</table>
<br>
Bitte beachten Sie, dass zwischen Gro&szlig;- und<br>
Kleinschreibung unterschieden wird.
<p>
&Auml;ndern Sie bitte zu Ihrer eigenen Sicherheit das<br>
Passwort nach dem ersten Login.
<p>
Link zum Anmeldesystem: <a href=\"https://www.fh-ludwigsburg.de/kurs\">Kurssystem</a>
<p>
Diese Mail wurde automatisch generiert!<br>
Antworten Sie daher nicht auf diese Mail<br>
<br>
Vielen Dank
</body>
</html>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$return = @mail($empfaenger, $betreff, $text, $headers);
// ENDE Nachricht &uuml;ber Passwortr&uuml;cksetzung
if($return){
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzfachsystem</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Best&auml;tigung</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Mailversand!</b><br><br>
Ihr neues Passwort wurde an $row2[mail] geschickt.
<p align=\"center\"><a href=\"index.php\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>";
exit;
}else{
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
<title>Login Soziale Kompetenzfachsystem</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
<tr>
<td>
<div align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
<tr>
<td width=\"10\" background=\"images/box_e1.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"images/box_top.gif\" valign=\"top\">
<img src=\"images/i_login.gif\"></td>
<td width=\"95%\" background=\"images/box_top.gif\">
<img height=\"10\" src=\"images/blank.gif\" width=\"1\"><br>
<span class=\"sh\">Versandfehler</span><br>
<img height=\"5\" src=\"images/blank.gif\" width=\"1\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e2.gif\">
<img height=\"40\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td width=\"1%\" background=\"images/box_l.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
<td colspan=\"2\"><br>
<p align=\"center\"><b>Versandfehler!</b><br><br>
Das Passwort konnte nicht verschickt werden!
<br>
<br>
Bitte wenden Sie sich an <a href=\"mailto:$_POST[helpmail]?subject=Keine Anmeldekennung\">$_POST[ansprechpart]</a></p>
<p align=\"center\"><a href=\"index.php\">
<img border=\"0\" src=\"images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><br>
</p>
</td>
<td width=\"1%\" background=\"images/box_r.gif\">
<img height=\"1\" src=\"images/blank.gif\" width=\"22\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"images/box_e3.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"></td>
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"images/box_bottom.gif\" colspan=\"2\">
<img height=\"16\" src=\"images/blank.gif\" width=\"8\"></td>
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"images/box_e4.gif\">
<img height=\"16\" src=\"images/blank.gif\" width=\"22\"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>";
exit;
}
} // Ende IF von Action Abfrage
?>