DH_Alumni/verify.php

43 lines
844 B
PHP

<?php
require_once 'general.php';
if ($_SERVER['REQUEST_METHOD'] != "GET") {
die();
}
$uuid = $_GET['id'];
if($uuid == null) {
die();
}
$db = getDatabase();
$statement = $db->prepare("SELECT id from verify WHERE uuid = :uuid");
if(!$statement->execute(['uuid' => $uuid])) {
echo "Database Error";
die();
}
if($statement->rowCount() != 1) {
echo "Kein Eintrag mit dieser ID gefunden";
die();
}
$id = $statement->fetch(PDO::FETCH_ASSOC)['id'];
if($id == null) {
die();
}
$statement = $db->prepare("UPDATE entries SET verify = 1 WHERE id = :id");
if(!$statement->execute(['id' => $id])) {
echo "Database Error";
die();
}
$statement = $db->prepare("DELETE FROM verify WHERE id = :id");
if(!$statement->execute(['id' => $id])) {
echo "Database Error";
die();
}
echo "Danke für die Bestätigung";