Initial commit
This commit is contained in:
91
systemmail.php
Normal file
91
systemmail.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/*
|
||||
# Fuer debugging
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
#echo __LINE__."<br>";
|
||||
*/
|
||||
|
||||
include_once 'classes/lg-on_Smarty.class.php';
|
||||
$smarty = new lgon_Smarty();
|
||||
require_once("config.inc.php");
|
||||
require_once("func_rollenrechte.php");
|
||||
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
|
||||
require_once "language/german.inc.php";
|
||||
|
||||
// Rechteüberprüfung
|
||||
$db = dbconnect();
|
||||
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
|
||||
if(!rore($user_admin,'a_sysmail','RE')){require("lib/rechte.php");exit;}
|
||||
// Rechteüberprüfung ende
|
||||
|
||||
if(isset($_GET['action'])){
|
||||
$action = $_GET['action'];
|
||||
}else{
|
||||
$action = '';
|
||||
}
|
||||
if($action == ''){
|
||||
|
||||
$db = dbconnect();
|
||||
$result = $db->query("SELECT vorname, nachname, mail FROM admin WHERE user = '$user_admin'");
|
||||
$row = $result->fetch_array();
|
||||
|
||||
$smarty->assign('systemmail_vorname', "$row[vorname]");
|
||||
$smarty->assign('systemmail_nachname', "$row[nachname]");
|
||||
$smarty->assign('systemmail_mail', "$row[mail]");
|
||||
|
||||
$db = dbconnect();
|
||||
$query = "SELECT vorname, nachname, mail
|
||||
FROM admin
|
||||
ORDER BY nachname ASC
|
||||
";
|
||||
$result = $db->query( $query)
|
||||
or die ("Cannot execute query");
|
||||
|
||||
while ($row = $result->fetch_array()){
|
||||
$value[] = $row;
|
||||
}
|
||||
$smarty->assign('table_data', $value);
|
||||
}
|
||||
|
||||
|
||||
if($action == 'ausgabe2'){
|
||||
$empfaenger = $_POST['empfaenger'];
|
||||
$empfaenger1 = "";
|
||||
for ($i=0;$i<sizeof($empfaenger);$i++) {
|
||||
$empfaenger1 .= "$empfaenger[$i], ";
|
||||
}
|
||||
|
||||
$empfaenger = substr($empfaenger1,0,-2); // letzte Zwei Zeichen abschneiden: '...@xyz.de, ' --> '...@xyz.de'
|
||||
$betreff = $_POST['betreff'];
|
||||
$text = stripslashes( $_POST['inhalt'] );
|
||||
$sender = $_POST['sender'];
|
||||
$sendermail = $_POST['sendermail'];
|
||||
|
||||
if($empfaenger == '' OR $betreff == '' OR $text == '' OR $sender == '' OR $sendermail == ''){
|
||||
$smarty->assign('systemmail_mandatory', "1");
|
||||
}else{
|
||||
|
||||
// für HTML-E-Mails muss der 'Content-type'-Header gesetzt werden
|
||||
|
||||
## Mailversand:
|
||||
$headers = "MIME-Version: 1.0\n";
|
||||
#$headers .= "Content-type: text/html; charset=iso-8859-1\n";
|
||||
$headers .= "Content-type: text/html; charset=utf-8\n";
|
||||
$headers .= "From: $sender <$sendermail>\n";
|
||||
#$headers .= "Bcc: $empfaenger\n";
|
||||
|
||||
$return = @mail($empfaenger, $betreff, $text, $headers);
|
||||
|
||||
// Bestätigungsseite
|
||||
if ($return){
|
||||
$smarty->assign('systemmail_success', "1");
|
||||
}else{
|
||||
$smarty->assign('systemmail_success', "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('action', "$action");
|
||||
$smarty->display("$template/$templatename");
|
||||
?>
|
Reference in New Issue
Block a user