first commit
This commit is contained in:
97
upload/#test.html
Executable file
97
upload/#test.html
Executable file
@ -0,0 +1,97 @@
|
||||
|
||||
<html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<link rel="stylesheet" href="../../templates/standard/css/styles_pc.php" type="text/css">
|
||||
<title>Excel Upload</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/component.css" />
|
||||
<!--[if IE]>
|
||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- remove this if you use Modernizr -->
|
||||
<script>(function(e,t,n){var r=e.querySelectorAll("html")[0];r.className=r.className.replace(/(^|\s)no-js(\s|$)/,"$1js$2")})(document,window,0);</script>
|
||||
</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" allign="center" width="60%" border="0">
|
||||
<tr>
|
||||
<td width="10" background="../../templates/standard/images/box_e1.gif">
|
||||
<img height="40" src="../../templates/standard/images/blank.gif" width="22"></td>
|
||||
<td nowrap="nowrap" align="left" width="98%" background="../../templates/standard/images/box_top.gif" valign="top">
|
||||
<img height="10" src="../../templates/standard/images/blank.gif" width="1"><br>
|
||||
<font class="hd">Excel Upload</font><br>
|
||||
<span class="sh">Import eines Studienjahrgangs.</span><br>
|
||||
<span class="sh"><b>Erlaubte Dateiendungen: *.xls; *.xlsx</b></span>
|
||||
<img height="5" src="../../templates/standard/images/blank.gif" width="1"></font></td>
|
||||
<td nowrap="nowrap" align="right" width="1%" background="../../templates/standard/images/box_e2.gif">
|
||||
<img height="40" src="../../templates/standard/images/blank.gif" width="22"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="1%" background="../../templates/standard/images/box_l.gif">
|
||||
<img height="1" src="../../templates/standard/images/blank.gif" width="22"></td>
|
||||
<td>
|
||||
<form action='/ateliers/admin/import/index.php?action=csvimp' enctype="multipart/form-data" method='post'>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
|
||||
<tr>
|
||||
<td width="100%"align="center" >
|
||||
<br>
|
||||
<br>
|
||||
<div class="box">
|
||||
<input type="file" name="file" id="file-5" class="inputfile inputfile-4" />
|
||||
<label for="file-5"><figure><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg></figure> <span style='float:center;'>Excel-Datei auswählen…<br>(hier klicken)</span></label>
|
||||
</div>
|
||||
<script src="js/custom-file-input.js"></script>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" align="center" colspan="2">
|
||||
<input type="submit" value="Excel-Hochladen…" name="B1" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" align="center" colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" align="center" colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" align="center" colspan="2">
|
||||
<a href='Sch<63>lerimport_Beispiele.xlsx' target='_new'>Musterdatei downloaden</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
<td width="1%" background="../../templates/standard/images/box_r.gif">
|
||||
<img height="1" src="../../templates/standard/images/blank.gif" width="22"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap" align="left" width="1%" background="../../templates/standard/images/box_e3.gif">
|
||||
<img height="16" src="../../templates/standard/images/blank.gif" width="22">
|
||||
</td>
|
||||
<td nowrap="nowrap" align="left" width="98%" background="../../templates/standard/images/box_bottom.gif">
|
||||
<img height="16" src="../../templates/standard/images/blank.gif" width="8">
|
||||
</td>
|
||||
<td nowrap="nowrap" align="right" width="1%" background="../../templates/standard/images/box_e4.gif">
|
||||
<img height="16" src="../../templates/standard/images/blank.gif" width="22">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
23
upload/#test.php
Executable file
23
upload/#test.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 30.01.2010 by Nico Schubert
|
||||
*/
|
||||
$dir = $_SERVER["DOCUMENT_ROOT"].dirname($_SERVER['PHP_SELF']).'/upload/';
|
||||
|
||||
$folder = dir($dir);
|
||||
while ($dateiname = $folder->read()) {
|
||||
if (filetype($dir.$dateiname) != "dir") {
|
||||
if (strtotime("-2 weeks") >
|
||||
@filemtime($dir.$dateiname)) {
|
||||
if (@unlink($dir.$dateiname) != false){
|
||||
# echo $dateiname.' wurde gelöscht<br>';
|
||||
}else{
|
||||
# echo $dateiname.' konnte nichtgelöscht werden<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# echo "Fertig";
|
||||
$folder->close();
|
||||
exit;
|
||||
?>
|
955
upload/#upload.php
Executable file
955
upload/#upload.php
Executable file
@ -0,0 +1,955 @@
|
||||
<?php
|
||||
require_once("../../config.inc.php");
|
||||
require_once("../func_rollenrechte.php");
|
||||
require_once "func_genUser_schueler.php";
|
||||
require_once('../excel/Classes/PHPExcel/IOFactory.php');
|
||||
#########Konfiguration#######################################
|
||||
$verz = "upload/"; // relatives Uploadverzeichnis (relativ zum 'Standort' dieser Datei, wohin die Dateien kopiert werden sollen
|
||||
$trennzeichen_excel = ";"; // Das Trennzeichen das Excel für CVS-Dateien nimmt ist je nach Excelversion unterschiedlich:
|
||||
// Entweder $trennzeichen_excel = ";"; --> Semikolon
|
||||
// oder $trennzeichen_excel = ","; --> Komma
|
||||
#############################################################
|
||||
|
||||
############
|
||||
##
|
||||
## 13.09.2011: Änderung des Passwortformats von dd.mm.jjjj auf ddmmjjjj weil auf der Loginseite das so angegeben ist.
|
||||
##
|
||||
############
|
||||
|
||||
|
||||
setcookie("ck_verz", "$verz"); // Verzeichnis in Cookie speichern
|
||||
|
||||
|
||||
// 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_import', 'RE')) {
|
||||
echo "Keine Rechte";
|
||||
exit;
|
||||
}
|
||||
// Rechteüberprüfung ende
|
||||
|
||||
|
||||
if (isset($_GET['action']))
|
||||
$action = $_GET['action'];
|
||||
else
|
||||
$action = "";
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
|
||||
$heute = mktime(0, 0, 0, date("m"), date("d"), date("Y")); // heutiges Datum
|
||||
$heute_format = date("Y-m-d", $heute); // ISO-8601 Format wie in der Datenbank: Formatierung für Vergleiche erforderlich
|
||||
|
||||
function deleteFiles($verz)
|
||||
{
|
||||
$handle = opendir($verz);
|
||||
while ($file = readdir($handle)) {
|
||||
if ($file != "." && $file != "..") {
|
||||
|
||||
$datei = $verz . $file;
|
||||
|
||||
if (@unlink($datei)) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$error = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $error;
|
||||
}
|
||||
|
||||
deleteFiles($verz); // Dateien werden im Uploadverzeichnis gelöscht, falls noch welche darin wären
|
||||
|
||||
|
||||
echo "
|
||||
<html>
|
||||
<!DOCTYPE html>
|
||||
<html lang=\"en\" class=\"no-js\">
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
|
||||
<title>Excel Upload</title>
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/component.css\" />
|
||||
<!--[if IE]>
|
||||
<script src=\"http://html5shiv.googlecode.com/svn/trunk/html5.js\"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- remove this if you use Modernizr -->
|
||||
<script>(function(e,t,n){var r=e.querySelectorAll(\"html\")[0];r.className=r.className.replace(/(^|\s)no-js(\s|$)/,\"$1js$2\")})(document,window,0);</script>
|
||||
</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\" allign=\"center\" width=\"60%\" border=\"0\">
|
||||
<tr>
|
||||
<td width=\"10\" background=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Excel Upload</font><br>
|
||||
<span class=\"sh\">Import eines Studienjahrgangs.</span><br>
|
||||
<span class=\"sh\"><b>Erlaubte Dateiendungen: *.xls; *.xlsx</b></span>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></font></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td>
|
||||
<form action='" . $_SERVER['PHP_SELF'] . "?action=csvimp" . "' enctype=\"multipart/form-data\" method='post'>
|
||||
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" >
|
||||
<tr>
|
||||
<td width=\"100%\"align=\"center\" >
|
||||
<br>
|
||||
<br>
|
||||
<div class=\"box\">
|
||||
<input type=\"file\" name=\"file\" id=\"file-5\" class=\"inputfile inputfile-4\" />
|
||||
<label for=\"file-5\"><figure><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"17\" viewBox=\"0 0 20 17\"><path d=\"M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z\"/></svg></figure> <span style='float:center;'>Excel-Datei auswählen…<br>(hier klicken)</span></label>
|
||||
</div>
|
||||
<script src=\"js/custom-file-input.js\"></script>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"100%\" align=\"center\" colspan=\"2\">
|
||||
<input type=\"submit\" value=\"Excel-Hochladen…\" name=\"B1\" size=\"20\">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"100%\" align=\"center\" colspan=\"2\">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"100%\" align=\"center\" colspan=\"2\">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"100%\" align=\"center\" colspan=\"2\">
|
||||
<a href='Schülerimport_Beispiele.xlsx' target='_new'>Musterdatei downloaden</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case "csvimp":
|
||||
|
||||
// http://www.tutorials.de/tutorials65420.html
|
||||
$tempname = $_FILES['file']['tmp_name'];
|
||||
$name = $_FILES['file']['name'];
|
||||
|
||||
$type = $_FILES['file']['type'];
|
||||
$size = $_FILES['file']['size'];
|
||||
$einheit = "Byte"; // Für die Efolgsmeldung.
|
||||
|
||||
$limitedext = array(
|
||||
".xls",
|
||||
".xlsx"
|
||||
); //Erlaubte Dateieindung beim Upload
|
||||
$extlimit = "yes"; //Do you want to limit the extensions of files uploaded
|
||||
$ext = strrchr($name, '.');
|
||||
|
||||
|
||||
if (($extlimit == "yes") && (!in_array($ext, $limitedext))) {
|
||||
|
||||
$err[] = "
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Falscher Dateityp</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Falscher Dateityp</span>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></font></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td>
|
||||
<br>
|
||||
<p align=\"center\">Es dürfen nur Excel-Dateien hochgeladen werden!
|
||||
<p>
|
||||
<p align=\"center\"><p align=\"center\"><a href=\"?\">
|
||||
<img border=\"0\" src=\"../../templates/standard/images/zurueck.gif\" width=\"77\" height=\"22\"></a>
|
||||
</p>
|
||||
</td>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
if ($size > "9900000") {
|
||||
$err[] = "
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Datei zu groß</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Datei zu groß</span>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></font></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td>
|
||||
<br>
|
||||
<p align=\"center\">Die Datei welche Sie hochladen wollen, ist zu gross!<br>Maximale Dateigroesse beträgt 9.900 KB!
|
||||
<p>
|
||||
<p align=\"center\"><p align=\"center\"><a href=\"javascript:history.back()\">
|
||||
<img border=\"0\" src=\"../../templates/standard/images/zurueck.gif\" width=\"77\" height=\"22\"></a>
|
||||
</p>
|
||||
</td>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
$name = str_replace(array(
|
||||
"ä",
|
||||
"ö",
|
||||
"ü",
|
||||
"ß",
|
||||
"Ä",
|
||||
"Ü",
|
||||
"Ü",
|
||||
" "
|
||||
), array(
|
||||
"ae",
|
||||
"oe",
|
||||
"ue",
|
||||
"ss",
|
||||
"Ae",
|
||||
"Oe",
|
||||
"Ue",
|
||||
"_"
|
||||
), $name);
|
||||
|
||||
$heute = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")); // heutiges Datum & Zeit: http://de2.php.net/manual/de/function.date.php
|
||||
$heuteformat = date("H-i-s_Y-m-d", $heute); // Formatierung, wie es vor dem Dateinamen erscheinen soll
|
||||
$datum_db = date("Y-m-d H:i:s", $heute); // Formatierung, wie es vor dem Dateinamen erscheinen soll
|
||||
$neu = $heuteformat . "_" . $name;
|
||||
setcookie("ck_neu", "$neu");
|
||||
|
||||
If (empty($err)) {
|
||||
move_uploaded_file("$tempname", "$verz$neu"); // Unterverzeichnisse wie folgt: copy("$tempname", "pdf/$neu");
|
||||
|
||||
$inputFileName = "$verz$neu";
|
||||
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
||||
$sheet = $objPHPExcel->getActiveSheet()->toArray(null, true, false, true);
|
||||
$highestColumm = $objPHPExcel->setActiveSheetIndex(0)->getHighestColumn();
|
||||
$highestRow = $objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
|
||||
# Ab dem Tag rechnet Excel intern
|
||||
$datum = '30.12.1899';
|
||||
|
||||
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Datensätze prüfen</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border=\"0\" style=\"border-collapse: collapse\" width='100%' cellpadding=\"0\" height=\"90%\">
|
||||
<tr>
|
||||
<td>
|
||||
<div align=\"center\">
|
||||
<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width='100%'>
|
||||
<tr>
|
||||
<td width=\"10\" background=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Datensätze prüfen</font><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td>
|
||||
<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\" width='100%'>
|
||||
<tr>
|
||||
<td width=\"30%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Vorname</font></b>
|
||||
</td>
|
||||
<td width=\"30%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Nachname</font></b>
|
||||
</td>
|
||||
<td width=\"10%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Religionspflichtig</font></b>
|
||||
</td>
|
||||
<td width=\"10%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Einschulungsjahr</font></b>
|
||||
</td>
|
||||
<td width=\"10%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Klassenzusatz</font></b>
|
||||
</td>
|
||||
<td width=\"20%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Geburtsdatum</font></b>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
|
||||
for ($i = 1; $i <= $highestRow; $i++) {
|
||||
|
||||
$vorname = $sheet[$i]['A'];
|
||||
$nachname = $sheet[$i]['B'];
|
||||
$rel = $sheet[$i]['C'];
|
||||
$eingangsjahr = $sheet[$i]['D'];
|
||||
$klassenzusatz = $sheet[$i]['E'];
|
||||
$gebdat = date('m.d.Y', strtotime($sheet[$i]['F']));
|
||||
# $gebdat = date("d.m.Y", $sheet[$i]['F']);
|
||||
|
||||
$gebdatx = $sheet[$i]['F'];
|
||||
# $gebdat = date('d.m.Y', strtotime($datum . ' + ' . $gebdatx . ' days'));
|
||||
$gebdat = substr($gebdatx,0,2).".".substr($gebdatx,3,2).".".substr($gebdatx,6,4);
|
||||
# $gebdat2 = date('Y-m-d', strtotime($datum . ' + ' . $gebdatx . ' days'));
|
||||
$gebdat2 = substr($gebdatx,6,4)."-".substr($gebdatx,3,2)."-".substr($gebdatx,0,2);
|
||||
if ($nachname != '') {
|
||||
print "<tr>";
|
||||
// for ($c=0; $c < $num; $c++) { // FOR-Schleife: Oder Anzahl der zu importierenden Felder ($num)
|
||||
print "<td width='30%'><font size=\"1\">$vorname</td>\n"; // Vorname
|
||||
print "<td width='30%'><font size=\"1\">$nachname</td>\n"; // Nachname
|
||||
print "<td width='10%'><font size=\"1\">$rel</td>\n"; // religionskenner
|
||||
print "<td width='10%'><font size=\"1\">$eingangsjahr</td>\n"; // Einschulungsjahr
|
||||
print "<td width='10%'><font size=\"1\">$klassenzusatz</td>\n"; // klassenzusatz A,B..; Ergibt dann Klasse 6A z.B.
|
||||
print "<td width='30%'><font size=\"1\">$gebdat</td>\n"; // Geburtsdatum/Passwort
|
||||
// }
|
||||
print "</tr>";
|
||||
$ln_inserts[]++; //zählt die Anzahl der importierenden DS
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</table>
|
||||
</td>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>";
|
||||
$zahl = count($ln_inserts);
|
||||
|
||||
echo "
|
||||
|
||||
<table border=\"0\" style=\"border-collapse: collapse\" width='40%' cellpadding=\"0\">
|
||||
<tr>
|
||||
<td>
|
||||
<div align=\"center\">
|
||||
<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
|
||||
<tr>
|
||||
<td width=\"10\" background=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<font class=\"hd\">Sollen die $zahl Datensätze importiert werden?</font><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td>
|
||||
<form action='" . $_SERVER['PHP_SELF'] . "?action=csvimp2" . "' enctype=\"multipart/form-data\" method='post'>
|
||||
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#E7E8ED\">
|
||||
<tr>
|
||||
<td width=\"70%\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Auswahl</font></b>
|
||||
</td>
|
||||
<td width=\"30%\" align=\"left\" style=\"border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1px\">
|
||||
<b><font size=\"1\">Markieren</font></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"70%\"><font size=\"1\">Datensätze nicht importieren
|
||||
</td>
|
||||
<td width=\"30%\"><font size=\"1\"><input type=\"radio\" name=\"import\" value=\"0\" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"70%\"><font size=\"1\">Datensätze importieren
|
||||
</td>
|
||||
<td width=\"30%\"><font size=\"1\"><input type=\"radio\" name=\"import\" value=\"1\">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"70%\">
|
||||
|
||||
</td>
|
||||
<td width=\"30%\">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"70%\">
|
||||
|
||||
</td width=\"30%\">
|
||||
<td>
|
||||
<input type=\"submit\" value=\"Abschicken\" name=\"B1\" size=\"20\">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\">
|
||||
</td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
";
|
||||
} else {
|
||||
|
||||
foreach ($err as $error)
|
||||
echo "$error";
|
||||
exit;
|
||||
} //Ende if error
|
||||
|
||||
break;
|
||||
case "csvimp2":
|
||||
|
||||
$neu = $_COOKIE["ck_neu"]; //Excel-Dateinamen um Datei löschen zu können
|
||||
$verz = $_COOKIE["ck_verz"]; //Uploadverzeichnis aus Cookie holen
|
||||
|
||||
|
||||
if ($_POST['import'] == "0") // DS sollen nicht importiert werden
|
||||
{
|
||||
$dateiname = "$verz$neu";
|
||||
if (@unlink($dateiname)) // Funktion löscht Dateien und gibt true / false zurück
|
||||
{
|
||||
echo "
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Import beendet</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\"></td>
|
||||
<td width=\"95%\" background=\"../../templates/standard/images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Importvorgang abgebrochen</span><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td colspan=\"2\"><br>
|
||||
<p align=\"center\">Datemsätze wurden nicht importiert!<br>Die Excel-Datei wurde vom Server gelöscht!
|
||||
</p>
|
||||
<p align=\"center\"><a href=\"../hauptframe.php\">
|
||||
<img border=\"0\" src=\"../../templates/standard/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=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\" colspan=\"2\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/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=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Datei nicht gelöscht</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\"></td>
|
||||
<td width=\"95%\" background=\"../../templates/standard/images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Importvorgang abgebrochen</span><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td colspan=\"2\"><br>
|
||||
<p align=\"center\">Datemsätze wurden nicht importiert!<br>Die Excel-Datei ($neu) konnte <b>nicht</b> vom Server gelöscht werden!
|
||||
</p>
|
||||
<p align=\"center\"><a href=\"../hauptframe.php\">
|
||||
<img border=\"0\" src=\"../../templates/standard/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=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\" colspan=\"2\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
} // End if
|
||||
|
||||
} elseif ($_POST['import'] == "1") // DS sollen importiert werden
|
||||
{
|
||||
|
||||
$inputFileName = "$verz$neu";
|
||||
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
||||
$sheet = $objPHPExcel->getActiveSheet()->toArray(null, true, false, true);
|
||||
$highestColumm = $objPHPExcel->setActiveSheetIndex(0)->getHighestColumn();
|
||||
$highestRow = $objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
|
||||
# Ab dem Tag rechnet Excel intern
|
||||
$datum = '30.12.1899';
|
||||
|
||||
|
||||
for ($i = 1; $i <= $highestRow; $i++) {
|
||||
|
||||
$vorname = $sheet[$i]['A'];
|
||||
$nachname = $sheet[$i]['B'];
|
||||
$religionskenner = $sheet[$i]['C'];
|
||||
$eingangsjahr = $sheet[$i]['D'];
|
||||
$klassenzusatz = $sheet[$i]['E'];
|
||||
$gebdat = date('m.d.Y', strtotime($sheet[$i]['F']));
|
||||
$gebdat = date("d.m.Y", $sheet[$i]['F']);
|
||||
$gebdatx = $sheet[$i]['F'];
|
||||
# $gebdat = date('d.m.Y', strtotime($datum . ' + ' . $gebdatx . ' days'));
|
||||
$gebdat = substr($gebdatx,0,2).".".substr($gebdatx,3,2).".".substr($gebdatx,6,4);
|
||||
# $gebdat2 = date('Y-m-d', strtotime($datum . ' + ' . $gebdatx . ' days'));
|
||||
$gebdat2 = substr($gebdatx,6,4)."-".substr($gebdatx,3,2)."-".substr($gebdatx,0,2);
|
||||
|
||||
$tag = substr($gebdat2, 8, 2);
|
||||
$mon = substr($gebdat2, 5, 2);
|
||||
$jahr = substr($gebdat2, 0, 4);
|
||||
$passwd = md5("$tag" . "$mon" . "$jahr");
|
||||
|
||||
if ($nachname != '') {
|
||||
if ($religionskenner == 'RK' or $religionskenner == 'EV') {
|
||||
$religionspflicht = 'J';
|
||||
} else {
|
||||
$religionspflicht = 'N';
|
||||
}
|
||||
|
||||
$uid = genUser_schueler($vorname, $nachname);
|
||||
|
||||
//$passwd = mysql_escape_string($passwd);
|
||||
|
||||
#echo "SELECT count(*) Anz FROM users WHERE vorname='$vorname' AND nachname='$nachname' AND geburtstag='$gebtag'<br>";
|
||||
$result_vorh = $db->query("SELECT count(*) Anz FROM users WHERE vorname='$vorname' AND nachname='$nachname' AND geburtstag='$gebtag2'");
|
||||
$row_vorh = $result_vorh->fetch_array();
|
||||
|
||||
if ($row_vorh['Anz'] == 0) {
|
||||
// ACHTUNG: AN DIESER ZEILE NICHTS ÄNDERN, da die erste Zeile des Strings rausgefiltert wird bei der Ausgabe der nichtimportierten DS
|
||||
$insert = "INSERT INTO users (user, vorname, nachname, religionspflicht, religionskenner, jahrgang, klassenzusatz, passwort, geburtstag) VALUES ( lower('$uid')
|
||||
,'$vorname'
|
||||
,'$nachname'
|
||||
,'$religionspflicht'
|
||||
,'$religionskenner'
|
||||
,'$eingangsjahr'
|
||||
,'$klassenzusatz'
|
||||
,'$passwd'
|
||||
,'$gebdat2'
|
||||
)";
|
||||
$sql = $db->query("$insert");
|
||||
if (!$sql) {
|
||||
# Bei Fehler
|
||||
$unimported[] = $insert[$i];
|
||||
}
|
||||
} else {
|
||||
$result_vorh1 = $db->query("SELECT user FROM users WHERE vorname='$vorname' AND nachname='$nachname' AND geburtstag='$gebtag'");
|
||||
$row_vorh1 = $result_vorh1->fetch_array();
|
||||
$ber_vorh[] = "$row_vorh1[user]'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$dateiname = "$verz$neu";
|
||||
if (@unlink($dateiname)) // Funktion löscht Dateien und gibt true / false zurück
|
||||
{
|
||||
|
||||
|
||||
if (isset($unimported)) {
|
||||
$imp_err = str_replace(array(
|
||||
"INSERT INTO users (user, vorname, nachname, religionspflicht, religionskenner, jahrgang, passwort, geburtstag) VALUES ( lower('"
|
||||
), array(
|
||||
""
|
||||
), $unimported);
|
||||
}
|
||||
|
||||
if (sizeof($imp_err) > 0 AND sizeof($ber_vorh) > 0) {
|
||||
|
||||
# Array zusaamenführen aus bereits vorhandenen Schülern und fehlerhaftem Insert
|
||||
$ausgabe = array_merge($imp_err, $ber_vorh);
|
||||
}
|
||||
|
||||
if (sizeof($imp_err) > 0 AND sizeof($ber_vorh) == 0) {
|
||||
$ausgabe = $imp_err;
|
||||
}
|
||||
|
||||
if (sizeof($imp_err) == 0 AND sizeof($ber_vorh) > 0) {
|
||||
$ausgabe = $ber_vorh;
|
||||
}
|
||||
echo "
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Import beendet</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\"></td>
|
||||
<td width=\"95%\" background=\"../../templates/standard/images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Importvorgang erfolgreich</span><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td colspan=\"2\"><br>
|
||||
<p align=\"center\">Der Importvorgang wurde erfolgreich beendet!<br>Die Excel-Datei wurde vom Server gelöscht!
|
||||
</p>";
|
||||
$num1 = count($ausgabe); // Anzahl der nicht importierten UIDs
|
||||
if ($ausgabe != "") {
|
||||
echo "Es wurden $num1 Datensätze nicht importiert<br>
|
||||
Wahrscheinlich ist die UID bereits in der Datenbank vorhanden,<br>
|
||||
oder eines der Felder ist zu lang:
|
||||
<p>";
|
||||
}
|
||||
// Ausgabe der nicht importierten DS
|
||||
for ($i = 0; $i < sizeof($ausgabe); $i++) {
|
||||
$b = strpos($ausgabe[$i], "'");
|
||||
$e = substr($ausgabe[$i], 0, $b);
|
||||
|
||||
print strtolower($e); // Ausgabe der nicht importierten UIDs
|
||||
echo "<br>";
|
||||
}
|
||||
echo "
|
||||
<p align=\"center\"><a href=\"../hauptframe.php\">
|
||||
<img border=\"0\" src=\"../../templates/standard/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=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\" colspan=\"2\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/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=windows-1252\">
|
||||
<link rel=\"stylesheet\" href=\"../../templates/standard/css/styles_pc.php\" type=\"text/css\">
|
||||
<title>Datei nicht gelöscht</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=\"../../templates/standard/images/box_e1.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../../templates/standard/images/box_top.gif\" valign=\"top\"></td>
|
||||
<td width=\"95%\" background=\"../../templates/standard/images/box_top.gif\">
|
||||
<img height=\"10\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"><br>
|
||||
<span class=\"sh\">Importvorgang erfolgreich</span><br>
|
||||
<img height=\"5\" src=\"../../templates/standard/images/blank.gif\" width=\"1\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e2.gif\">
|
||||
<img height=\"40\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"1%\" background=\"../../templates/standard/images/box_l.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td colspan=\"2\"><br>
|
||||
<p align=\"center\">Der Importvorgang wurde erfolgreich beendet!<br>Die Excel-Datei ($neu) konnte <b>nicht</b> vom Server gelöscht werden!
|
||||
</p>";
|
||||
$num1 = count($ausgabe); // Anzahl der nicht importierten UIDs
|
||||
if ($ausgabe != "") {
|
||||
echo "Es wurden $num1 Datensätze nicht importiert<br>
|
||||
Wahrscheinlich ist die UID bereits in der Datenbank vorhanden,<br>
|
||||
oder eines der Felder ist zu lang:
|
||||
<p>";
|
||||
}
|
||||
// Ausgabe der nicht importierten DS
|
||||
for ($i = 0; $i < sizeof($ausgabe); $i++) {
|
||||
$b = strpos($ausgabe[$i], "'");
|
||||
$e = substr($ausgabe[$i], 0, $b);
|
||||
|
||||
print strtolower($e); // Ausgabe der nicht importierten UIDs
|
||||
echo "<br>";
|
||||
}
|
||||
echo "
|
||||
<p align=\"center\"><a href=\"../hauptframe.php\">
|
||||
<img border=\"0\" src=\"../../templates/standard/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=\"../../templates/standard/images/box_r.gif\">
|
||||
<img height=\"1\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../../templates/standard/images/box_e3.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../../templates/standard/images/box_bottom.gif\" colspan=\"2\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"8\"></td>
|
||||
<td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../../templates/standard/images/box_e4.gif\">
|
||||
<img height=\"16\" src=\"../../templates/standard/images/blank.gif\" width=\"22\"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
} // End if
|
||||
|
||||
} else { // Es wurde kein Radiobutton gewählt! Technisch aber ausgeschlossen
|
||||
|
||||
echo "sie müssen eine Auswahl treffen";
|
||||
|
||||
}
|
||||
|
||||
function deleteFiles($verz)
|
||||
{
|
||||
$handle = opendir($verz);
|
||||
while ($file = readdir($handle)) {
|
||||
if ($file != "." && $file != "..") {
|
||||
|
||||
$datei = $verz . $file;
|
||||
|
||||
if (@unlink($datei)) {
|
||||
$error = TRUE;
|
||||
} else {
|
||||
$error = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $error;
|
||||
}
|
||||
|
||||
deleteFiles($verz); // Dateien werden im Uploadverzeichnis gelöscht, falls noch welche darin wären
|
||||
|
||||
} // ende Action
|
||||
?>
|
61
upload/fetch_dst.php
Executable file
61
upload/fetch_dst.php
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if(!isset($_SESSION)) { session_start(); }
|
||||
require_once("../config/datenbankanbindung.php");
|
||||
$db = dbconnect();
|
||||
$ka_id = $_SESSION["ka_id"];
|
||||
$output = '';
|
||||
if(isset($_POST["query"]))
|
||||
{
|
||||
$search = mysqli_real_escape_string($db, $_POST["query"]);
|
||||
$query = "
|
||||
SELECT a.dst_id, bez, plz, ort
|
||||
FROM bpm_dienststellen a
|
||||
WHERE a.dst_id NOT IN (SELECT dst_id
|
||||
FROM bpm_dst_wunsch
|
||||
WHERE ka_id = '$ka_id'
|
||||
)
|
||||
AND (gueltig_von <= date_format(now(), '%Y-%m-%d') OR gueltig_von = '0000-00-00')
|
||||
AND (gueltig_bis >= date_format(now(), '%Y-%m-%d') OR gueltig_bis = '0000-00-00')
|
||||
AND bez like '%".$search."%'
|
||||
AND name != ''
|
||||
AND register_dat != '0000-00-00 00:00:00'
|
||||
ORDER BY bez ASC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "
|
||||
SELECT a.dst_id, bez, plz, ort
|
||||
FROM bpm_dienststellen a
|
||||
WHERE a.dst_id NOT IN (SELECT dst_id
|
||||
FROM bpm_dst_wunsch
|
||||
WHERE ka_id = '$ka_id'
|
||||
)
|
||||
AND (gueltig_von <= date_format(now(), '%Y-%m-%d') OR gueltig_von = '0000-00-00')
|
||||
AND (gueltig_bis >= date_format(now(), '%Y-%m-%d') OR gueltig_bis = '0000-00-00')
|
||||
AND register_dat != '0000-00-00 00:00:00'
|
||||
ORDER BY bez ASC";
|
||||
}
|
||||
$result = mysqli_query($db, $query);
|
||||
if(mysqli_num_rows($result) > 0)
|
||||
{
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
if(mysqli_num_rows($result) == 1){
|
||||
$output .= "
|
||||
<option value='$row[dst_id]' selected>$row[bez] ($row[plz] $row[ort])</option>
|
||||
";
|
||||
|
||||
}else{
|
||||
$output .= "
|
||||
<option value='$row[dst_id]'>$row[bez] ($row[plz] $row[ort])</option>
|
||||
";
|
||||
|
||||
}
|
||||
}
|
||||
echo $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Data Not Found';
|
||||
}
|
||||
?>
|
1349
upload/index.php
Executable file
1349
upload/index.php
Executable file
File diff suppressed because it is too large
Load Diff
1010
upload/index.php_bak
Executable file
1010
upload/index.php_bak
Executable file
File diff suppressed because it is too large
Load Diff
97
upload/save_note.php
Executable file
97
upload/save_note.php
Executable file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
if(!isset($_SESSION)) { session_start(); }
|
||||
|
||||
require_once("../config/datenbankanbindung.php");
|
||||
require_once("../func_notenskala.php");
|
||||
|
||||
function floor3($val, $precision) {
|
||||
$pos = strpos($val, '.');
|
||||
$zahl = substr($val, 0, $pos+1+$precision);
|
||||
return $zahl;
|
||||
}
|
||||
|
||||
$hzbnote = floor3(str_replace(',','.',str_replace('.','', $_POST['get_hzbnote'])),1);
|
||||
$durchschnittnote = floor3(str_replace(',','.',str_replace('.','', $_POST['get_durchschnittnote'])),1);
|
||||
$radio = $_POST['get_radio'];
|
||||
$notenskala = $_POST['get_notenskala'];
|
||||
$ka_id = $_SESSION["ka_id"];
|
||||
|
||||
$db = dbconnect();
|
||||
$query_anz = $db->query("SELECT count(*) Anz
|
||||
FROM bpm_note
|
||||
WHERE ka_id = $ka_id");
|
||||
$row_anz = $query_anz->fetch_array();
|
||||
|
||||
#echo $hzbnote;
|
||||
|
||||
if($notenskala == "Punkte"){
|
||||
if(isset($hzbnote)){
|
||||
$hzbpunkte = $hzbnote;
|
||||
$hzbnote = notenskala($hzbnote);
|
||||
}else{
|
||||
$hzbpunkte = "0.00";
|
||||
$hzbnote = "0.00";
|
||||
}
|
||||
|
||||
if(isset($durchschnittnote)){
|
||||
$durchschnittpunkte = $durchschnittnote;
|
||||
$durchschnittnote = notenskala($durchschnittnote);
|
||||
}else{
|
||||
$durchschnittpunkte = "0.00";
|
||||
$durchschnittnote = "0.00";
|
||||
}
|
||||
|
||||
}else{
|
||||
$hzbpunkte = "0.00";
|
||||
$durchschnittpunkte = "0.00";
|
||||
}
|
||||
|
||||
|
||||
if($radio == 'j'){
|
||||
# HZB vorhanden
|
||||
$durchschnittnote = "";
|
||||
$erfdat_hzb =date("Y-m-d H:i:s");
|
||||
$erfdat_schnitt = "0000-00-00 00:00:00";
|
||||
|
||||
if($row_anz['Anz'] == 0){
|
||||
#Insert
|
||||
$sql1 = $db->query("INSERT INTO bpm_note (ka_id, hzb, hzb_punkte, zeugnisschnitt, zeugnisschnitt_punkte, erfdat_hzb, erfdat_schnitt) VALUES('$ka_id', '$hzbnote', '$hzbpunkte', '$durchschnittnote', '$durchschnittpunkte', '$erfdat_hzb', '$erfdat_schnitt')");
|
||||
}else{
|
||||
#Update
|
||||
$sql1 = $db->query("UPDATE bpm_note
|
||||
SET hzb = '$hzbnote'
|
||||
,hzb_punkte = '$hzbpunkte'
|
||||
,zeugnisschnitt = '$durchschnittnote'
|
||||
,zeugnisschnitt_punkte = '$durchschnittpunkte'
|
||||
,erfdat_hzb = '$erfdat_hzb'
|
||||
,erfdat_schnitt = '$erfdat_schnitt'
|
||||
WHERE ka_id = '$ka_id'");
|
||||
}
|
||||
}elseif($radio == 'n'){
|
||||
# HZB nicht vorhanden
|
||||
$hzbnote = "";
|
||||
$erfdat_hzb = "0000-00-00 00:00:00";
|
||||
$erfdat_schnitt =date("Y-m-d H:i:s");
|
||||
|
||||
if($row_anz['Anz'] == 0){
|
||||
#Insert
|
||||
$sql1 = $db->query("INSERT INTO bpm_note (ka_id, hzb, hzb_punkte, zeugnisschnitt, zeugnisschnitt_punkte, erfdat_hzb, erfdat_schnitt) VALUES('$ka_id', '$hzbnote', '$hzbpunkte', '$durchschnittnote', '$durchschnittpunkte', '$erfdat_hzb', '$erfdat_schnitt')");
|
||||
}else{
|
||||
#Update
|
||||
$sql1 = $db->query("UPDATE bpm_note
|
||||
SET hzb = '$hzbnote'
|
||||
,hzb_punkte = '$hzbpunkte'
|
||||
,zeugnisschnitt = '$durchschnittnote'
|
||||
,zeugnisschnitt_punkte = '$durchschnittpunkte'
|
||||
,erfdat_hzb = '$erfdat_hzb'
|
||||
,erfdat_schnitt = '$erfdat_schnitt'
|
||||
WHERE ka_id = '$ka_id'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
#}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user