<?php //$input=getInput(); // $result = getLevel($text); // $level = $result['level']; // $message = $result['latest_message']; $text = $_REQUEST['text']; $myLevel = getLevel($text); $levelUserAt = $myLevel['level']; $message = $myLevel['latest_message']; switch ($levelUserAt) { case 0: $response = getMenu1(); break; case 1: $response = getMenu2($message); break; case 2: $response = getMenu3($message); break; case 3: $response = getMenu4($message); break; default: $response = getMenu1(); break; } sendOutput($response, 1); exit; function getInput() {
//Get the users level according to their input $level = getLevel($input); $leveluserat = $level['level']; //Gets the last input of the user $message = $level['latest_message']; //Get users phonenumber $phoneNumber = "0" . substr(trim($_GET["phoneNumber"]), 3, 9); switch ($leveluserat) { case 0: getHomeMenu(); break; case 1: getMenu1($message); break; case 2: getMenu2($message, $phoneNumber); break; default: getHomeMenu(); break; } function getInput() { //Declare an array to get input from the user, //assign the user a session id, get phone id, and phone no. $input = array(); //$input['sessionId'] = $_REQUEST["sessionId"]; //$input['serviceCode'] = $_REQUEST["serviceCode"]; $input['phoneNumber'] = $_REQUEST["phoneNumber"]; $input['text'] = $_REQUEST["text"]; return $input;