How Does Ask Peter Work? The Code Behind The Prank

tarot   How Does Ask Peter Work? The Code Behind The PrankFor a number of years, one of my passionate hobbies has been researching paranormal scams. These are situations where an individual claims they can predict the future, that they’ve discovered the secret to antigravity, or that they work for the government and know the truth about whether aliens exist. A common thread in all of that surreal research is that generally, an unnerving number of people are very, very gullible.

That gullibility multiplies significantly when the event being portrayed includes something that appears supernatural or “magical” in nature. Deep down, many people still want to believe in the magic – and when they are presented with the opportunity to believe again, they jump all over it.


A case in point is a website that’s been growing in popularity among the prankster community called Ask Peter, or Peter Answers. It comes complete with creepy Old English font and a copyright line at the bottom that adds to the intrigue, “Peter Answers 3.5 – Virtual Tarot – Original idea: Wizard 666.”  That’s right, Wizard 666….oooh, are you dealing with a supernatural entity hidden behind the bits and bytes of this mysterious web page? In this article, I would like to share the answer to the question – how does Ask Peter work?

How Does Ask Peter Work? The Believer Perspective

First, I’m going to show you how the website works for the person off of the street who knows nothing about the inner workings of the Ask Peter. When you first arrive at the website, you’ll see a very simple web form.

peter1   How Does Ask Peter Work? The Code Behind The Prank

The point of the website is that it’s a sort of electronic “tarot” which will peek into your future and answer your questions accordingly. However, Peter is a fickle psychic, and he must be treated with respect or he won’t answer your question. Therefore, before you ask a question, you must petition Peter with the sentence, “Peter, please answer the following question:”  If you’re using Ask Peter alone and you don’t know the secret behind the site, you’ll typically get an answer like this.

peter1b   How Does Ask Peter Work? The Code Behind The Prank

Tired? But he’s nothing more than electronic wizardry! Ah, but it’s all part of the show, folks. The magic really happens when you bring in a second person who knows Peter’s terrible secret (after reading this article, that will be you!)  The second person needs to type in the petition and question for you, and then you’ll get the answer – which is usually remarkably accurate.

peter2   How Does Ask Peter Work? The Code Behind The Prank

If the person typing the question knows the secret – you’ll get such an answer. In the second half of this article, I’m going to share the Peter’s terrible secret, and welcome you into the secret society of “Ask Peter” insiders. If you enjoy the childlike, magical perspective offered by your blissful ignorance – then stop reading this article now. Otherwise, if you would like a small antivirus shot so that you’ll be immune to this particular scam, then read on.

Welcome To The Secret Society Of Ask Peter

If you’ve read this far, then you feel prepared for the secret knowledge of how Ask Peter works. Let’s take a closer look.

peter4   How Does Ask Peter Work? The Code Behind The Prank

The ultimate secret to Ask Peter is actually a bit of creative Javascripting. Getting Peter to answer a question doesn’t take reverence and politeness, it takes a very plain period. That’s right – in the “Petition” field, just type a “.” and start typing the answer to the question that you’re going to ask in the next field. At the end of the answer, type another “.” and then continue typing the rest of “Peter, please answer the following question:” To the person sitting next to you, it only appears as though you’ve typed that one question – especially if you’re a fast typist.

So, now you know the secret. Submitting the question that you’ve already entered the answer for and clicking OK will result in Peter providing your answer. The person next to you who’s watching will be astounded and flabbergasted by the amazing accuracy of this virtual tarot. Just don’t be too accurate, as you’ll raise suspicion. Once you’re through, you can proudly claim another Ask Peter believer under your belt. In doing so, you’ve perfectly portrayed the terrible gullibility that runs rampant throughout the world.

Let’s take a closer look at how the background scripting for Ask Peter actually works.

peter5   How Does Ask Peter Work? The Code Behind The Prank

Here, I’ve viewed the source code for the web page. Now, the creators of this website were clever enough to suspect that discerning tech geeks would try peeking under the hood, so they’ve incorporated a few safeguards. The first, of course, is processing all entries through an ASP script called “PeterAnswers.aspx” and that’s a script that you simply can’t see without access to the web server files. However, if you look closely at the form code, you’ll discover an interesting anomaly.

It appears that when each keyboard key is pressed (the onKeyPress event handler), a function is called that returns a character. What character is really returned? If you look at the function for each field, they appear identical, but they’re not. One is named with a leading letter O, two zeroes and three trailing letter O’s again. The second function is named with a leading letter O, a zero, another letter O and four trailing zeroes.

peter6   How Does Ask Peter Work? The Code Behind The Prank

The same holds true for the OnKeyDown event handler – you’ll find two completely new functions disguised to look identical. What does this mean to those of you who aren’t Javascript programmers? It means that instead of one, single function handling the text that gets entered into each field and returning a text value to the field, there are actually four distinct functions handling every individual keypress. This means that there’s a whole lot of TomFoolery going on with the text that you enter into each text field.

The answer, of course, is that if you’re in the “Petition” field, the ASP script returns what you type into the field, but watches for the moment you type the “.” character. At that point, it starts typing the rest of the statement “Peter, please answer…” as it saves each character you’re actually typing into a variable until you type “.” again. Finally, once you click “OK” – your saved text that was stored in a string variable is displayed below in the form of Peter’s Answer.

Now that you know the inner workings of this online Prank, are you more likely to try it out on a friend? Share your opinion about this online “virtual tutor” in the comment section below, and if you do try it out on a friend, let us know how it went!

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

7 Comments -

Jonathan Bennett

How clever. I’m gonna have some fun and mess with my nieces using this site. :)

Larry B.

Hahaha, excellent!

Jonathan Peel

Been using Ask Peter for quite a long time now…

It’s great fun for a very slow Friday afternoon at work…

Tony

Very cool code behind the prank.

H

Haha this girl I tutor did this to me and it FREAKED me out. She asked it what we were doing and it answered, “History homework and it’s boring you both” haha. Then, she asked “Who am I with right now” and it said my full name yikes! Really fun for her but not for me until I figured it out.

Anonymous

There has to be more to this than that. My kids had their friends over and they were on the site asking questions. I was sitting on the couch and was speaking out loud. Peter would put a comment at the end of the answer referring to my comment. My daughter’s boyfriend came over and she was showing him the site and when she typed in When is Robert’s birthday? He answered and also told him he was wearing a white undershirt with a Biloxi High shirt over it. I can go on and on about this but there is NO WAY “Peter” could know the answers he did. It was a 12 yr old boy asking the questions I was speaking out loud and this 12 yr old boy did not know the answers to any of them.

Ryan Dube

Trust me, the person typing in the questions knew the answers. There’s nothing more to it than that, and the effect is even better if the person doing the typing is a good typist and learned many of the answers beforehand.