forked from yvesniyo/ussd-simulator-with-server-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
308 lines (293 loc) · 7.14 KB
/
index.html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="1000000000" >
<title>USSD PHONE SIMULATOR</title>
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="assets/css/prism.css">
</head>
<body style="padding-top: 20px;">
<div class="nav" style="">
<h1 style=""><a href="#">USSD Chamble</a></h1>
<ul >
<li><a href="#" class="goSettings">Settings</a></li>
<li><a href="#" class="goCodes">PHPServerCodes</a></li>
<li><a href="#">About me</a></li>
<li><a href="#">Contact me</a></li>
<li><a href="#">Ask Help?</a></li>
</ul>
</div>
<div style="" class="phone">
<div class="volume"></div>
<div class="power"></div>
<div class="top">
<center>
<div class="mic"></div>
</center>
<label style="color: white">YPHONE</label>
</div>
<div class="screen">
<div class="loading">
<div class="loader"></div>
<label style="float: right;padding-top: 10px;padding-right: 10px;">USSD code running</label>
</div>
<div class="bar"></div>
<div class="iconsPage" style="">
<center>
<div class="row">
<div class="time">
<h1 class="clock">--:--:--</h1>
</div>
<p style="color: white;margin-top: -40px;margin-bottom: 40px;font-size: 13px;letter-spacing: 1px;">Made by YvesNiyobuhungiro</p>
</div>
<div class="icons" style="background: url('assets/images/menu.png');background-size: 100% 100%;"></div>
<div class="icons" onclick="goUssd()" style="background: url('assets/images/playstore-icon.png');background-size: 100% 100%;"></div>
<div class="icons" style="background: url('assets/images/sms.png');background-size: 100% 100%;"></div>
</center>
</div>
<div class="ussd">
<center>
<div class="result">
<div class="textOutput">
</div>
<div class="resultInputs">
<input type="text" name="" class="resultInput" autofocus="">
<button class="resend">SEND</button>
<button class="cancel">CANCEL</button>
</div>
</div>
</center>
<div class="keyboard">
<center>
<div class="row1" style="height: 50px;">
<input autofocus="" value="*454#" type="text" name="" class="input">
<button class="delete">X</button>
</div>
<div class="row">
<button>1</button>
<button>2</button>
<button>3</button>
</div>
<div class="row">
<button>4</button>
<button>5</button>
<button>6</button>
</div>
<div class="row">
<button>7</button>
<button>8</button>
<button>9</button>
</div>
<div class="row">
<button>*</button>
<button>0 <sup>+</sup></button>
<button>#</button>
</div>
<div class="row">
<button class="send">.</button>
</div>
</center>
</div>
</div>
</div>
<div class="btm">
<button style="transform: rotate(0deg);">|==|</button>
<button class="circleBtn" onclick="goHome()">Home</button>
<button><=</button>
</div>
</div>
<div style="" class="tempCont">
<div class="colorCont">
<h1>USSD Tool</h1>
<p>
This project was made for developers by develper. <br />
Please feel free to ask me anything :)
</p>
</div>
<div class="settings">
<h1>Settings</h1>
<div class="form">
<div class="alert">
<p>Data has been successfuly stored.</p>
</div>
<div class="alertMsg">
<p>Data has been successfuly stored.</p>
</div>
<div class="row">
<label>Phone Number:</label>
<input type="text" name="" placeholder="Phone" autofocus="" class="phoneNumber">
</div>
<div class="row">
<label>Call Back URL:</label>
<input type="text" name="" placeholder="URL" class="url">
</div>
<div class="row">
<label>Service Code:</label>
<input type="text" name="" placeholder="Service Code" class="code">
</div>
<div class="row4">
<button class="save">Save</button>
</div>
</div>
</div>
</div>
<div class="codes" >
<div class="header">
<h1>Sample PHP code server for ussd</h1>
<button class="copy" >Copy</button>
</div>
<div class="container">
<pre class="" >
<code class="language-php">
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
$number=$_REQUEST['phone'];
$sessionId=$_REQUEST['sessionId'];
$text=$_REQUEST['text'];
$code=$_REQUEST['code'];
$mode="menu";
$level = 1;
$ussd_array = explode ("*",$text);
if(count($ussd_array)==0){
$level=0;
}else{
$level=count($ussd_array);
}
$level=$level+1;
if(trim($text)=="")
$level=1;
switch ($ussd_array[0]) {
case '0':
$mode="menu";
break;
case '':
$mode="menu";
break;
case '1':
$mode="create";
break;
case '2':
$mode="balance";
break;
case '3':
$mode="sendMoney";
break;
default:
# code...
break;
}
if($level==1){
displayMenu();
}else{
if($mode=="menu"){
switch ($text) {
case '0':
displayMenu();
break;
case '1':
createAccount();
break;
case '2':
checkBalance();
break;
case '3':
checkNumber();
break;
case '4':
sendMoney();
break;
default:
displayError();
break;
}
}else if($mode=="create"){
switch ($text) {
case '1':
createAccount();
break;
case '1*1':
echo "END You choose \n Male";
break;
case '1*2':
echo "END You choose \n Female";
break;
case '1*3':
echo "END You choose \n Not Now";
break;
default:
displayError();
break;
}
}else if($mode=="balance"){
checkBalance();
}else if($mode=="sendMoney"){
switch ($text) {
case '3':
sendMoney();
break;
case '3*1':
echo "END You choose \n MTN";
break;
case '3*2':
echo "END You choose \n AIRTEL";
break;
case '3*3':
echo "END You choose \n TIGO";
break;
default:
displayError();
break;
}
}
}
function displayMenu(){
$text="CON USSD Testing \n";
$text.="1. Create Account \n";
$text.="2. Check Balance \n";
$text.="3. Check My Number \n";
$text.="4. Send Money \n";
$text.="5. Buy Books \n";
$text.="44. Next \n";
echo $text;
}
function createAccount(){
$text="CON Creating Account\n";
$text.="1. Male \n";
$text.="2. Woman \n";
$text.="3. Not Now \n";
echo $text;
}
function checkBalance(){
$text="END Account Balance\n";
$text.="Your account Balance is 43,050Rwf \n";
echo $text;
}
function displayError(){
$text="END Error\n";
$text.="Uknown USSD command \n";
echo $text;
}
function checkNumber(){
$text="END Ckeck Number\n";
$number=$_REQUEST['phone'];
$text.="Your number is ".$number." \n";
echo $text;
}
function sendMoney(){
$text="CON Send Money\n";
$text.="1. MTN \n";
$text.="2. TIGO \n";
$text.="3. AIRTEL \n";
echo $text;
}
</code>
</pre>
</div>
</div>
<script type="text/javascript" src="assets/js/prism.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
</body>
</html>