Esempio n. 1
0
require_once "CrossBar.php";
$bldred = chr(0x1b) . '[1;31m';
$bldgrn = chr(0x1b) . '[1;32m';
$bldylw = chr(0x1b) . '[1;33m';
$bldblu = chr(0x1b) . '[1;34m';
$bldpur = chr(0x1b) . '[1;35m';
$bldcyn = chr(0x1b) . '[1;36m';
$bldwht = chr(0x1b) . '[1;37m';
$txtrst = chr(0x1b) . '[0m';
$XBOPTS['host'] = "127.0.0.1";
$XBOPTS['port'] = 8000;
$XBOPTS['usermd5'] = md5("user:password");
$XBOPTS['realm'] = "";
//$XBOPTS['profile'] = true;
global $XBAR;
$XBAR = new CrossBar($XBOPTS);
// See if we can make a connection
$USER_ID = '';
$ACCOUNT_ID = '';
$DEVICE_ID = '';
printf("{$bldblu}TEST: Authentication{$txtrst}\n");
if ($XBAR->is_authenticated()) {
    printf("{$bldgrn}PASS: Authentication Success.{$txtrst}\n\n");
    $TEMPLATE['name'] = 'supermegamega';
    $TEMPLATE['realm'] = 'supermega.example.com';
    $TEMPLATE['owner_id'] = $XBAR->auth_account_id;
    //Which ever user authed we will use that account is attached to
    $realm_id = $XBAR->get_account_id_by_realm($TEMPLATE['realm']);
    if (strlen($realm_id)) {
        printf("{$bldylw}WARN: {$bldred}Existing Account SKIPPING CREATION!{$txtrst}\n");
    } else {
Esempio n. 2
0
#!/usr/bin/php
<?php 
//include('../include/CrossBar.php');
$HOME = getenv("HOME");
include "{$HOME}/src/work/CrossBar.PHP/CrossBar.php";
$XBOPTS = parse_ini_file("{$HOME}/.xbopts.conf");
$XBAR = new CrossBar($XBOPTS);
$TYPE = "GET";
$REALM = "";
$OBJECT = "";
$OBJECT_ID = "";
$ACCOUNT_ID = "";
$LIST = "";
foreach ($argv as $key => $val) {
    if ($val == "-t") {
        $TYPE = $argv[$key + 1];
    }
    if ($val == "-l") {
        $LIST = "mwhhahahah";
    }
    if ($val == "-r") {
        $REALM = $argv[$key + 1];
    }
    if ($val == "-o") {
        $OBJECT = $argv[$key + 1];
    }
    if ($val == "-oi") {
        $OBJECT_ID = $argv[$key + 1];
    }
    if ($val == "-ua") {
        $ACCOUNT_ID = $argv[$key + 1];