Exemplo n.º 1
0
                echo "\n Error code:" . $connection->http_code . ".";
                if ($connection->http_code == 0) {
                    echo "Don't report bugs or issues if you got this error code. Twitter is not accessible on this host. Perhaps the hosting company blocked Twitter.";
                }
                break;
        }
    }
    exit;
}
if (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])) {
    $connection = new TwitterOAuth(OAUTH_KEY, OAUTH_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
    $access_token = $connection->getAccessToken($_GET['oauth_verifier']);
    if ($connection->http_code == 200) {
        $old_tokens = glob('oauth/*.' . $access_token['screen_name']);
        $username = $access_token['screen_name'];
        if (!isAllow($username)) {
            sendDenyMessage($username);
            return;
        }
        if (!empty($old_tokens)) {
            foreach ($old_tokens as $file) {
                unlink($file);
            }
        }
        if ($_SESSION['url_suffix'] == '') {
            for ($i = 0; $i < 6; $i++) {
                $d = rand(1, 30) % 2;
                $suffix_string .= $d ? chr(rand(65, 90)) : chr(rand(48, 57));
            }
        } else {
            $suffix_string = $_SESSION['url_suffix'];
Exemplo n.º 2
0
<?php

include 'lib/twitese.php';
$title = "登陆";
include 'inc/header.php';
include 'acl.php';
?>

<div id="login_area">
	<div id="error">

<?php 
if (isset($_POST['username']) && isset($_POST['password']) && isAllow($_POST['username'])) {
    //附加密码
    if (TWITESE_PASSWORD != '' && $_POST['twitese_password'] != TWITESE_PASSWORD) {
        echo "<p>附加密码错误。<a href='login.php'>返回重新登录</a></p>";
    } else {
        $remember = isset($_POST['remember']) ? true : false;
        $result = verify($_POST['username'], $_POST['password'], $remember);
        if ($result === 'password') {
            echo "<p>登陆失败,用户名密码错误,请返回重试</p>";
        } else {
            if ($result === 'noconnect') {
                echo "<p>登陆失败,服务器连接不上twitter,请检查API</p>";
            } else {
                if (!$result) {
                    echo "<p>登陆失败,未知错误</p>";
                } else {
                    header('location: index.php');
                }
            }