I would create one many-to-many table that has the id of the joke, the IP and the phpbb id.
Then, before they get to vote, do a simple query to see if either the phpbb id or the IP is in the table AND the joke is the correct one.
SELECT * FROM table WHERE table_jokeid=$id AND (table_phpbbid=$phpbbid OR table_ip=$ip)
If you get a result, then kill the script.