Beispiel #1
0
function from_tumblr()
{
    global $sessionkey;
    $db = get_db_connectiuon();
    list($sessionkey, $cookies, $u) = get_login_cookie($db);
    $page = getPage();
    $agent = Net_UserAgent_Mobile::singleton();
    // paging a page
    if ($agent->isDoCoMo()) {
        $page = ceil($page / 2);
    }
    //$postid = getPostId();
    $url = 'http://www.tumblr.com/dashboard/';
    if ($page > 1) {
        $url .= $page;
    }
    if ($postid > 1) {
        $url .= "/{$postid}";
    }
    #print "<!--$url-->";
    $retry = 2;
    while ($retry--) {
        $req =& new HTTP_Request($url);
        $req->setMethod(HTTP_REQUEST_METHOD_GET);
        foreach ($cookies as $v) {
            $req->addCookie($v['name'], $v['value']);
        }
        if (PEAR::isError($req->sendRequest())) {
            $err = 1;
        }
        $code = $req->getResponseCode();
        if ($code == 302) {
            $err = true;
            if ($u['email']) {
                list($err, $cookies) = update_cookie_info($u['email'], $u['password'], true, $u['hash']);
            }
            if ($err) {
                $retry = 0;
                break;
            }
        } else {
            if ($code == 200) {
                return $req->getResponseBody();
            } else {
                print '<html><body><pre>x_x';
                print " {$code} ";
                print '</body></html>';
                exit;
            }
        }
    }
    if ($retry == 0) {
        header('Location: /login');
    } else {
        print '<html><body><pre>x_x';
        print '</body></html>';
    }
    exit;
}
Beispiel #2
0
<?php

extract($_REQUEST);
$err = '';
require_once 'HTTP/Request.php';
//require_once 'DB.php';
require_once 'lib/adodb/adodb.inc.php';
require_once 'lib/adodb/adodb-pear.inc.php';
require_once 'lib/db.php';
require_once 'Cookie.php';
if ($email != '' and $password != '') {
    $hash = null;
    list($err) = update_cookie_info($email, $password, $persistent, $hash);
    if ($err == '') {
        $host = $_SERVER['SERVER_NAME'];
        $u = "Location: http://{$host}/dashboard/{$hash}?.rand=" . rand();
        header($u);
    } else {
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
	<meta http-equiv="content-type" content="text/html; charset=SHIFT_JIS" />
	<link rel="stylesheet" type="text/css" href="/style.css" media="all" />
	<title>login</title>
</head>
<body>
<?php 
include 'tmpl/login.php';