Esempio n. 1
0
    $myfunc = 'NULL';
}
if (isset($_REQUEST['statcode']) && intval($_REQUEST['statcode']) > 0) {
    $stat_code = strip_tags($_REQUEST['statcode']);
} else {
    $stat_code = 0;
}
if (isset($_REQUEST['vid']) && intval($_REQUEST['vid']) > 0) {
    $verein_id = strip_tags($_REQUEST['vid']);
} else {
    $verein_id = 0;
}
if (isset($_REQUEST['show']) && $_REQUEST['show'] != "undefined") {
    $show_match = strip_tags($_REQUEST['show']);
} else {
    $show_match = 'NULL';
}
switch ($myfunc) {
    case "teammatches":
        _vereinteammatchlist($verein_id, $show_match);
        break;
    case "playerranking":
        _vereinplayerranking($verein_id, $stat_code);
        break;
    default:
        _main($event_id);
        break;
}
# just in case we close main div
echo '</div>';
LS_page_end();
    if (empty($uid)) {
        $json_me = json_decode(file_get_contents('https://graph.facebook.com/me?access_token=' . $access_token));
        $uid = $json_me->id;
        echo "<p>uid empty, get uid from Graph API. uid= " . $uid . "</p>";
    }
    // if reciver empty, receiver will be sender.
    if (empty($recv_id)) {
        $recv_id = $uid;
    }
    // $json_friends = json_decode(file_get_contents('https://graph.facebook.com/me/friends?access_token='.$access_token));
    // list_array($json_friends->data);
    _post();
}
function _post()
{
    global $app_id, $app_secret, $uid, $recv_id, $access_token;
    // connect to XMPP Authentication
    $server_options = array('app_id' => $app_id, 'server' => 'chat.facebook.com');
    $fp = xmpp_connect($server_options, $access_token);
    // send message
    if ($fp) {
        $msg_options = array('uid' => $uid, 'recv_id' => $recv_id, 'msg' => 'Hi, I am robot. ' . date("Y-m-d H:i:s") . '
             Source Code: https://github.com/hankwang/facebook-chat-bot/');
        xmpp_send_msg($fp, $msg_options);
    } else {
        echo "An error ocurred<br>";
    }
    fclose($fp);
}
_main();