module Main where

import Network.CGI
import Data.Maybe

import DB

main = runCGI $ handleErrors cgiMain

cgiMain = do
    subject <- getInput "subject"
    let subj = fromJust subject
    proof <- liftIO $ db_firstvalue $ "SELECT proof_of_possession FROM revocation WHERE subject LIKE '" ++ subj ++ "'"
    setHeader "Content-Type" "text/plain"
    output $ proof
