} footer { background-color: #fefefe; margin-left: 20px; margin-right: 20px; } hr { margin-top: 10px; margin-bottom: 5px; } </style> <body> <div class="tweet-box"> <h4 class="navbar-text">TweetUdit</h4> <span id="liName" class="navbar-text">' . $user->get_name() . '</span> <span id="liScreenName" class="navbar-text"> <strong><em>(@' . $user->get_screen_name() . ')</em></strong></span> <img class="img-polaroid" src="' . $user->get_profile_image_url() . '"> </div> <div class="clearfix"> </div> <div class="clearfix"> </div> <div class="clearfix"> </div> <div class="container"> <div class="container-fluid row"> <div id="wall" class="container-fluid"> <h4 class="offset tweet-box">My Home Timeline</h4>'; foreach ($user->get_tweets_object() as $tweet) { $html = $html . ' <div class="container-fluid tweet-box item"> <div class="container-fluid row">
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: clearsession.php'); } /* Get user access tokens out of the session. */ $access_token = $_SESSION['access_token']; /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* If method is set change API call made. Test is called by default. */ $user = new User($connection->get('account/verify_credentials')); $con = mysqli_connect($host, $username, $password, $dbName); if (mysqli_connect_errno($con)) { header('Location: DBError.html'); } $rs = mysqli_query($con, "select id from user where id='" . $user->get_id() . "'"); if ($rs = mysqli_fetch_array($rs)) { mysqli_query($con, "update user\r\n set id = '" . $user->get_id() . "',\r\n screen_name = '" . $user->get_screen_name() . "',\r\n name = '" . $user->get_name() . "',\r\n profile_image_url = '" . $user->get_profile_image_url() . "',\r\n profile_background_image_url = '" . $user->get_profile_background_image_url() . "',\r\n profile_sidebar_fill_color = '" . $user->get_profile_sidebar_fill_color() . "',\r\n profile_background_color = '" . $user->get_profile_background_color() . "',\r\n profile_link_color = '" . $user->get_profile_link_color() . "'\r\n where id = '" . $user->get_id() . "'"); } else { mysqli_query($con, "insert into user values (\r\n '" . $user->get_id() . "',\r\n '" . $user->get_screen_name() . "',\r\n '" . $user->get_name() . "',\r\n '" . $user->get_profile_image_url() . "',\r\n '" . $user->get_profile_background_image_url() . "',\r\n '" . $user->get_profile_sidebar_fill_color() . "',\r\n '" . $user->get_profile_background_color() . "',\r\n '" . $user->get_profile_link_color() . "')"); } mysqli_close($con); $_SESSION['user'] = $user->get_id(); ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head> <body> <!--[if lt IE 7]> <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p> <![endif]--> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a href="home.php" class="brand">TweetUdit</a> <ul class="nav"> <li class="divider-vertical"></li> <li id="liName" class="navbar-text"><?php echo $user->get_name();?></li> <li id="liScreenName" class="navbar-text"> <strong><em><a href="home.php">(@<?php echo $user->get_screen_name();?>)</a></em></strong></li> </ul> <div class="nav dropdown pull-right"> <a class="navbar-text dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" href="#"> <i class="icon-wrench"></i><span>User Actions</span> </a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> <li><a tabindex="-1" href="manageFav.php"><i class="icon-star"></i> Manage Favorites</a></li> <li><a tabindex="-1" href="clearsession.php"><i class="icon-remove-circle"></i> Logout</a></li> </ul> </div> </div> </div> </div> <div class="container">
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ session_start(); require_once ('../User.php'); require_once ('../DBConfig.php'); if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ../clearsession.php'); } $id = $_SESSION['user']; $con = mysqli_connect($host,$username,$password,$dbName); if(mysqli_connect_errno($con)) { 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'); } mysqli_close($con); echo json_encode(array("screenName"=>$user->get_screen_name()));
$user = new User($rs); mysqli_query($con, "update user set id = '".$user->get_id()."', screen_name = '".$user->get_screen_name()."', name = '".$user->get_name()."', profile_image_url = '".$user->get_profile_image_url()."', profile_background_image_url = '".$user->get_profile_background_image_url()."', profile_sidebar_fill_color = '".$user->get_profile_sidebar_fill_color()."', profile_background_color = '".$user->get_profile_background_color()."', profile_link_color = '".$user->get_profile_link_color()."' where id = '".$user->get_id()."'"); } else { $user = new User($connection->get("users/show",array("screen_name"=>$screen_name,"includes_entities"=>false))); mysqli_query($con, "insert into user values ( '".$user->get_id()."', '".$user->get_screen_name()."', '".$user->get_name()."', '".$user->get_profile_image_url()."', '".$user->get_profile_background_image_url()."', '".$user->get_profile_sidebar_fill_color()."', '".$user->get_profile_background_color()."', '".$user->get_profile_link_color()."')"); } $tweets = $connection->get("statuses/user_timeline",array("screen_name"=>$screen_name,"count"=>10,"exclude_replies"=>true)); 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));