first commit
This commit is contained in:
361
admin/mail.php
Executable file
361
admin/mail.php
Executable file
@ -0,0 +1,361 @@
|
||||
<?php
|
||||
include("kurs/datenbankanbindung.php"); // fügt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
|
||||
|
||||
$db = dbconnect();
|
||||
$ansp = $db->query("SELECT wert1, wert2 FROM parameter WHERE pid='2'");
|
||||
$uhd = $ansp->fetch_array();
|
||||
$ansprechpart = "$uhd[wert1]"; // Ansprechpartner bei Probleme
|
||||
$helpmail = "$uhd[wert2]"; // Kontaktmailadresse bei Problemen
|
||||
$subject = "Mailfehler: Mailsystem Fachprojekt - Adminbereich";
|
||||
|
||||
$user_admin=$_COOKIE["user_admin"];
|
||||
|
||||
// Rechteüberprüfung
|
||||
$db = dbconnect();
|
||||
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
|
||||
$result = $db->query("SELECT 1 FROM fach_admin_rechte, fach_admin_rechte_zuord , fach_admin where fach_admin_rechte.fach_admin_rolle = fach_admin_rechte_zuord.fach_admin_rolle AND fach_admin_rechte_zuord.faid = fach_admin.faid AND fach_admin.user = '$user_admin' AND fach_admin_rechte_zuord.fach_admin_rolle = 'a_mail'");
|
||||
$row = $result->fetch_array();
|
||||
if ($row[0] != 1){ include("kurs/rechte.php"); exit;}
|
||||
// Rechteüberprüfung ende
|
||||
|
||||
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>Studentenjahrgang wählen</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\"></td>
|
||||
<td width=\"95%\" background=\"../images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Empfängerjahrgang wählen</font><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>
|
||||
<form action="; echo $_SERVER['PHP_SELF'] . "?action=ausgabe1"; echo" method=\"POST\" name=\"passback\">";
|
||||
$db = dbconnect();
|
||||
$query = "SELECT Jahrgang FROM stud GROUP BY Jahrgang";
|
||||
$result = $db->query ($query)
|
||||
or die ("Cannot execute query");
|
||||
echo "<p align=\"center\"><select size=\"5\" name=\"jahr_mail\">
|
||||
<option value=\"%\">alle </option>";
|
||||
while ($row = $result->fetch_array()){
|
||||
echo "<option value=\"".$row['Jahrgang']."\">".$row['Jahrgang']." </option>\n";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "
|
||||
<br>
|
||||
<br>
|
||||
<p align=\"center\">
|
||||
<input type=\"submit\" value=\"Abschicken\" name=\"B1\"> </p>
|
||||
</form>
|
||||
<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>";
|
||||
|
||||
break;
|
||||
case "ausgabe1":
|
||||
|
||||
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>Mail an Wahlpflichtfach</title>
|
||||
</head>
|
||||
<body onload=\"if(document.Mail)document.Mail.sender.focus();return false;\">
|
||||
<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=\"100%\" border=\"0\">
|
||||
<tr>
|
||||
<td align=\"left\" width=\"1%\" width=\"10\" background=\"../images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
|
||||
<td align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\" colspan=\"2\">
|
||||
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>";
|
||||
if ($jahr_mail != "%"){
|
||||
echo"
|
||||
<font class=\"hd\">Mail an Jahrgang $jahr_mail</font><br>";
|
||||
} else {
|
||||
echo"
|
||||
<font class=\"hd\">Mail an alle Jahrgänge</font><br>";
|
||||
}
|
||||
echo"
|
||||
<img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
|
||||
<td 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\">
|
||||
<form action="; echo $_SERVER['PHP_SELF'] . "?action=ausgabe2"; echo" method=\"POST\" name=\"Mail\">
|
||||
<table width=\"100%\" border=\"0\">
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"><b>Absender:</b></td>
|
||||
<td width=\"70%\" valign=\"top\"><input name=\"sender\" type=\"text\" id=\"sender\" size=\"66\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"><b>Mail-Adresse Absender:</b></td>
|
||||
<td width=\"70%\" valign=\"top\"><input name=\"sendermail\" type=\"text\" id=\"sendermail\" size=\"66\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"><b>Mail-Adresse Empfänger:</b></td>
|
||||
<td width=\"70%\" valign=\"top\">";
|
||||
$db = dbconnect();
|
||||
|
||||
// hidden Button Anfang
|
||||
$result = $db->query("SELECT mail
|
||||
FROM stud
|
||||
WHERE Jahrgang LIKE \"". $_POST['jahr_mail']."\"
|
||||
AND durchgefallen!=\"Y\"
|
||||
AND hs='L'
|
||||
ORDER BY mail asc"); // $result= Alle Studenten, die das ausgewählte Wpf belegt haben
|
||||
echo"<input type=\"hidden\" name=\"empfaenger\" id=\"empfaenger\" size=\"66\" value=\"";
|
||||
while ($row = $result->fetch_array()){ // While Schleife für hidden Button im Value (Vorgabewert) hidden, damit man nichts verändern kann
|
||||
echo"$row[0], ";
|
||||
}
|
||||
echo"\">";
|
||||
// hidden Button Ende
|
||||
|
||||
// Ausgabe der Mailadressen auf dem Bildschirm
|
||||
if ( $res_menge=$db->query("SELECT count('mail')
|
||||
FROM stud
|
||||
WHERE Jahrgang LIKE \"". $_POST['jahr_mail']."\"
|
||||
AND hs='L'
|
||||
AND durchgefallen!=\"Y\"") ){
|
||||
if ( $row_menge=$res_menge->fetch_array() ) {
|
||||
$anzahl=$row_menge[0];
|
||||
} else $anzahl=0;
|
||||
} else $anzahl=0;
|
||||
|
||||
|
||||
if ($_POST[jahr_mail] != "%"){
|
||||
echo "Jahrgang: $_POST[jahr_mail] ($anzahl Mailadressen)";
|
||||
} else {
|
||||
echo "Alle Jahrgänge ($anzahl Mailadressen)";
|
||||
}
|
||||
// Ausgabe Ende
|
||||
|
||||
|
||||
echo"
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"><b>Betreff:</b></td>
|
||||
<td width=\"70%\" valign=\"top\"><input name=\"betreff\" type=\"text\" id=\"betreff\" size=\"66\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"><b>Nachricht:</b></td>
|
||||
<td width=\"70%\" valign=\"top\"><textarea name=\"text\" cols=\"50\" rows=\"10\" id=\"text\"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"30%\" valign=\"top\"> </td>
|
||||
<td width=\"70%\" valign=\"top\"><input type=checkbox NAME=\"kopie\">Kopie der Mail erhalten</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\">
|
||||
</form>
|
||||
</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>";
|
||||
|
||||
|
||||
break;
|
||||
case "ausgabe2":
|
||||
|
||||
$empfaenger = $_POST['empfaenger'];
|
||||
$betreff = $_POST['betreff'];
|
||||
$text = $_POST['text'];
|
||||
$sender = $_POST['sender'];
|
||||
$sendermail = $_POST['sendermail'];
|
||||
$kopie = $_POST['kopie'];
|
||||
|
||||
// Emailversand:
|
||||
if ($kopie)
|
||||
{
|
||||
$empfaenger .= $sendermail;
|
||||
}
|
||||
|
||||
$headers = "MIME-Version: 1.0\n";
|
||||
$headers .= "Content-type: text/html; charset=utf-8\n";
|
||||
$headers .= "From: $sender <$sendermail>\n";
|
||||
$headers .= "Bcc: $empfaenger\n";
|
||||
|
||||
$return = @mail(NULL, $betreff, $text, $headers);
|
||||
|
||||
// Bestätigungsseite
|
||||
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>Mailversand</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\"></td>
|
||||
<td width=\"95%\" background=\"../images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Mailversand erfolgreich</font><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>Die E-Mail wurde verschickt!</b>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p align=\"center\"><a href=\"hauptframe_jahr.php\">
|
||||
<img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
|
||||
</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>";
|
||||
} 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>Mailversand</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\"></td>
|
||||
<td width=\"95%\" background=\"../images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Mailversand fehlgeschlagen</font><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\">Die E-Mail wurde <b>nicht</b> verschickt!<br>
|
||||
Eine oder mehrere Mailadressen innerhalb des Empfängerkreises sind ungültig!<br>
|
||||
<br>
|
||||
Bei Fragen wenden Sie sich bitte an <a href=\"mailto:$helpmail?subject=$subject\">$ansprechpart</a>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p align=\"center\"><a href=\"javascript:history.back()\">
|
||||
<img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
|
||||
</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>";
|
||||
} //End if
|
||||
|
||||
} //Ende Action Abfrage
|
||||
?>
|
Reference in New Issue
Block a user