RSS feeds of character reports
Moderators: Public Relations Department, Players Department, Programming Department, Game Mechanics (RD)
- Spillages
- Posts: 395
- Joined: Thu May 25, 2006 10:33 pm
- Location: Spokane, WA.
- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
because unless we find out who's accessing the feed, by having them log in as that's the only means of identification we have, we won't know what characters to show.
without authentication, we'll end up with a feed over 6000 entries long, showing all the characters in the game, not just the ones belonging to the player accessing the feed
without authentication, we'll end up with a feed over 6000 entries long, showing all the characters in the game, not just the ones belonging to the player accessing the feed
- Spillages
- Posts: 395
- Joined: Thu May 25, 2006 10:33 pm
- Location: Spokane, WA.
That's what the Cantr login page is for.
They log in, and get directed to character page as usual, and from there they should have a link to their own RSS feed. Each player has their own unique hash. and each link given out by the RSS should direct to a page with ads(to help pay for cantr) and a login box for id and password.
They log in, and get directed to character page as usual, and from there they should have a link to their own RSS feed. Each player has their own unique hash. and each link given out by the RSS should direct to a page with ads(to help pay for cantr) and a login box for id and password.
silence is golden;
DUCT TAPE IS SILVER!
DUCT TAPE IS SILVER!
- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
Spillages wrote:They log in, and get directed to character page as usual, and from there they should have a link to their own RSS feed.
An RSS feed is essentially a template that is filled with the correct information by a script, either in advance or when it's requested and sent as an XML file.
What this means is there is a single script that generates the feed for all the users accessing it. Having a separate file for each account is technically possible, but in our case very impractical because we have over 1000 users.
As events happen so frequently, and given that a feed must be tailored to the user accessing it, we can rule out generating the XML file in advance.
So, the preferred solution is a single script that generates the correct XML file for the user accessing it on demand. That is, the file is only generated when it is requested by the user.
Because when the user requests the XML file (by accessing the feed) the script will run but won't know who requested it, or what characters to include, we have to ask for authentication.
AFAIK, there's no way to pass parameters to XML files, although possibly, if it's being processed by php by modifying .htaccess, a GET value may work.
Regardless, all a hash value would do is replace the userID/password combination. A hash value would still need to be processed to find the characters associated with it, just as if you were using UserID and password to identify the user.
- marol
- Posts: 3728
- Joined: Sun Jul 17, 2005 11:45 am
- Location: Kraków, PL
- Contact:
- SekoETC
- Posts: 15525
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
SekoETC wrote:That sounds like it would be more work than something else.
Actually, now that we've talked this through and I can see how it would work, this code ought to do the job:
Please note, the authenticate() and checkNewEvents() functions are just placeholders for code that is specific to Cantr's implementation that I don't know and can't guess or assume a ready-made function already exists for.
Code: Select all
<?php
if( (isset($_SERVER['PHP_AUTH_USER'])) AND (isset($_SERVER['PHP_AUTH_PW'])) ){
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
if(authenticate($user, $pass)){ //use Cantr's user authentication functions to check username and password match
?>
<rss>
<channel>
<title>Cantr.net Character Events</title>
<link>www.cantr.net</link>
<description>This feed will alert you when you have new events for your characters</description>
<language>en-us</language>
<php>
</channel>
</rss>
<php> $value){
if(checkNewEvents($row['characterID'])){ //checks the character given by characterID for new events
echo '<item>';
echo "<title>".$row['characterName']."</title>";
echo '<link>www.cantr.net</link>';
echo "<description>You character ".$row['characterName']." has new events.</description>";
echo '</item>';
}
}
}
}else{
die(mysql_error());
}
}
?>
- Spillages
- Posts: 395
- Joined: Thu May 25, 2006 10:33 pm
- Location: Spokane, WA.
Uh... I knew it wasn't hard to do and it wouldn't take up much
Except, the only changes I see that should be made would be to not say the character name, only to always have a link to cantr.net in the feed and just change the name of it to one or more of your characters have new events. or something along those lines, just so if your feed accidentally gets out.
Except, the only changes I see that should be made would be to not say the character name, only to always have a link to cantr.net in the feed and just change the name of it to one or more of your characters have new events. or something along those lines, just so if your feed accidentally gets out.
silence is golden;
DUCT TAPE IS SILVER!
DUCT TAPE IS SILVER!
- marol
- Posts: 3728
- Joined: Sun Jul 17, 2005 11:45 am
- Location: Kraków, PL
- Contact:
Code: Select all
<php> $value){
Anyway I'll contact you in next few days and give you possibility to implement it on real Cantr code.
I don't mean access to the feed, but custom, simple standalone application which could notify which character and how many events. But you may start from RSS as well.Solfius wrote:Do you mean to access the feed? I wasn't talking about that, as there are many feed readers already available.
- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
Spillages wrote:Uh... I knew it wasn't hard to do and it wouldn't take up much
Except, the only changes I see that should be made would be to not say the character name, only to always have a link to cantr.net in the feed and just change the name of it to one or more of your characters have new events. or something along those lines, just so if your feed accidentally gets out.
That's possible, and could potentially reduce the number of database queries if we only search until we find a character with new events, then stop checking the rest.
A typo, that's not in my original file, so I don't know how that got there.
marol wrote:I don't mean access to the feed, but custom, simple standalone application which could notify which character and how many events. But you may start from RSS as well.
As in something written in a language like Java?
At the moment I don't know enough about communicating across networks in Java (the language I'm most familiar with) to write something like that, and although I could find out, using PHP and RSS requires a lot less effort.
If, by standalone, you meant independent from the existing Cantr code, then that's easy enough to do, in spite of my allergy to code repetition

- Jos Elkink
- Founder Emeritus
- Posts: 5711
- Joined: Mon Jul 14, 2003 1:17 pm
- Location: Dublin, Ireland
- Contact:
marol wrote:I don't mean access to the feed, but custom, simple standalone application which could notify which character and how many events. But you may start from RSS as well.
But is for that the RSS feed the simplest implementation? I mean, any player with programming skills can write a little app that regularly checks the RSS feed and shows when there are new events and then put that app on a website or something - it doesn't require Cantr ProgD staff once we have the RSS feed

Solfius, good work, I look forward to seeing it implemented. One issue I worry about, though: how do we implement something that avoid people opening this page too often? E.g. somebody writing a little application to check every five seconds, all day long, whether there are any new events ... I remember managing to bring the university mail server down by configuring my mail client at home that way

- Solfius
- Posts: 3144
- Joined: Wed Jul 16, 2003 5:31 pm
My first thought was a check to see when it was last requested via the database and if that is too soon, don't proceed, but I think there is a more elegant solution using caching.
I don't know how RSS readers handle caching, so we can include header information with the script output instructing the feed reader to store it for so long.
As a fail-safe, we can use server side caching, which involves the PHP script storing its output, and if the file is requested checking to see how much time has lapsed since it was created, and if the file has existed longer than the limit we set, reprocess the script, otherwise output the cached file.
Server side caching still includes some PHP processing, but if the page is already cached, then no database calls are processed, only reading a file and outputting it.
Caching requires more work, but takes the load off the database, which is preferable IMO.
I don't know how RSS readers handle caching, so we can include header information with the script output instructing the feed reader to store it for so long.
As a fail-safe, we can use server side caching, which involves the PHP script storing its output, and if the file is requested checking to see how much time has lapsed since it was created, and if the file has existed longer than the limit we set, reprocess the script, otherwise output the cached file.
Server side caching still includes some PHP processing, but if the page is already cached, then no database calls are processed, only reading a file and outputting it.
Caching requires more work, but takes the load off the database, which is preferable IMO.
- SekoETC
- Posts: 15525
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
The forums have this problem that if you have greater than or lesser than signs in the code, it may hide the code between them because it interprets it as HTML even though it doesn't recognize it. But then again if you put valid HTML inside code tags, doesn't it show the code?
Yup, it does.
But if you put ...
It comes out as
What we can interpret from this is that the code tags are designed to be used for HTML and not any real (or pseudo) languages.
Code: Select all
<b>Testing</b>
Yup, it does.
But if you put ...
Code: Select all
if (something LESS_THAN another)
{
doStuff();
}
else if (something MORE_THAN third)
{
doOtherStuff();
}
It comes out as
if (something <another> third)
{
doOtherStuff();
}
What we can interpret from this is that the code tags are designed to be used for HTML and not any real (or pseudo) languages.
Not-so-sad panda
- Jos Elkink
- Founder Emeritus
- Posts: 5711
- Joined: Mon Jul 14, 2003 1:17 pm
- Location: Dublin, Ireland
- Contact:
Solfius wrote:As a fail-safe, we can use server side caching
Yes, considering that any Cantr player with programming skills could write an RSS reader specifically for Cantr, we do need protection on the server side in addition to the instruction for the RSS reader that you suggest. A combination of both, where the server fail-safe does not access the database, should work.
Return to “Likely Suggestions”
Who is online
Users browsing this forum: No registered users and 1 guest