Skip to content

Instantly share code, notes, and snippets.

@egi
Created September 11, 2009 06:16
Show Gist options
  • Save egi/185117 to your computer and use it in GitHub Desktop.
Save egi/185117 to your computer and use it in GitHub Desktop.
<?php
if (isset($_POST['submit']))
{
$answers = array('founder'=>'Albus Dumbledore', 'spell'=>'Alohomora', 'friend'=>'Ginny Weasley');
foreach ($answers as $question_id=>$answer)
{
if (!isset($_POST['answers'][$question_id]) || $_POST['answers'][$question_id] != $answer)
{
// kalo ada satu aja yang salah, langsung lempar ke sini
header('Location: http://www.itbags.co.cc/wrong.html');
exit;
}
}
// ini berarti ngga' ada yang salah.
header('Location: http://www.oyimsingle.co.cc');
exit;
}
// if page is not submitted to itself echo the form
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<h1> OYIMCLUELESS </h1>
<p>&nbsp;</p>
<p>1. Who is not the founder of Hogwarts School of Wizard?&nbsp;</p>
<input type="radio" value="Salazar Slytherin" name="answers[founder]"> Salazar Slytherin </input>
<br><input type="radio" value="Albus Dumbledore" name="answers[founder]"> Albus Dumbledore </input>
<br><input type="radio" value="Helga Hufflepuff" name="answers[founder]"> Helga Hufflepuff </input>
<br><input type="radio" value="Godric Griffindor" name="answers[founder]"> Godric Griffindor </input>
<p>2. What is the spell to open a door lock?&nbsp;</p>
<input type="radio" value="Alohomora" name="answers[spell]"> Alohomora </input>
<br><input type="radio" value="Avada Kedavra" name="answers[spell]"> Avada Kedavra </input>
<br><input type="radio" value="Wingardium Leviosa" name="answers[spell]"> Wingardium Leviosa </input>
<br><input type="radio" value="Expelliarmus" name="answers[spell]"> Expelliarmus </input>
<p>3. Who is Harry Potter's girl friend's name who will then become his wife? &nbsp;</p>
<input type="radio" value="Cho Chang" name="answers[friend]"> Cho Chang </input>
<br><input type="radio" value="Fleur Delacourt" name="answers[friend]"> Fleur Delacourt </input>
<br><input type="radio" value="Hermione Granger" name="answers[friend]"> Hermione Granger </input>
<br><input type="radio" value="Ginny Weasley" name="answers[friend]"> Ginny Weasley </input>
<p><input type="submit" value="Submit" name='submit' /></p>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment