-
Notifications
You must be signed in to change notification settings - Fork 24
/
prosess.php
46 lines (35 loc) · 1.18 KB
/
prosess.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
<?php
include "config/koneksi.php";
//SourceCode by AndezNET.com
$query = "SELECT * FROM inbox WHERE Processed = 'false'";
$hasil = mysqli_query($mysqli,$query);
while ($data = mysqli_fetch_array($hasil))
{
$id = $data['ID'];
$noPengirim = $data['SenderNumber'];
$msg = strtoupper($data['TextDecoded']);
$pecah = explode(" ", $msg);
$query1 = "SELECT keyword1 FROM tbl_autoreply WHERE keyword1='$pecah[0]'";
$hasil1 = mysqli_query($mysqli,$query1);
$data1 = mysqli_fetch_array($hasil1);
if ($pecah[0] == $data1[0])
{
$keyword2 = $pecah[1];
$query2 = "SELECT * FROM tbl_autoreply WHERE keyword2='$keyword2'";
$hasil2 = mysqli_query($mysqli,$query2);
if (mysqli_num_rows($hasil2) == 0)
$reply = "Keyword tidak ditemukan";
else
{
$data2 = mysqli_fetch_array($hasil2);
$pesan = $data2[3];
$reply = $pesan;
}
}
else $reply = "Maaf perintah salah";
$query3 = "INSERT INTO outbox(DestinationNumber, TextDecoded) VALUES
('$noPengirim', '$reply')";
$hasil3 = mysqli_query($mysqli,$query3);
$query3 = "UPDATE inbox SET Processed = 'true' WHERE ID = '$id'";
$hasil3 = mysqli_query($mysqli,$query3);
}