Example #1
0
<?php 
# $id$
require_once 'config.inc.php';
require_once 'DBAccessModel.class.php';
require_once 'AppController.class.php';
$db = new DBAccess('received');
$controller = new AppController($db);
#%p the phone number of the sender of the SMS message
#%a all words of the SMS message
#%C message charset
#%i the smsc-id of the connection that received the message
# received.php %p %C %i %a
#               1 2  3  4
# insert to database received sms
$d['body'] = trim(urldecode($argv[4]));
$d['msisdn'] = $db->num_format(urldecode($argv[1]));
$smsc = urldecode($argv[3]);
$d['smsc'] = $smsc == 'auto' ? false : $smsc;
$d['charset'] = urldecode($argv[2]);
//$d['created_at']= "NOW()";
$num = $d['msisdn'];
if ($num == "7210") {
    exit;
} else {
    $db->save_messages($d);
    $data = $db->get_member($d['msisdn']);
    //echo $d['message'];
    # pattern to check for possible command case insensitive
    $pattern = '/^(.+?),(.*)/i';
    if (preg_match($pattern, $d['body'], $m)) {
        $command = $db->get_pattern($m[1]);