Exemplo n.º 1
0
 function getResults($page, $author, $keyword)
 {
     $sql = "SELECT epoch_time, author, body, permalink FROM reddit ";
     $where = "WHERE 1 = 1 ";
     if ($author != 'all') {
         $where .= "AND author = :author ";
     }
     if ($keyword != 'all') {
         $where .= "AND MATCH(body) AGAINST (:keyword IN BOOLEAN MODE) ";
     }
     $sql .= $where;
     $sql .= "ORDER BY epoch_time DESC ";
     $sth = $GLOBALS['dbh']->prepare($sql);
     if ($author != 'all') {
         $sth->bindParam(':author', $author);
     }
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     $rows = $sth->rowCount();
     $pages = ceil($rows / 10);
     $start = ($page - 1) * 10;
     $sql .= "LIMIT :start, 10";
     $sth = $GLOBALS['dbh']->prepare($sql);
     $sth->bindParam(':start', $start, PDO::PARAM_INT);
     if ($author != 'all') {
         $sth->bindParam(':author', $author);
     }
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     genResultsHeader('reddit', 'Posts', $author, $keyword, $rows, $page, $pages);
     if ($rows > 0) {
         echo '<div class="reddit-content">
           <table>
           <tbody>
             <tr>
                 <th>TimeStamp</th>
                 <th>Author</th>
                 <th>Body</th>
                 <th>Matched Keyword</th>
             </tr>';
         while ($row = $sth->fetch()) {
             $epoch_time = htmlspecialchars($row['epoch_time']);
             $real_time = htmlspecialchars(date('M d H:i:s', $epoch_time));
             $author = htmlspecialchars($row['author']);
             $author_url = "<a href=http://reddit.com/user/{$author}>{$author}</a>";
             $body = htmlspecialchars(substr($row['body'], 0, 150));
             $permalink = htmlspecialchars($row['permalink']);
             $keyword = htmlspecialchars($keyword);
             $body .= " <a href={$permalink} target='_blank'>[...]</a>";
             printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $real_time, $author_url, $body, $keyword);
         }
         echo '</tbody></table></div>';
     } else {
         echo "No results!";
     }
 }
Exemplo n.º 2
0
 function getResults($page, $keyword)
 {
     $sql = "SELECT epoch_time, profile_picture, user_id, name, message, keyword FROM facebook ";
     $where = "WHERE 1 = 1 ";
     if ($keyword != 'all') {
         $where .= "AND MATCH(message) AGAINST (:keyword IN BOOLEAN MODE) ";
     }
     $sql .= $where;
     $sql .= "ORDER BY epoch_time DESC ";
     $sth = $GLOBALS['dbh']->prepare($sql);
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     $rows = $sth->rowCount();
     $pages = ceil($rows / 10);
     $start = ($page - 1) * 10;
     $sql .= " LIMIT :start, 10";
     $sth = $GLOBALS['dbh']->prepare($sql);
     $sth->bindParam(':start', $start, PDO::PARAM_INT);
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     genResultsHeader('facebook', 'Posts', 'all', $keyword, $rows, $page, $pages);
     if ($rows > 0) {
         echo '<div class="facebook-content">
         <table>
             <tbody>
                 <tr>
                     <th>Time</th>
                     <th>Profile Picture</th>
                     <th>Name</th>
                     <th>Status</th>
                     <th>Keyword</th>
                 </tr>';
         while ($row = $sth->fetch()) {
             $epoch_time = htmlspecialchars($row['epoch_time']);
             $profile_pic_url = htmlspecialchars($row['profile_picture']);
             $profile_picture = "<img src={$profile_pic_url}>";
             $time = date('M d h:i:s', $epoch_time);
             $user_id = htmlspecialchars($row['user_id']);
             $name = htmlspecialchars($row['name']);
             $status = htmlspecialchars(substr($row['message'], 0, 150));
             $status .= " <a href='http://facebook.com/{$user_id}' target='_blank'>[...]</a>";
             $keyword = htmlspecialchars($keyword);
             printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $time, $profile_picture, $name, $status, $keyword);
             $count++;
         }
         echo '</tbody></table></div>';
     } else {
         echo "No results.";
     }
 }
Exemplo n.º 3
0
    function getResults($page, $keyword)
    {
        $sql = "SELECT epoch_time, title, author, content, keyword, link FROM wordpress ";
        $where = "WHERE 1 = 1 ";
        if ($keyword != 'all') {
            $where .= "AND MATCH(content) AGAINST (:keyword IN BOOLEAN MODE) ";
        }
        $sql .= $where;
        $sql .= "ORDER BY epoch_time DESC ";
        $sth = $GLOBALS['dbh']->prepare($sql);
        if ($keyword != 'all') {
            $sth->bindParam(':keyword', $keyword);
        }
        $sth->execute();
        $rows = $sth->rowCount();
        $pages = ceil($rows / 10);
        $start = ($page - 1) * 10;
        $sql .= " LIMIT :start, 10";
        $sth = $GLOBALS['dbh']->prepare($sql);
        $sth->bindParam(':start', $start, PDO::PARAM_INT);
        if ($keyword != 'all') {
            $sth->bindParam(':keyword', $keyword);
        }
        $sth->execute();
        genResultsHeader('wordpress', 'Blogs', 'all', $keyword, $rows, $page, $pages);
        if ($rows > 0) {
            echo '<div class="twitter-content">
              <table>
              <tbody>
                <tr>
                    <th>Time</th>
                    <th>Author</th>
		    <th>Title</th>
                    <th>Content</th>
                    <th>Matched Keyword<th>
                </tr>';
            while ($row = $sth->fetch()) {
                $epoch_time = htmlspecialchars($row[epoch_time]);
                $real_time = htmlspecialchars(date('M d H:i:s', $epoch_time));
                $title = htmlspecialchars(substr($row[title], 0, 30));
                $title .= "...";
                $author = htmlspecialchars($row[author]);
                $content = htmlspecialchars(substr($row[content], 0, 150));
                $keyword = htmlspecialchars($keyword);
                $link = htmlspecialchars(stripslashes($row[link]));
                $content .= " <a href='{$link}' target='_blank'>[...]</a>";
                printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $real_time, $author, $title, $content, $keyword);
            }
            echo '</tbody></table></div>';
        } else {
            echo "No results!";
        }
    }
Exemplo n.º 4
0
 function getResults($page, $keyword)
 {
     $sql = "SELECT epoch_time, pasteID, paste, keyword FROM pastebin ";
     $where = "WHERE 1 = 1 ";
     if ($keyword != 'all') {
         $where .= "AND MATCH(paste) AGAINST (:keyword IN BOOLEAN MODE) ";
     }
     $sql .= $where;
     $sql .= "ORDER BY epoch_time DESC ";
     $sth = $GLOBALS['dbh']->prepare($sql);
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     $rows = $sth->rowCount();
     $pages = ceil($rows / 10);
     $start = ($page - 1) * 10;
     $sql .= " LIMIT :start, 10";
     $sth = $GLOBALS['dbh']->prepare($sql);
     $sth->bindParam(':start', $start, PDO::PARAM_INT);
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     genResultsHeader('pastebin', 'Pastes', 'all', $keyword, $rows, $page, $pages);
     if ($rows > 0) {
         echo '<div class="pastebin-content">
         <table>
             <tbody>
                 <tr>
                     <th>Time</th>
                     <th>Paste</th>
                     <th>Keyword</th>';
         while ($row = $sth->fetch()) {
             $clean_epoch = htmlspecialchars($row[epoch_time]);
             $clean_paste = htmlspecialchars($row[paste]);
             $timeStamp = htmlspecialchars(date('M d h:i:s', $clean_epoch));
             $paste = htmlspecialchars(substr($clean_paste, 0, 150));
             $pasteID = htmlspecialchars($row[pasteID]);
             $keyword = htmlspecialchars($keyword);
             $paste .= " <a href='http://pastebin.com/{$pasteID}' target='_blank'>[...]</a>";
             printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n", $timeStamp, $paste, $keyword);
             $count++;
         }
         echo '</tbody></table></div>';
     } else {
         echo "No results.";
     }
 }
Exemplo n.º 5
0
 function getResults($page, $user, $keyword)
 {
     $sql = "SELECT epoch_time, from_user, text, twitter_id, keyword, profile_image_url_https FROM twitter ";
     $where = "WHERE 1 = 1 ";
     if ($user != 'all') {
         $where .= "AND from_user = :user ";
     }
     if ($keyword != 'all') {
         $where .= "AND MATCH(text) AGAINST (:keyword IN BOOLEAN MODE) ";
     }
     $sql .= $where;
     $sql .= "ORDER BY epoch_time DESC ";
     $sth = $GLOBALS['dbh']->prepare($sql);
     if ($user != 'all') {
         $sth->bindParam(':user', $user);
     }
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     $rows = $sth->rowCount();
     $pages = ceil($rows / 10);
     $start = ($page - 1) * 10;
     $sql .= "LIMIT :start, 10";
     $sth = $GLOBALS['dbh']->prepare($sql);
     $sth->bindParam(':start', $start, PDO::PARAM_INT);
     if ($user != 'all') {
         $sth->bindParam(':user', $user);
     }
     if ($keyword != 'all') {
         $sth->bindParam(':keyword', $keyword);
     }
     $sth->execute();
     genResultsHeader('twitter', 'Tweets', $user, $keyword, $rows, $page, $pages);
     if ($rows > 0) {
         echo '<div class="twitter-content">
           <table>
           <tbody>
             <tr>
                 <th>Time</th>
                 <th>User</th>
                 <th>Text</th>
                 <th>Matched Keyword<th>
             </tr>';
         while ($row = $sth->fetch()) {
             $epoch_time = htmlspecialchars($row['epoch_time']);
             $real_time = htmlspecialchars(date('M d H:i:s', $epoch_time));
             $from_user = htmlspecialchars($row['from_user']);
             $text = htmlspecialchars($row['text']);
             $twitter_id = htmlspecialchars($row['twitter_id']);
             $keyword = htmlspecialchars($keyword);
             $image = htmlspecialchars(stripslashes($row['profile_image_url_https']));
             $created_at = htmlspecialchars(date('Y-M-d H:i:s', strtotime($epoch_time)));
             $text .= " <a href='https://twitter.com/{$from_user}/status/{$twitter_id}' target='_blank'>[...]</a>";
             printf("<tr><td>%s</td><td><div class=twitter-profile-pic><img src='%s' width='48px' height='48px'/></div><a href='https://twitter.com/%s' target='_blank'>%s</a></td><td>%s</td><td>%s</td></tr>\n", $real_time, $image, $from_user, $from_user, $text, $keyword);
         }
         echo '</tbody></table></div>';
     } else {
         echo "No results!";
     }
 }
Exemplo n.º 6
0
    function getResults($page, $user, $keyword)
    {
        $sql = "SELECT epoch_time, profile_image, account_id, site, content_type, content, url, display_name FROM stackexchange ";
        $where = "WHERE 1 = 1 ";
        if ($user != 'all') {
            $where .= "AND account_id = :user ";
        }
        if ($keyword != 'all') {
            $where .= "AND MATCH(content) AGAINST (:keyword IN BOOLEAN MODE) ";
        }
        $sql .= $where;
        $sql .= "ORDER BY epoch_time DESC ";
        $sth = $GLOBALS['dbh']->prepare($sql);
        if ($user != 'all') {
            $sth->bindParam(':user', $user);
        }
        if ($keyword != 'all') {
            $sth->bindParam(':keyword', $keyword);
        }
        $sth->execute();
        $rows = $sth->rowCount();
        $pages = ceil($rows / 10);
        $start = ($page - 1) * 10;
        $sql .= "LIMIT :start, 10";
        $sth = $GLOBALS['dbh']->prepare($sql);
        $sth->bindParam(':start', $start, PDO::PARAM_INT);
        if ($user != 'all') {
            $sth->bindParam(':user', $user);
        }
        if ($keyword != 'all') {
            $sth->bindParam(':keyword', $keyword);
        }
        $sth->execute();
        genResultsHeader('stackexchange', 'Posts', $user, $keyword, $rows, $page, $pages);
        if ($rows > 0) {
            echo '<div class="stackexchange-content">
              <table>
              <tbody>
                <tr>
                    <th>Time</th>
                    <th>Account</th>
                    <th>Site</th>
		    <th>Content Type</th>
                    <th>Content</th>
                    <th>Keyword</th>
                </tr>';
            while ($row = $sth->fetch()) {
                $epoch_time = htmlspecialchars($row['epoch_time']);
                $real_time = htmlspecialchars(date('M d H:i:s', $epoch_time));
                $profile_image_url = htmlspecialchars($row['profile_image']);
                $profile_image = "<div class=twitter-profile-pic><img src={$profile_image_url} width=50px height=50px /></div>";
                $display_name = htmlspecialchars($row['display_name']);
                $account_id = htmlspecialchars($row['account_id']);
                $account_id_url = "<a href=http://stackexchange.com/users/{$account_id} target='blank'>{$display_name}</a>";
                $site = htmlspecialchars($row['site']);
                $content_type = htmlspecialchars($row['content_type']);
                $content = htmlspecialchars(substr($row['content'], 0, 150));
                $created_at = htmlspecialchars(date('Y-M-d H:i:s', strtotime($epoch_time)));
                $url = htmlspecialchars($row['url']);
                $content .= " <a href='{$url}' target='_blank'>[...]</a>";
                $keyword = htmlspecialchars($keyword);
                printf("<tr><td>%s</td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $real_time, $profile_image, $account_id_url, $site, $content_type, $content, $keyword_clean);
            }
            echo '</tbody></table></div>';
        } else {
            echo "No results!";
        }
    }