Example #1
0
    }
    if ($rs = mysqli_fetch_array($rs)) {
        $id = $rs['id'];
    } else {
        header('Location: DBError.html');
    }
}
$rs = mysqli_query($con, "select * from user where id='" . $id . "'");
if ($rs = mysqli_fetch_array($rs)) {
    $user = new User($rs);
} else {
    header('Location: DBError.html');
}
$rs = mysqli_query($con, "select * from tweet where user_id='" . $id . "'");
while ($tweet = mysqli_fetch_array($rs)) {
    $user->set_tweets(new Tweet($tweet['id'], $tweet['text'], $tweet['created_by'], $tweet['creater_profile_image'], $tweet['created_at']));
}
mysqli_close($con);
$html = '

    <style>
        #wall {
            background-color: #' . $user->get_profile_sidebar_fill_color() . '
        }
        body {
            background-image: url(' . $user->get_profile_background_image_url() . ');
            background-repeat: no-repeat;
            background-position: 0% -15%;
            background-color: #' . $user->get_profile_background_color() . ';
        }
        footer {
if($rs =  mysqli_fetch_array($rs)) {
    $user = new User($rs);
} else {
    header('Location: ../DBError.html');
}


/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

$tweets = $connection->get("statuses/home_timeline",array("count"=>10,"exclude_replies"=>true,"include_entities"=>false));

mysqli_query($con, "delete from tweet where user_id='' or user_id = '".$user->get_id()."'");

if(count($tweets)!=0 && is_array($tweets)) {
	foreach ($tweets as $tweet) {
	    $user->set_tweets(new Tweet($tweet->id_str, $tweet->text, $tweet->user->screen_name, $tweet->user->profile_image_url, $tweet->created_at));
	    mysqli_query($con, "insert into tweet values (
	                            '".$tweet->id_str."',
	                            '".addslashes($tweet->text)."',
	                            '".$tweet->user->screen_name."',
	                            '".$tweet->user->profile_image_url."',
	                            '".$tweet->created_at."',
	                            '".$user->get_id()."')") or die(mysqli_error($con));
	}
}
mysqli_close($con);

echo $user->get_tweets_json();