setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo "
Error!: " . $e->getMessage() . "
";
die();
}
# SHOLUD SOMETHING BE APPROVED?
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['id']) ) {
$stmt = $conn->prepare("UPDATE activities SET approved = true WHERE id=:id");
echo "lol:" . $_POST['id'];
$stmt->bindParam(':id', $_POST['id']);
$stmt->execute();
}
# IS LOGIN LEGITIMATE?
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email']) && isset($_POST['password'])) {
try {
$stmt = $conn->prepare("SELECT * FROM admins WHERE email=:email");
$stmt->bindParam(':email', $_POST['email']);
$stmt->execute();
$row = $stmt->fetch();
if (password_verify($_POST['password'], $row['password'])){
$_SESSION['admin'] = true;
} else {
$_SESSION['admin'] = false;
}
} catch (PDOException $e) {
echo "Error!: " . $e->getMessage() . "
";
}
}
?>
Yota Callplan
';
echo "\n";
echo "";
echo "Ime | ";
echo "Prezime | ";
echo "Godine | ";
echo "Actions | ";
echo "
\n";
foreach($conn->query("SELECT * FROM activities WHERE approved = false") as $row) {
echo "";
echo "" . $row['name'] . " | ";
echo "" . $row['surname'] . " | ";
echo "" . $row['age'] . " | ";
echo ' | ';
echo "
\n";
}
echo "
\n\n";
} catch (PDOException $e) {
echo "Error!: " . $e->getMessage() . "
";
}
} else {
# Bad pass check...
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSION['admin'] == false) echo "Bad credentials!";
# Login form
echo '';
}
?>