Get help on this challenge


Here is this awesome new AJAX function I just wrote for this page. Here is the PHP on the server-side:

//Get data from POST params
$func = str_replace("`", "", $_POST["func"]);//have to sanitize the input of course

//generic valhalla method
function getPassword(){
  global $password;//comes from external file
  return $password;

//what happens if we have an even number
function getOutputEven($num){
  return "$num is an even number.";

//what happens if we have an odd number
function getOutputOdd($num){
  return "$num is an odd number.";

//what happens if we have something that isn't a number at all
function getOutputOther($other){
  return "The input converted to $other is not a number at all.";

//get response text
if(isValidInput($func, $num)){
  $response = call_user_func($func, $num);
  $response = "Invalid input somewhere.";
//output the response
echo $response;

Start typing a number in the input field below:



You must be logged in to play. Login or register here

Challenge by .