-
Notifications
You must be signed in to change notification settings - Fork 0
/
test 2.php
70 lines (56 loc) · 1.41 KB
/
test 2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Created by PhpStorm.
* User: ed
* Date: 7/17/15
* Time: 6:07 PM
*/
$input = getInput();
$text = $_REQUEST["text"];
$level = 0;
$ussd_string_exploded = explode ("*",$input['text']);
// Get menu level from ussd_string reply
$level = count($ussd_string_exploded);
if($level == 1 or $level == 0){
displaymenu(); // show the home/first menu
}
if ($level > 1) {
switch (strtolower($input['text'])) {
case 1:
$response = "1. Blue".PHP_EOL;
$response .= "2. Pink";
break;
case 2:
$response = "1. Football".PHP_EOL;
$response = "2. Manicure";
break;
}
function getInput()
{
$input = array();
$input['sessionId'] = $_REQUEST["sessionId"];
$input['serviceCode'] = $_REQUEST["serviceCode"];
$input['phoneNumber'] = $_REQUEST["phoneNumber"];
$input['text'] = $_REQUEST["text"];
//$details = $_REQUEST["text"];
return $input;
}
function checkgender()
{
}
function displaymenu(){
$response = "1. Check gender \n 2. About \n"; // add \n so that the menu has new lines
ussd_proceed($response);
}
function about($response)
{
$response = "This is a simple app for telling your gender";
ussd_stop($response);
}
function ussd_proceed($response){
echo "CON $$response";
}
function ussd_stop($response){
echo "END $response";
}
?>