Exemple #1
0
function getMenu1($input)
{
    switch ($input) {
        case 1:
            $response = "Please enter your names";
            break;
        case 2:
            $result = getStaff($phoneNumber);
            $phonecheck = $result['phoneNumber'];
            if ($phoneNumber == $phonecheck) {
                $response = getHomeMenu2();
                sendOutput($response, 2);
                exit;
            }
            $response = "Please register as you aren't in our records";
            break;
        default:
            getHomeMenu();
            break;
    }
    sendOutput($response, 1);
    return $response;
}
Exemple #2
0
$text = $_REQUEST['text'];
$result = getLevel($text);
$level = $result['level'];
$message = $result['latest_message'];
switch (strtolower($level)) {
    case 0:
        $response = getHomeMenu();
        break;
    case 1:
        $response = getLevelOneMenu($message);
        break;
    case 2:
        $response = getLevelOneMenu($message);
        break;
    default:
        $response = getHomeMenu();
        break;
}
sendOutput($response, 1);
exit;
$exploded_text = explode('*', $text);
print_r($exploded_text);
exit;
//1*1*3*5
$input = getInput();
if ($input['text'] == "") {
    // This is the first request. Note how we start the response with CON
    $response = "1. Loan" . PHP_EOL;
    $response .= "2. M-Shwari Balance";
    sendOutput($response, 1);
} else {
Exemple #3
0
function secondMenuSwitch($exploded_text)
{
    switch (trim(strtolower($exploded_text[0]))) {
        case 1:
            $response = "Enter PIN";
            break;
        case 2:
            //validate whether it is 1 or 2
            if ($exploded_text[1] == 1) {
                $response = "You are paying from MPESA";
            } elseif ($exploded_text[1] == 2) {
                $response = "You are paying from MSHWARI";
            } else {
                $response = "Invalid Response";
            }
            break;
        case 3:
            $response = "Your loan limit is Ksh 3000";
            break;
        default:
            $response = "Invalid Entry." . PHP_EOL . getHomeMenu();
            break;
    }
    return $response;
}