From e227697c7c19c7ddb3faff00051defb5c5b1714c Mon Sep 17 00:00:00 2001 From: Goeran Heinemann Date: Fri, 6 Mar 2020 00:03:48 +0100 Subject: [PATCH] =?UTF-8?q?admin=20web=20soll=20sp=C3=A4ter=20seiten=20akt?= =?UTF-8?q?ivieren=20lassen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web.php | 56 ++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/admin-web.php b/admin-web.php index e44446b..f9f348c 100644 --- a/admin-web.php +++ b/admin-web.php @@ -1,35 +1,37 @@ '; -foreach ($pdo->query($sql) as $row){ - echo ''.$row['title'].''.$row['link'].''; -} - -if (isset($_GET['source'])){ - if (!isset($_GET['time'])){ - $sql = "SELECT * FROM scans WHERE site=?"; +session_start(); +if (isset($_SESSION['login'])){ + if (isset($_GET['activate'])){ + $sql = "SELECT active FROM sites WHERE id=?"; $stmt = $pdo->prepare($sql); - $stmt->bindParam(1, $_GET['source']); + $stmt->bindParam(1, $_GET['activate']); $stmt->execute(); - $data = $stmt->fetchAll(PDO::FETCH_ASSOC); - echo ''; - foreach ($data as $row){ - echo ''; + if ($stmt->rowCount() > 0){ + $sql = "UPDATE `sites` SET active=? WHERE id=?"; + $stmt = $pdo->prepare($sql); + $status = $stmt->fetchAll(PDO::FETCH_ASSOC); + var_dump($status); + $stmt->bindParam(1, $status); + } + } + + $sql = "SELECT * FROM sites"; + echo '
'.$row['time'].'
'; + foreach ($pdo->query($sql) as $row){ + //var_dump($row); + echo ''; + } + echo '
'.$row['title'].''.$row['link'].'
'; +}else{ + if (isset($_POST['password'])){ + if ($_POST['password'] == 'pw2020covid'){ + $_SESSION['login'] = true; + }else{ + header("Location: index.php"); + die(); } - echo ''; }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 ''; - foreach ($data as $row){ - echo ''; - } - echo '
'.$row['place'].''.$row['amount'].'
'; + echo '
'; } } \ No newline at end of file