Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
timerec3public/madeleterun.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
39 lines (33 sloc)
1.14 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
//kopiert am angegebenen Datum den Mitarbeiter in _old Tabelle | |
//löscht Mitarbeiter aus der mitarbeiter Tabelle, damit er dann nicht mehr zugreifbar ist. | |
//läuft nachts nach saldorun | |
if(php_sapi_name() != "cli"){ | |
echo "<h3>keine Rechte, diese Seite einzusehen!</h3>"; | |
exit; | |
} | |
include('dbconnect.php'); | |
$heute = new DateTime(); | |
$heutestr = $heute->format('Y-m-d'); | |
echo "zu deaktivierende Mitarbeiter kopieren...\n"; | |
$copy = "insert into mitarbeiter_old select * from mitarbeiter where ausgeschieden <= '$heutestr';"; | |
$dbc->query($copy); | |
if($dbc->error){ | |
echo "ERROR: ".$dbc->error."\n"; | |
echo "CODE: $copy\n"; | |
exit; | |
} | |
$x = $dbc->affected_rows; | |
echo "Done. $x Zeilen kopiert.\n"; | |
echo "Lösche zu deaktivierende Mitarbeiter aus Haupttabelle...\n"; | |
$delete = "delete from mitarbeiter where ausgeschieden <= '$heutestr';"; | |
$dbc->query($delete); | |
if($dbc->error){ | |
echo "ERROR: ".$dbc->error."\n"; | |
echo "CODE: $delete\n"; | |
exit; | |
} | |
$x = $dbc->affected_rows; | |
echo "Done. $x Zeilen gelöscht.\n"; | |
?> |