Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS Feed #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions feed.php
@@ -0,0 +1,29 @@
<?php
header("Content-Type: application/rss+xml; charset=UTF-8");

require('opendb.php');
$feed_items = 20;

$query = "SELECT * FROM new_commits ORDER BY date DESC LIMIT " . $feed_items;
$result = mysql_query($query);
?>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Commit Logs From Last Night</title>
<link>http://www.commitlogsfromlastnight.com/</link>
<description>because real hackers pivot two hours before their demo</description>
<language>en-us</language>
<copyright>Created by @abestanway</copyright>

<?php while($row = mysql_fetch_array($result)){ ?>
<item>
<title><?php echo $row['username'] ?></title>
<description><?php echo $row['message'] ?></description>
<link><?php echo $row['commiturl'] ?></link>
<pubDate><?php echo date("D, d M Y H:i:s O", strtotime($row['date'])) ?></pubDate>
</item>
<?php } ?>

</channel>
</rss>
1 change: 1 addition & 0 deletions index.php
Expand Up @@ -39,6 +39,7 @@ function get_num_pages($per_page){
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Marvel:700italic' rel='stylesheet' type='text/css'>
<link href='styles.css' rel='stylesheet' type='text/css'>
<link rel="alternate" type="application/rss+xml" href="/feed.php" title="Commit Logs From Last Night - RSS Feed">
<script type="text/javascript" src="jquery.infinitescroll.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
Expand Down