Skip to content
Snippets Groups Projects
Commit ffd30828 authored by Henoch Einbier's avatar Henoch Einbier Committed by Joel Kuder
Browse files

new features: add and delete cronjob files in database

parent 559bd45e
1 merge request!46Release 3.0
<?php head("Crons (Übersicht und manuell Start)");?>
<table class="tabellen">
<tr class="tabellenhead">
<?php
//Dateien holen
$files = array_slice(scandir('../crons/'), 2);
head("Cronjob hinzufügen");
//wenn formular abgeschickt cron hinzufügen
if ( (isset($_POST['cron_art'])) && (isset($_POST['cron_dateiname'])) && (isset($_POST['cron_bezeichnung'])) ) {
$sql = sql::$db->query("INSERT INTO " . _VMS_ . "_crons (`cron`, `datei`, `bezeichnung`)
VALUES ('".$_POST['cron_art']."', 'crons/".$_POST['cron_dateiname']."', '".$_POST['cron_bezeichnung']."')");
echo 'Cron eingetragen!';
}
?>
<br>
Cron Datei bitte vorher in /crons kopieren!<br>
<br>
<form action="" method="post">
<table class="table table-hover table-sm table-responsive">
<tr>
<td>Cron Art:</td>
<td>
<select name="cron_art" size="1">
<option>ext_cron</option>
<option>int_forcedbanner</option>
<option>int_highforcedbanner</option>
<option>int_text</option>
<option>int_traffic</option>
<option>int_paidmail</option>
<option>int_htmlpaidmail</option>
</select>
</td>
</tr>
<tr>
<td>Cron Datei wählen:</td>
<td><select name="cron_dateiname" size="1"/>
<?php
//alle crons aus DB einlesen
$cronfiles_sql = sql::$db->prepare("SELECT datei FROM " . _VMS_ . "_crons ");
$cronfiles_sql->execute();
$cronfiles = $cronfiles_sql->fetchAll(PDO::FETCH_COLUMN, 0);
for ($x = 0; $x < count($files); $x++) {
//wenn Datei noch nicht eingetragen dann zur Auswahl zeigen
$temp = 'crons/'.$files[$x];
if (in_array ($temp, $cronfiles) != true ) {
echo '<option value="'.$files[$x].'">'.$files[$x].'</option>'.PHP_EOL;
}
}
echo '</select> (zeigt nur Dateien die noch nicht in der DB sind)</td></tr>';
?>
<tr>
<td>Bezeichnung</td>
<td><input type="text" name="cron_bezeichnung" size="60"/></td>
</tr>
</table>
<input class="btn btn-light" type="submit" value="Eintragen"/>
</form>
<br><br>
<?php
foot();
head("Crons (Übersicht, manueller Start und Löschen)");?>
<table class="table table-hover table-sm table-responsive">
<tr>
<td align="center"><b>Cron</b></td>
<td align="center"><b>Laufzeit</b></td>
<td align="center">URL</td>
<td align="center">Ausführen</td>
<td align="center">Löschen</td>
</tr>
<?php
$i = 0;
......@@ -19,11 +83,15 @@ while ($crontabelle = $crons->fetch() ) {
</td>
<td align="center" valign="middle">
<font color="#000080">' . date("d.m.Y - H:i:s", $crontabelle['laufzeit']) . '</font>
' . date("d.m.Y - H:i:s", $crontabelle['laufzeit']) . '
</td>
<td align="center" valign="middle">
<a href="../cron.php?id=' . $crontabelle['id'] . '&amp;pw=' . $system['cron_pw'] . '" target="_blank"><img src="images/gruen.gif" width="15" height="15" border="0" alt="Ausführen"></a>
<a href="../cron.php?id=' . $crontabelle['id'] . '&amp;pw=' . $system['cron_pw'] . '" target="_blank"><button class="btn btn-light">Starten</button></a>
</td>
<td align="center" valign="middle">
<a href="../cron.php?id=' . $crontabelle['id'] . '&amp;delete=yes&amp;pw=' . $system['cron_pw'] . '" target="_blank"><button class="btn btn-light">Löschen</button></a>
</td>
</tr>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment