From c0c6670e85f9c08a11bfa2f20d61953c9f49d3ab Mon Sep 17 00:00:00 2001 From: SBeans Date: Fri, 27 Jul 2012 14:14:35 +0100 Subject: Created --- blaquiz.php | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 blaquiz.php diff --git a/blaquiz.php b/blaquiz.php new file mode 100644 index 0000000..d276e43 --- /dev/null +++ b/blaquiz.php @@ -0,0 +1,86 @@ + + + // Version History + // 0.0.1 Created blaquiz.php + + $version = "BlaQuiz Version: 0.0.1"; + + $questions = array ( + "How many bits in a byte?", + "What does TTP mean?" + ); + $answers = array ( + "8", + "Time To Poo" + ); + // get the input + $stdin = read_stdin(); + + $stdin = explode(" ", $stdin); + $out = ""; + $token = ""; + if(isset($stdin[0])) + { + switch ($stdin[0]) + { + case "-q": + $id = rand(0,sizeof($questions) - 1); + $out = "ID: $id $questions[$id]"; + break; + case "-a": + if(isset($stdin[1]) && isset($stdin[2])) + { + //Check question ID + $id = $stdin[1]; + if($id < sizeof($questions)) + { + //get answer + $answer = ""; + for($i=2; $i -- cgit v1.2.3