index seite lässt daten durchstöbern

This commit is contained in:
Göran Heinemann 2020-03-06 00:03:29 +01:00
parent 086914b79b
commit c406e838f0

35
index.php Normal file
View File

@ -0,0 +1,35 @@
<?php
include 'config.php';
$sql = "SELECT * FROM sites WHERE active=1";
echo '<table>';
foreach ($pdo->query($sql) as $row){
echo '<tr><td><a href="admin-web.php?source='.$row['id'].'">'.$row['title'].'</a></td><td>'.$row['link'].'</td></tr>';
}
if (isset($_GET['source'])){
if (!isset($_GET['time'])){
$sql = "SELECT * FROM scans WHERE site=?";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(1, $_GET['source']);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<table>';
foreach ($data as $row){
echo '<tr><td><a href="admin-web.php?source='.$_GET['source'].'&time='.$row['id'].'">'.$row['time'].'</a></td></tr>';
}
echo '</table>';
}else{
$sql = "SELECT * FROM data WHERE scan=?";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(1, $_GET['time']);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<table>';
foreach ($data as $row){
echo '<tr><td>'.$row['place'].'</td><td>'.$row['amount'].'</td></tr>';
}
echo '</table>';
}
}