Пример #1
0
    echo "  " . $argv[0] . " HOST --auto\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de --auto\r\n\r\n";
    echo "  " . $argv[0] . " HOST QUERY\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT COUNT(`id`) FROM `s_user`\"\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT `email` FROM `s_user` LIMIT 0,1\"\r\n\r\n";
    exit(1);
}
if ($argv[2] != '--auto') {
    $x = http_req($argv[1], $argv[2]);
    if (!($x = mask($x))) {
        exit("Your query failed!\r\n\r\n");
    }
    echo "Query:\r\n  " . $argv[2] . "\r\nReturn:\r\n  " . $x . "\r\n\r\n";
} else {
    $task = array(array('Amount of registered users', 'SELECT COUNT(`id`) FROM `s_user`', null), array('E- Mail from first user', 'SELECT `email` FROM `s_user` ORDER BY `id` LIMIT 0,1', null), array('Password from first user', 'SELECT `password` FROM `s_user` LIMIT 0,1', null), array('Amount of orders', 'SELECT COUNT(`id`) FROM `s_order`', null));
    for ($i = 0; $i < count($task); $i++) {
        echo "[ .. ] Task: \"" . $task[$i][0] . "\"";
        $x = http_req($argv[1], $task[$i][1]);
        if (!($x = mask($x))) {
            echo "\r[fail] Task: \"" . $task[$i][0] . "\"\r\n";
        } else {
            echo "\r[ ok ] Task: \"" . $task[$i][0] . "\"\r\n";
            $task[$i][2] = $x;
        }
    }
    echo "\r\n";
    for ($i = 0; $i < count($task); $i++) {
        echo $task[$i][0] . space(26 - strlen($task[$i][0])) . ' : ' . $task[$i][2] . "\r\n";
    }
    echo "\r\n";
}
Пример #2
0
 /**
  *   ログの出力
  *
  *   @param string $status install or update or restore or uninstall
  *   @param string $server サーバー情報
  *   @param string $pid Product ID
  *
  *   @return boolean 成功
  */
 function install_log($status, $server = 'localhost', $pid = '')
 {
     $url = ENSMALL_CLUB_URL . 'product_installs/install_log/__UID__/__PID__/__SERVER__/__STATUS__/d41da6ce50bdf4e458514e8d4a195e63/';
     $search = array('__UID__', '__PID__', '__SERVER__', '__STATUS__');
     $server = str_replace('/', '\\', $server);
     //cakephpによって、%2Fが、/ と認識されてうまく動作しないから
     $pid = $pid == '' ? $this->product_id : $pid;
     $rep = array($this->user_id, $pid, rawurlencode($server), rawurlencode($status));
     $url = str_replace($search, $rep, $url);
     $req_data = array('method' => 'POST', 'post' => array('url' => $this->install_url));
     if ($this->use_proxy) {
         $req_data['proxy_host'] = $this->proxy_host;
     }
     $res = http_req($url, $req_data);
     return TRUE;
 }